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

Procedure Division Verbs
HP COBOL Manual for TNS/E Programs520347-003
9-36
CLOSE for Sequential and Line Sequential Files
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:
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.
Closing Single-Tape and Multiple-Tape Files
See Table 9-1.
Closing a File Open Under More Than One Name
If a program has one operating system file open under more than one file name,
closing one file name does not affect the availability of the operating system file
through any other file name, except when the LOCK phrase is present. The LOCK
phrase applies to all file names that the program has assigned to the operating
system file except those assigned dynamically with the COBOLASSIGN,
COBOL_ASSIGN_, or COBOL_ASSIGN_OSS_ routine.
I-O Status Code Meaning
“00” The close operation completed successfully.
“07” 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.
“30” 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.
“42 The program attempted to close a file that was not open.