Installing an MFS Using a BASIC+ Program
A BASIC+ program can be created to automate the steps described above for manual installation. A BASIC+ program to install an MFS lessens the possibility of edit errors when accessing the REVMEDIA file, and provides a means for end users to install an MFS without concern about the integrity of the media map.
A BASIC+ program can also use information available in the SYSTABLES and SYSVOLUMES files to construct a file handle for the media map to be updated with MFS information. A program can then read and write directly to the media map using the handle, bypassing the requirement to attach and then open the media map. As a result, the installation procedure will be faster, and is not restricted to the SYSPROG account.
Note: Information about a media map is BFS-specific. An MFS installation procedure written for a specific BFS may not work properly with all BFSs.
The following sample program fragment illustrates the essentials of constructing and using a media map handle. The technique illustrated here works with media maps for ROS and Linear Hash files (RTP51 and RTP57), installing the MFS MYMFS.MFS on the TESTFILE table.
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