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

Closing Single-Tape and Multiple-Tape Files
See Table 59.
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.
Table 59 CLOSE Statements for Sequential Tape File
Multiple ReelSingle ReelCLOSE Statement
See notes 1 & 5See note 5CLOSE
See notes 1 & 2See note 2CLOSE NO REWIND
See notes 1 & 3See note 3CLOSE LOCK
See notes 4 & 5See note *CLOSE REEL
See notes 3, 4, & 5See note *CLOSE REEL FOR REMOVAL
See notes 2 & 4See note *CLOSE REEL NO REWIND
If more reels remain in the file, they are not processed.1. OTHER REELS UNAFFECTED
The reel is left in its current position.2. NO REWIND
The current reel is rewound and unloaded.3. REEL REMOVAL
When proceeding to the next reel in a multiple-reel set, a message is written
to the home terminal and a read is done. If the reply is a carriage return,
4. REEL SWAP
the new reel is assumed to be on the same device; otherwise, the reply
must be a device name that has the next reel in the set.
The reel is rewound.5. REEL REWOUND
* If the program issues a CLOSE REEL of any form for a file that is open for INPUT, and the operator limits the
file to the current reel by responding “NO” to the reel swap prompt, the at-end condition occurs for that file.
When an operator responds “NO” for a file that is open for other than INPUT, the run-time routine rejects the
“NO” answer.
Closing Blocked Files
The close operation RVUs an incomplete block to the file if all of these conditions are true:
The file is declared with a BLOCK CONTAINS clause specifying more than one record
for each block.
The current block contains at least one record but is not yet filled.
The file’s open mode is OUTPUT or EXTEND.
If this RVU causes a boundary violation exception condition, the results are:
The block is not transmitted to the file.
The close operation terminates immediately, setting any file-status variable associated
with the file to 34 (for a sequential file) or 24 (for a relative or indexed file).
306 Procedure Division Verbs