TablesĀ 2, 3 and 4 show the default type of locking which is used when files are opened in a particular open mode. The default locking can be modified if the AUTOLOCK Compiler directive was specified at the time the compilation group was submitted to your COBOL system. The tables also indicate whether the default type of locking can be overridden for individual files. This is done by inserting a suitable clause in the SELECT clause for the file. (See the topic The File Control Entry.)
X/Open restricts those X/Open conforming source programs that use locking to either single record locks with automatic locking, or multiple record locks with manual locking.
OPEN Mode | No Directive | AUTOLOCK Compiler Directive | Override in SELECT Statement |
---|---|---|---|
INPUT | No lock | No lock | Yes, but only to Exclusive |
I-O | Exclusive | Lock on single record | Yes |
OUTPUT | Exclusive | Exclusive | No |
EXTEND | Exclusive | No lock | Yes, the file can be made shareable but no records are locked |