The RECORDLOCKED() function indicates whether a given record is locked.
The RECORDLOCKED() function returns a value indicating the state of any locks on record record.id of the file open as file.var. The tokens shown in the table below are defined in the KEYS.H record of the SYSCOM file.
A record may be multiply locked in which case the RECORDLOCKED() function reports only one of the current locks. File locks take precedence over read or update locks. If no file lock is set, read or update locks held by the process in which the RECORDLOCKED() function is performed take precedence over locks held by other processes.
Executing the STATUS() function after a RECORDLOCKED() function indicates that a lock is active will return the user number of the user holding the lock.
IF RECORDLOCKED(STOCK, "ORDER.LIST") THEN
DISPLAY "Record is locked by user " : STATUS()
This program fragment checks if record ORDER.LIST is locked and, if so, reports the user number of the process that holds the lock.