Versions Compared

Key

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

...

READ statement, for example, always produces the same BFS call, regardless of what filing system is actually being accessed by the read logic. By extension, all MFSs must use the same calling conventions.

 

Code Block
declare subroutine fsmsg , attach_table, msg
OPEN 'SYSTABLES' TO FILES.FILE ELSE
  fsmsg()
  return
end
OPEN 'SYSVOLUMES' TO VOLUMES.FILE ELSE
  fsmsg()
  return
end
FILENAME = 'TESTFILE'
MFS.NAME = 'MYMFS.MFS'
READ FILES.REC FROM FILES.FILE, FILENAME ELSE
  fsmsg()
  return
END
VOLUME.NAME = FILES.REC<1> ; * get the name of the volume
READ VOLUME.REC FROM VOLUMES.FILE, VOLUME.NAME ELSE
  fsmsg()
  return
END
* construct the file handle for the REVMEDIA map in question
MEDIA.HANDLE = VOLUME.REC<4> : @VM : VOLUME.REC<5>
* construct the key (file.name*account.name) for the file.
* this information is stored in the SYSTABLES file
MEDIA.MAP.KEY = FILES.REC<2> :"*": FILES.REC<3>
* update the media map entry with the MFS info. MFS lists are
* stored as the 2nd attribute of the media map entry for a file
READ MEDIA.MAP.REC FROM MEDIA.HANDLE, MEDIA.MAP.KEY THEN
* put new MFS name on front of existing MFS list
  OLD.MFS.LIST = MEDIA.MAP.REC<2>
  NEW.MFS.LIST = MFS.NAME : @VM : OLD.MFS.LIST
  MEDIA.MAP.REC<2> = NEW.MFS.LIST
  WRITE MEDIA.MAP.REC TO MEDIA.HANDLE, MEDIA.MAP.KEY ELSE
     fsmsg()
     return
  END
  * reattach file to update SYSTABLES entry
  Attach_Table(FILES.REC<1>,FILES.REC<2>,'','')
END ELSE
   MSG(@window, "Cannot read ":MEDIA.MAP.KEY,'')
   return
END ; * read media.map rec
RETURN 0