COBOL Manual for TNS and TNS/R Programs
Tape Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
27-7
Unlabeled Tape Files
Example 27-3 assigns the COBOL file name HUGEFILE to the system file name 
$DRIVE2 (a name that the system administrator assigned to a tape drive) and declares 
its organization and access modes to be sequential. The first tape is on the tape drive 
$DRIVE2. The program opens HUGEFILE for exclusive input, reads it, and closes it, 
rewinding it for removal. You replace the first tape with the second tape, and the 
program reads it and closes it, rewinding it for removal. You replace the second tape 
with the third tape, and the program reads, closes and locks it, having now read the 
entire file.
Avoid having an HP COBOL program read a multitape file that was created by a File 
Utility Program (FUP). HP COBOL and FUP mark the ends of nonfinal reels of a 
multiple-reel tape file differently: an HP COBOL program writes an end-of-file (EOF) 
mark, a trash record, and a pair of consecutive EOF marks; a FUP writes only a pair of 
consecutive EOF marks.
Example 27-3. Multitape File
...
 ENVIRONMENT DIVISION.
...
 INPUT-OUTPUT SECTION.
...
 FILE-CONTROL
 SELECT HUGEFILE ASSIGN $DRIVE2
 ORGANIZATION SEQUENTIAL
 ACCESS MODE SEQUENTIAL.
...
 PROCEDURE DIVISION.
...
 OPEN INPUT HUGEFILE EXCLUSIVE.
*READ FIRST TAPE
 READ HUGEFILE...
 CLOSE HUGEFILE REEL FOR REMOVAL.
*READ SECOND TAPE
 READ HUGEFILE...
 CLOSE HUGEFILE REEL FOR REMOVAL.
*READ THIRD TAPE
 READ HUGEFILE...
 CLOSE HUGEFILE LOCK.
...










