EXCLUSIVE File Access
ANSI
The EXCLUSIVE access mode is optional for all PREPARE/OPEN instructions and designates limited accessibility to the file.
Note the following:
An attempt to OPEN a file in EXCLUSIVE mode that is currently open in SHARE or SHARENF mode or is write-protected generates a trappable I/O error.
A system open is performed upon execution of an OPEN or PREPARE instruction. The file handle remains open until the file is closed or the program terminates.
Data is not automatically flushed to disk after each instruction nor is the system directory continuously updated. Data remains in memory until the internal buffer is full or a CLOSE, OPEN, or PREP instruction is executed for the same logical file name.
Data files opened in EXCLUSIVE mode are not protected against premature termination of the program since the system directory is not being continuously updated.
How users of other PL/B programs are affected by a file opened in EXCLUSIVE mode depends upon the multi-user system in use. In most multi-user implementations, a file opened in EXCLUSIVE mode is locked and unavailable for SHARE, SHARENF, or EXCLUSIVE mode access by other PL/B programs. Files opened in EXCLUSIVE mode may only be accessed by other PL/B programs that use the READ access mode for the file.
Throughput from files opened in EXCLUSIVE mode is faster than those in SHARE or SHARENF mode.
EXCLUSIVE mode is only recommended for inquiry only files or files that just one user is allowed to update.
A single program may open a file multiple times in EXCLUSIVE mode.
See Also: Disk I/O Instructions
![]() |