SHARE File Access
ANSI
The SHARE access mode is the default mode 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.
SHARE mode files offer the maximum data integrity of the four access modes.
Any file opened in SHARE mode has its contents and directory entry continuously updated for each transaction that takes place. For this reason, files accessed in SHARE mode are protected from premature termination of the program due to errors or system failure. Because of the efforts required to insure the data integrity, overall throughput using SHARE mode is somewhat less than SHARENF, EXCLUSIVE, or READ mode files.
The automatic flushing of buffers may be disabled using the PLB_SHAREFLUSH runtime keyword or SETMODE control.
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 same program.
See Also: Disk I/O Instructions
![]() |