Caché MultiValue Basic Reference
RECORDLOCKL, RECORDLOCKU
[Back] [Next]
   
Server:docs2
Instance:LATEST
User:UnknownUser
 
-
Go to:
Search:    

Locks a record in a MultiValue file.
Synopsis
RECORDLOCKL filevar, recID [ON ERROR statements] [LOCKED statements]

RECORDLOCKU filevar, recID [ON ERROR statements] [LOCKED statements]
Arguments
filevar A file variable name used to refer to a MultiValue file. This filevar is supplied by the OPEN statement.
recID The record ID of a record to be locked, specified as an integer.
Description
The RECORDLOCK statements are used to lock a record in a MultiValue file.
The RECORDLOCK statements take the file identifier filevar, defined by the OPEN statement.
You can optionally specify a LOCKED clause. This clause is executed if the record to be locked has already been locked by another user. The clause is executed if the level of lock requested conflicts with an existing lock. This clause is optional, but strongly recommended; if no LOCKED clause is specified, program execution waits indefinitely for the conflicting lock to be released. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the LOCKED keyword and the first line.
You can optionally specify an ON ERROR clause. If file lock fails, the ON ERROR clause is executed. This may occur if filevar does not refer to a currently open file. The statements argument can be the NULL placeholder keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line; there must be a line break between the ON ERROR keyword and the first line.
You can check the status of file locks and record locks using the RECORDLOCKED function.
Lock Promotion
If you have a shared lock on a record, then request an exclusive (update) lock on the same record, MVBasic attempts to get the exclusive lock. If it is successful, your shared lock is promoted to an exclusive lock. The result is that you hold one exclusive lock, not two locks.
Releasing Record Locks
Use RELEASE to release individual record locks. CLOSE releases all record locks held on the specified file. ABORT and STOP release all record locks held by the current process.
An update record lock is automatically released when you write data to the record using WRITE or WRITEV. The WRITEU and WRITEVU commands do not release the update record lock.
An update record lock is automatically released when you delete the record using DELETE. The DELETEU command does not release the update record lock.
See Also