You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

The first method uses the BASIC+ ON ... GOSUB statement to branch to a local subroutine for each file operation. The CODE argument provides the index value for the ON...GOSUB statement. The GOSUB portion is followed by a list of 28 statement labels. Each statement label identifies the logic within the body of the MFS program for a particular file operation.

A typical statement begins like this:

ON CODE GOSUB READ.RECORD, READO.RECORD, WRITE.RECORD, DELETE.RECORD, LOCK.RECORD ...

For example, if a record lock operation is being executed, the value of CODE will be 5. The ON ... GOSUB statement will branch to the fifth statement label, in this case LOCK.RECORD.

Very frequently, the MFS is concerned with only a small number of file operations, such as READ.RECORD and WRITE.RECORD. In this case, the logic for most remaining operations can be lumped under a single label in the MFS. The MFS might "stack" statement labels that have code in common, as in this example:

 

READ.RECORD
   (record read logic here)
  RETURN
CREATE.FILE:
RENAME.FILE:
DELETE.FILE:
("do nothing" logic here)
RETURN
  • No labels