COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

Usage Considerations:
Definition of Correspondence
Groups of data correspond if they have the same names and qualifier names, beyond the
group-names in the SUBTRACT statement, and if they meet restraints explained under
CORRESPONDING Phrase (page 243).
Problem Inherent in Using SUBTRACT CORRESPONDING
The SUBTRACT CORRESPONDING statement can save keystrokes, but can cause problems
when someone adds a name to a data structure: the name might be included in an unintended
subtraction operation.
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:
Unsuccessful UNLOCKFILE OperationI-O Status Code
The unlock operation failed due to non-COBOL causes. The file might or might not now be
unlocked.
“30”
The file was not open.“42”
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.
In Example 138, the UNLOCKFILE statement precedes a CLOSE statement to unlock the file before
the process closes it.
472 Procedure Division Verbs