RECORDLOCKED

The RECORDLOCKED function can be called to ascertain the status of a record lock.

 

COMMAND SYNTAX

RECORDLOCKED(filevar, recordkey)

 

SYNTAX ELEMENTS

filevar is a file variable from a previously executed OPEN statement.
recordkey is an expression for the record id that will be checked.

 

NOTES

RECORDLOCKED returns an integer value to indicated the record lock status of the specified record id.

Locked by this process by a FILELOCK
Locked by this process by a READU
Locked by this process by a READL

Not locked

-1  Locked by another process by a READL
-2  Locked by another process by a READU
-3  Locked by another process by a FILELOCK

If the return value is negative, then the SYSTEM(43) and STATUS function calls can be used to determine the port number of the program that holds the lock. If -1 is returned, more than 1 port could hold the lock and so the port number returned will be the first port number found.]

 

EXAMPLE

OPEN "INVENTORY" TO invFvar ELSE ABORT 201,"Cannot open the INVENTORY file"
...
...
IF RECORDLOCKED(invFvar,invId) = -2 THEN
    CRT "Inventory record ":invId:" is locked by port ":SYSTEM(43)
END


jBC