Guardian Procedure Calls Reference Manual

Alternate locking mode
If the record is already locked by another user when FILE_LOCKREC64_ is called, the lock
request is rejected, and the call to FILE_LOCKREC64_ completes immediately with file-system
error 73 (record is locked). The alternate locking mode is specified by calling the
FILE_SETMODENOWAIT64_ procedure and specifying function 4.
Attempting to read a locked record in default locking mode
If the default locking mode is in effect when FILE_READ64_ or FILE_READUPDATE64_ is called
for a record that is locked by another user, the caller to FILE_READ64_ or
FILE_READUPDATE64_ is suspended and queued in the "locking" queue behind other users
attempting to lock or read the record. (Another "user" means another open filenum if the
file is not audited, or another TRANSID if the file is audited.)
NOTE: For non-audited files, a deadlock condition—a permanent suspension of your
application—occurs if FILE_READ64_ or FILE_READUPDATE64_ is called by the process which
has a record locked by a filenum other than that supplied to FILE_READ64_ or
FILE_READUPDATE64_. (For an explanation of multiple opens by the same process, see the
FILE_OPEN_ procedure.)
Selecting the locking mode with FILE_SETMODENOWAIT64_
The locking mode is specified by the FILE_SETMODENOWAIT64_ procedure with function
= 4.
A count of the locks in effect is not maintained. Multiple locks can be unlocked with one call
to FILE_UNLOCKREC64_. For example:
ERROR := FILE_LOCKREC64_ ( file^a,... ); ! locks the current record
! in "file^a."
ERROR := FILE_LOCKREC64_ ( file^a,... ); ! has no effect since the
! current record is already
! locked.
ERROR := FILE_UNLOCKREC64_ (file^a,...); ! unlocks the current record
! in "file^a."
ERROR := FILE_UNLOCKREC64_ (file^a,...); ! has no effect since the
! current record is not
! locked.
Structured files
Calling FILE_LOCKREC64_ after positioning on a nonunique key
If the call to FILE_LOCKREC64_ immediately follows a call to FILE_SETKEY_ (or
KEYPOSITION[X]) where a nonunique alternate key is specified, the FILE_LOCKREC64_
fails with error 46 (invalid key). However, if an intermediate call to FILE_READ64_ is
performed, the call to FILE_LOCKREC64_ is permitted because a unique record is
identified.
Current-state indicators after FILE_LOCKREC64_
After a successful FILE_LOCKREC64_, current-state indicators are unchanged.
Unstructured files
Locking the RBA in an unstructured file
Record positions in an unstructured file are represented by an RBA, and the RBA can be
locked with FILE_LOCKREC64_. To lock a position in an unstructured file, first call
FILE_SETPOSITION_ (or POSITION) with the desired RBA, and then call FILE_LOCKREC64_.
This locks the RBA; any other process attempting to access the file with exactly the same
RBA encounters a "record is locked condition." You can access that RBA by positioning
FILE_LOCKREC64_ Procedure 455