Versions Compared

Key

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

MFS programmers will notice quickly that there is not a one-to-one correspondence between a BASIC+ OPEN statement and an MFS-level OPEN.FILE call. In fact, as a rule, an OPEN.FILE call will be generated only once per session for a given file.

OPEN.FILE Call

The OPEN.FILE call is generated by the BASIC+ interpreter in order to create a file handle for the file. The BFS creates a handle that it will recognize for subsequent read, write, and other record-oriented requests. The format of the file handle is dependent on the BFS being accessed.

Once the file handle has been created and returned from the BFS, the BASIC+ interpreter stores it in field five of the FILES file entry for the file in question. Any file that has already been opened during the current OpenInsight session will have a file handle in this field.

If the BASIC+ interpreter detects a file handle in the FILES file for the file being accessed, it will not generate a call to the filing system to return a handle. Instead, the handle is simply read from the FILES file and returned to the BASIC+ OPEN statement. This results in greater efficiency by lowering the overhead required to return a file handle.

BASIC+ Open File Handle

The file handle returned in the BASIC+ OPEN statement is not identical to that stored in the FILES file.  BASIC+ OPEN returns a file handle that contains both the filing system list for a file (the MFS and BFS list) as well as the file handle required by the BFS. The filing system list is the first value (@VM-delimited) of the returned handle, and the BFS file handle is the second value. Multiple MFSs in the file handle are delimited with @SVM.

...