COBOL Manual for TNS and TNS/R Programs
Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-269
UNLOCKFILE
UNLOCKFILE
UNLOCKFILE restores access to any records in a file previously locked with
LOCKFILE or to those records locked with a LOCK phrase on previous READ
statements. Other processes can then read or write records, depending on the file’s
open mode.
file-name
is the file description name of a file.
Usage Considerations:
•
Action of the UNLOCKFILE Statement
A successful UNLOCKFILE statement releases the exclusive file-access guarantee
obtained by a previously executed LOCKFILE statement specifying the same
file-name. It also releases all exclusive record-access guarantees for that file
obtained by previously executed READ LOCK statements. If the file is not locked,
or no records of the file are locked, no error occurs.
•
File-Status Data Item
If file-name has an associated file-status data item, execution of the
UNLOCKFILE statement always assigns an appropriate I-O status code as its
value. The status code “00” reports a successful UNLOCKFILE operation.
Whenever the statement terminates with an I-O status code greater than or equal
to “30,” execution of the UNLOCKRECORD failed. The possible I-O status codes
for an unsuccessful UNLOCKFILE operation are:
•
Disk Files Only
The UNLOCKFILE statement has no effect unless the file specified is a disk file.
•
Key of Reference, File Position Indicator, and Record Area
The key of reference, the file position indicator, and the record area are not
affected by the execution of an UNLOCKFILE statement, whether it succeeded or
not.
I-O Status Code Unsuccessful UNLOCKFILE Operation
“30” The unlock operation failed due to non-COBOL causes. The file
might or might not now be unlocked.
“42” The file was not open.
UNLOCKFILE file-name
VST230.vsd