Guardian Procedure Calls Reference Manual (G06.25+)

Guardian Procedure Calls (L)
Guardian Procedure Calls Reference Manual522629-013
8-12
LOCKFILE Procedure
Syntax for TAL Programmers
Parameters
filenum input
INT:value
is the number of an open file that identifies the file to be locked.
tag input
INT(32):value
is for nowait I/O only.
tag is a value you define that uniquely identifies the
operation associated with this LOCKFILE.
Condition Code Settings
< (CCL) indicates that an error occurred (call FILE_GETINFO_ or FILEINFO).
= (CCE) indicates that the LOCKFILE was successful.
> (CCG) indicates that the file is not a disk file.
Considerations
Nowait and LOCKFILE
If the LOCKFILE procedure is used to initiate an operation with a file opened
nowait, it must complete with a corresponding call to the AWAITIO procedure.
Locking modes
Default mode
If the file is already locked by another user when LOCKFILE is called, the
process requesting the lock is suspended and queued in a “locking” queue
behind other users trying to access the file. When the file becomes unlocked,
the user at the head of the locking queue is granted access to the file. If the
user at the head of the locking queue is requesting a lock, it is granted the lock
and resumes execution. If the user at the head of the locking queue is
requesting a read, the read operation continues to completion.
CALL LOCKFILE ( filenum ! i
,[ tag ] ); ! i
Note. The system stores the 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, thus
indicating that the operation completed.