It is possible to install or de-install an MFS dynamically by updating a file handle in an BASIC+ program. This technique is useful if programmers wish to add transaction processing, security, or other MFS functionality to a file based on factors that can only be determined at runtime.

If used in reverse -- if a program removes an MFS from a file handle -- the technique can be used to temporarily bypass a specific MFS for performance or other reasons.

  • A dynamic, file-handle-based MFS installation differs in three major ways from a permanent MFS installation that updates the media map. The first difference is that the MFS is installed (or de-installed) only for those routines that use the dynamically-updated file handle. If a user (on a network, for instance) accesses the file using a different routine, changes to the MFS list for a file will not be reflected for that user.

  • A second difference is that installation of the MFS is temporary. Once the program or programs that use the updated file handle have stopped, the MFS is no longer installed or de-installed.

  • Finally, certain calls will not be available to the MFS installed dynamically.  For example, the MFS will not be able to trap the OPEN.FILE call, since this must be executed before the file handle is available to be updated with the MFS name.

The following sample code illustrates a possible technique for installing an MFS dynamically:

MFS.NAME = "SAMPLE.MFS"
OPEN 'SYSTABLES' TO FILE.HANDLE THEN
  FILE.HANDLE = MFS.NAME : @SVM : FILE.HANDLE
END
SELECT FILE.HANDLE
*  processing continues
Because this technique assumes a particular format for the file handle, it may not work for all filing structures. In addition, the structure of file handles may change in future releases of OpenInsight.
  • No labels