SHARENF File Access
The SHARENF access mode is optional for all file PREPARE/OPEN instructions and designates that the file is shareable.
Note the following:
An attempt to OPEN a file already opened in EXCLUSIVE mode by another program or a file that is write-protected generates a trappable I/O error.
Any file opened in SHARENF mode does not automatically flush the new end of file position to the directory for each WRITE to the file. Other programs see the new position and any new records written to the file since the Operating System is keeping the correct file size internally. A FLUSH, FLUSHEOF, or CLOSE instruction must be executed in order to get the correct file size updated in the directory.
SHARENF mode is faster than SHARE mode when the data files are being extended. However, since the directory contents are not continuously updated, premature system failure could cause loss of data when SHARENF is used.
Even if SHARE mode is used, it remains the responsibility of the programmer to design the application for correct multi-user access (through usage of FILEPI, etc.)
SHARE or SHARENF mode must be used if a physical text file is updated by more than one user simultaneously or through more than one key file within the program.
See Also: Disk I/O Instructions
![]() |