Skip to main content

RECORDLOCKED

Returns the lock status for a record or file.

Synopsis

RECORDLOCKED(filevar,recID)

Arguments

filevar A file variable name used to refer to a MultiValue file. This filevar is supplied by the OPEN statement. filevar must be specified as a literal.
recID The record ID of the record to be checked for lock status. An expression that resolves to an integer.

Description

The RECORDLOCKED function returns an integer code specifying the lock status of the specified record or file. The following are the return codes:

3 This user has a file lock (shared or exclusive).
2 This user has an update record lock.
1 This user has a shared record lock.
0 This record is not locked.
-1 Another user has a shared record lock.
-2 Another user has an update record lock.
-3 Another user has a file lock (shared or exclusive).

If the specified file has both a file lock and a record lock, RECORDLOCKED returns the record lock code.

Invoking the RECORDLOCKED function sets the STATUS function to the job number of the job that holds the lock. If the lock is a shared lock, STATUS returns the job number of the first job found. If the current user shares the lock with another user, STATUS returns the other user's job.

File and Record Locking and Unlocking

To lock a file, use the FILELOCK statement. To unlock a file, use the FILEUNLOCK statement.

To lock a record, use the RECORDLOCKU (update lock) or RECORDLOCKL (shared lock) statement. To unlock a record, use the RELEASE statement.

See Also

FeedbackOpens in a new tab