The run-time system supports this COBOL system's multi-user facilities which allow files to be shared between users in a multi-user environment, and allow run-time system elements accessing those files to lock records or entire files in order to prevent access to them while data is being updated.
In single-user environments the multi-user syntax has no effect at run time, but run-time system elements can be developed for use in both single- and multi-user environments.
Files are either active or inactive. An active file is open to one or more run units. An inactive file is one that is not open to any run unit.
Active files can be open in one of two modes: exclusive or shareable:
A file which is in exclusive mode is open to one run unit only; any other run unit which attempts to access it receives a "File locked" error and is denied access. Exclusive mode implies that a file lock is held by the one run unit which is able to access the file; the file lock is released by that run unit closing the file.
A file which is in shareable mode is available to any number of run units, each of which can protect data while using the file by locking one or more records at a time in the file. This prevents other run units from acquiring a lock on the individual records that are locked, but does not prevent access to the file otherwise. The organization of the file affects the way the file can be shared.
The organization of the file affects the way the file can be shared:
Record sequential files opened for INPUT can be shared between run units but records cannot be locked in the file. Files opened for I-O or EXTEND can also be made shareable and each run unit can maintain a record lock for the file. Files opened for OUTPUT always have an exclusive file lock.
Line sequential files that are opened INPUT or EXTEND can be made shareable but records cannot be locked in the file. Files that are opened OUTPUT always have an exclusive file lock.
Files that are opened in INPUT mode are shareable, but records cannot be locked in the file. Files that are opened I-O can be shareable but files that are opened OUTPUT or EXTEND are exclusive.
Each run unit that is sharing access to a file can be locking either a single record or multiple records in that file. A run unit cannot select single record locking and multiple record locking for the same file.