Guardian Procedure Calls Reference Manual (G06.25+)
Guardian Procedure Calls (L)
Guardian Procedure Calls Reference Manual—522629-013
8-23
LOCKREC Procedure
! current record is not
! locked.
•
Structured files
•
Calling LOCKREC after positioning on a nonunique key
If the call to LOCKREC immediately follows a call to KEYPOSITION where a
nonunique alternate key is specified, the LOCKREC fails. A subsequent call to
FILE_GETINFO_ or FILEINFO shows that an error 46 (invalid key) occurred.
However, if an intermediate call to READ is performed, the call to LOCKREC is
permitted because a unique record is identified.
•
Current-state indicators after LOCKREC
After a successful LOCKREC, 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 LOCKREC. To lock a position in an unstructured file,
first call POSITION with the desired RBA, and then call LOCKREC. 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 to RBA-2. Depending on the process’s locking mode, the call either
fails with file-system error 73 (“record is locked”) or is placed in the locking
queue.
•
Record pointers after LOCKREC
After a call to LOCKREC, the current-record, next-record, and end-of-file
pointers remain unchanged.
•
Ways to avoid or resolve deadlocks
One way to avoid deadlock is to use one of the alternate locking modes that can
be established by
function 4 of the SETMODE procedure. A common method
of avoiding deadlock situations is to lock records in some predetermined order.
Deadlocks can be resolved if you lock records using a nowait open and call
AWAITIO with a timeout specified.
OSS Considerations
This procedure operates only on Guardian objects. If an OSS file is specified, error 2
occurs.
Related Programming Manual
For programming information about the LOCKREC file-procedure, refer to the Enscribe
Programmer’s Guide and the Guardian Programmer’s Guide.