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

file-name
is the name of the sequential file to be closed.
When more than one file-name appears, the files can have different organization and
access modes and the optional phrases following one file-name are independent of those
following any other file-name.
file-info
UNIT
REEL
specify that the current reel is to be closed and rewound, and a new reel is to be mounted.
REMOVAL
specifies that the reel of a multiple-reel tape file be rewound and unloaded, and a new
reel is to be mounted.
NO REWIND
specifies that the sequential file is to be left in its current position, not rewound.
LOCK
means the file associated with file-name cannot be opened again during the current
run. If the file is dynamically assignable, the LOCK phrase has no effect (see #DYNAMIC
(page 835)).
Usage Considerations:
Effects of CLOSE
For each file-name in the CLOSE statement, the run-time routines perform an appropriate
close operation. These close operations occur as if separate CLOSE statements were executed
for each file-name in the order listed. Subsequent usage considerations describe actions
taken during the close operation for one file.
File-Status Data Item
If the file being closed has an associated file-status data item, the CLOSE statement assigns it
an appropriate I-O status code. The possible I-O status codes and their meanings are:
MeaningI-O Status Code
The close operation completed successfully.“00”
The close operation completed successfully, but the CLOSE statement included a NO
REWIND, REEL, UNIT, or REMOVAL phrase and the designated file does not reside on
a reel or unit medium.
“07”
The close operation failed due to causes outside of COBOL. The file is not closed. If the
operation was a reel close, the reel might not have been closed properly.
“30”
The program attempted to close a file that was not open.“42”
Failure of a close operation can terminate the run unit. When a run unit terminates for any
reason (normal or abnormal), the run-time routines implicitly close any open files as if they
were specified in a CLOSE statement without optional phrases.
CLOSE 305