PURPOSE: The LOCK statement locks every record in the specified DS for exclusive access. It can only be used under the Concurrent Queued environment. The lock is canceled by a FREE statement, or by the termination of the PM.
LOCK designator ALL
designator |
is the name by which the DS is identified in the RELATE statement. |
LOCK AUX2 ALL
NOTES: The LOCK statement waits until no records are currently reserved by other users accessing the DS.
If @RECORD_WAIT seconds elapse while the PM waits to lock all records in the DS, a time interrupt occurs, @AUX is set to “BUSY”, and the PM continues.
When all records in the DS are locked by the LOCK statement, other concurrent users accessing the DS must wait until the records are freed. During the waiting period, the value of @RECORD_MESSAGE will be displayed on those users’ screens every 30 seconds until the records are freed or until @RECORD_WAIT seconds elapse. If @RECORD_WAIT seconds elapse while a user waits for the locked records, his @AUX is set to “BUSY,” and the PM continues.
The LOCK statement is only valid when the PM is running under the Concurrent Queued environment; otherwise, the LOCK statement results in an error condition, and @AUX is set to “LOCK.” This is invoked by the ALLOWING clause in the RELATE statement for the data set.