Open System Services System Calls Reference Manual (G06.29+, H06.08+, J06.03+)
PUT_LOCKREC(2) OSS System Calls Reference Manual
Attempting to read a locked record in default locking mode
If the default locking mode is in effect when PUT_READX() or
PUT_READUPDATEX() is called for a record that is locked by another user,
the caller to PUT_READX() or PUT_READUPDATEX() 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.)
For nonaudited files, a deadlock condition (a permanent suspension of your
application) occurs if PUT_READX() or PUT_READUPDATEX( ) is called
by the process that has a record locked with a file number other than that sup-
plied in the PUT_READX() or PUT_READUPDATEX( ) call. For an explana-
tion of multiple opens by the same process, see the PUT_FILE_OPEN_(2)
reference page either online or in the Open System Services System Calls Refer-
ence Manual.
Selecting the locking mode with PUT_SETMODE()
The locking mode is specified by the calling SETMODE procedure with function
4.
A count of the locks in effect is not maintained. Multiple locks can be unlocked
with one call to PUT_UNLOCKFILE().
Structured files
Calling LOCKREC after positioning on a nonunique key
If the call to PUT_LOCKREC() immediately follows a call to
KEYPOSITION where a nonunique alternate key is specified,
the call to PUT_LOCKREC() fails. A subsequent call to the
Guardian FILE_GETINFO_ or FILEINFO procedure shows that
a Guardian file-system error 46 (invalid key) occurred.
However, if an intermediate call to PUT_READX() is per-
formed, the call to PUT_LOCKREC() is permitted because a
unique record is identified.
Current-state indicators after PUT_LOCKREC( )
After a successful call to PUT_LOCKREC(), current-state
indicators are unchanged.
Unstructured files
Locking the relative byte address (RBA) in an unstructured file
Record positions in an unstructured file are represented by an
RBA, and the RBA can be locked with PUT_LOCKREC( ).To
lock a position in an unstructured file, first call the Guardian
POSITION procedure with the desired RBA, and then call
PUT_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 Guardian file-system
error 73 (record is locked) or is placed in the locking
queue.
5−230 Hewlett-Packard Company 527186-023