COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs522555-006
9-39
CLOSE for Sequential and Line Sequential Files
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.
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:
Table 9-1. CLOSE Statements for Sequential Tape File
CLOSE Statement Single Reel Multiple Reel
CLOSE See note 5 See notes 1 & 5
CLOSE NO REWIND See note 2 See notes 1 & 2
CLOSE LOCK See note 3 See notes 1 & 3
CLOSE REEL See note
* See notes 4 & 5
CLOSE REEL FOR REMOVAL See note
* See notes 3, 4, & 5
CLOSE REEL NO REWIND See note
* See notes 2 & 4
1. OTHER REELS UNAFFECTED If more reels remain in the file, they are not processed.
2. NO REWIND The reel is left in its current position.
3. REEL REMOVAL The current reel is rewound and unloaded.
4. REEL SWAP 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, 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.
5. REEL REWOUND The reel is 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.