LOCK
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
LOCK:lock_spec
Arguments
lock_spec
One of the following identifiers or corresponding values: (n)
Do not lock the record.
Perform automatic locking on the record. (default)
Perform manual locking on the record.
Do not lock the record or probe the index tree.
Discussion
The LOCK qualifier specifies whether the operation requires a record lock.
Manual locking is similar to automatic locking, except that manual locking blocks all update reads until either the channel is closed, an explicit UNLOCK with the RFA qualifier specified is performed, or the FREE subroutine is called.
On Windows and Unix, manual record locking is available only for ISAM files. If you specify a manual lock on a relative (or other) file, an automatic lock will be applied. OpenVMS allows manual locks on RMS ISAM and relative files. |
Q_NO_LOCK allows you to read a locked record with a READ or READS statement when it’s opened in update mode. The read record is not locked.
Q_MANUAL_LOCK applies a manual lock for the record stored with a STORE statement or read by a FIND, READ, or READS statement.
On Windows and Unix,
- Q_NO_TLOCK causes a READS statement on a file open for update to perform like READS on a file open for input. By default, READS on a file open for update probes the index tree and locks the record. With Q_NO_LOCK, it probes the tree but doesn’t lock the record. With Q_NO_TLOCK, it does not probe the tree or lock the record. On an active file (one with concurrent updates occurring), some records may not be seen at all by a READS using Q_NO_TLOCK without an intervening READ statement.
- Q_NO_TLOCK and READ/READS on a channel open for input produce the same results: a cached copy of the current index blocks is searched for the record requested (with READ) or the next record (with READS). As a result, any new records that were stored (or any existing records whose keys changed in the current index) that affect the current cached index blocks will not be seen. These changes are always seen by default on an update channel, because every operation rereads the index block(s). (Of course, a deleted record is not returned.)
- For performance reasons (especially to improve xfServer and/or locking performance), use Q_NO_TLOCK instead of Q_NO_LOCK unless you explicitly want to see concurrent changes by other users.
Q_NO_TLOCK and Q_NO_LOCK are synonymous on OpenVMS systems.
On the OPEN statement for both non-ISAM and ISAM files, the Q_NO_LOCK and Q_AUTO_LOCK are the only valid options for the LOCK qualifier.
On the STORE statement, Q_NO_LOCK and Q_MANUAL_LOCK are the only valid options for the LOCK qualifier.
See also
- Record locking
- OPEN statement
- STORE statement
- System option #55