Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Compile subroutine MFS_Installer(TargetTable,MFS_Name,Action)
 /*
  --> RUN MFS_INSTALLER 'CUSTOMERS','SIMPLE_MFS*EXAMPLES',2     <--- 2 is default
 MFS Installer
 Original Author  Cameron Purdy
 Revised  R T Bright
 1. Develop your MFS in the SYSPROG application. That is the only supported application for developing an MFS/BFS in.  
(This routine can be run in Application at owner's risk)  2 
2. The FILE.SYSTEM.EQUATES and FILE.SYSTEM.ONGOSUB inserts are often used to help implement an MFS.  3 
3. Always remove the MFS before adding it, and always save the database
definition after adding it.   This fixes a synchronization issue if you
have added the MFS to the table (i.e. put it in the mediamap) but have not saved the database definition.
*/   
   Declare subroutine Set_Status , Set_MFS, Define_Database, Message_Box
   $Insert logical
   debug
   Equ AddMFSEnd$       to 1
   Equ AddMFSBegin$     to 2
   Equ AddMFSNearBegin$ to 3
   Equ RemoveMFS$       to 5
   Equ RemoveAllMFS$    to 6
   
   If Index(MFS_Name,'*':@AppID<1>,1) Else
     MFS_Name :='*':@AppID<1>
   End  
   
   /* first remove MFS (in case it is already in the media map)*/
   Set_Status(FALSE$)
   
   Set_MFS(TargetTable, MFS_NAME, RemoveMFS$)
   
   Convert @Lower_Case to @Upper_Case in Action
   If Action = 5 or Action = 'REMOVE' then
     Return
   End  
   
   * add the MFS
   Set_Status(FALSE$)
   
   Set_MFS(TargetTable, MFS_NAME, AddMFSBegin$)
   
   if Get_Status(Code) then
     Error  = "An error occurred adding the MFS to the ": TargetTable: " table."
     Error := "||Error Code: ": Code<1,1,1>
     gosub ErrMsg
   end
   
   /* update database definition*/
   Set_Status(FALSE$)
   Define_Database(@dbid, TRUE$, "", "")
   if Get_Status(Code) then
      Error  = "An error occurred saving the ": @dbid: " database definition."
      Error := "||Error Code: ": Code<1,1,1>
      gosub ErrMsg
   end
Return 1
ErrMsg:
  Call Msg(@Window,Error)
Return 0