Lock STATEMENT

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.

General Form

LOCK designator ALL /RECORDS/

where:

designator is the name by which the DS is called in the RELATE statement.

NOTES:  The LOCK statement waits until no records are currently reserved by other users accessing the DS.

If @RECORDS.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 user’s screen 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.  (@RECORD.WAIT is discussed below along with other system fields used by simultaneous update.)

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”.