RECORDLOCKL, RECORDLOCKU |
![]() ![]() ![]() |
The RECORDLOCKL statement sets a read lock on a record. The RECORDLOCKU statement is similar but sets an update lock.
Format
RECORDLOCKL file.var, record.id {ON ERROR statement(s)} {LOCKED statement(s)}
where
The RECORDLOCKL statement sets a read lock on record record.id of the file open as file.var. The RECORDLOCKU statement sets an update lock.
The LOCKED clause is executed if the file or record is locked by another process in a manner than prevents further locking. The STATUS() function will return the user id of a process holding a lock on this file or record. If the LOCKED clause is omitted and the file or record is locked, the program will wait for the lock to be released.
A process may lock records within files for which it also holds the file lock. These statements may also be used to convert an existing read lock to an update lock or vice versa.
Example
RECORDLOCKL STOCK, "ORDER.LIST" LOCKED DISPLAY "Waiting. Order list locked by user " : STATUS() RECORDLOCKL STOCK, "ORDER.LIST" END
This program fragment attempts to lock record ORDER.LIST of the file open as STOCK. If it is locked, a message is displayed and a second RECORDLOCKL statement is executed without a LOCKED clause to wait for the lock. |