Guardian Procedure Calls Reference Manual

Parameters
filenum
input
INT:value
is the number of an open file that identifies the file containing the record to be unlocked.
tag
input
INT(32):value
is for nowait I/O only. tag is optional and the value you define uniquely identifies the operation
associated with this UNLOCKREC.
NOTE: The system stores this tag value until the I/O operation completes. The system then returns
the tag information to the program in the tag parameter of the call to AWAITIO[X], thus indicating
that the operation completed.
Condition Code Settings
indicates that an error occurred (call FILE_GETINFO_ or FILEINFO).< (CCL)
indicates that the UNLOCKFILE was successful.= (CCE)
indicates that the file is not a disk file.> (CCG)
Considerations
File-opened nowait and UNLOCKREC
The UNLOCKREC procedure must complete with a corresponding call to the AWAITIO[X]
procedure when used with a file that is opened nowait.
Queuing processes and UNLOCKREC
If any users are queued in the locking queue for the record, the user at the head of the locking
queue is granted access and is removed from the queue (the next read or lock request moves
to the head of the queue).
If the user granted access is waiting to lock the record, it is granted the lock (which excludes
other process from accessing the record) and resumes processing.
If the user granted access is waiting to read the record, its read is processed.
Calling UNLOCKREC after KEYPOSITION
If the call to UNLOCKREC immediately follows a call to KEYPOSITION where a nonunique
alternate key is specified, the UNLOCKREC fails. A subsequent call to FILE_GETINFO_ or
FILEINFO shows that error 46 (invalid key) occurred. However, if an intermediate call to READ
or READLOCK is performed, the call to UNLOCKREC is permitted.
Unlocking several records
If several records need to be unlocked, the UNLOCKFILE procedure can be called to unlock
all records currently locked by the user (rather than unlocking the records through individual
calls to UNLOCKREC).
Current-state indicators after UNLOCKREC
For key-sequenced, relative, and entry-sequenced files, the current-state indicators after an
UNLOCKREC remain unchanged.
UNLOCKREC Procedure 1437