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

Example 265 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.
...
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.
If your HP COBOL program must read a FUP-created multitape file, try this:
1. In the SELECT clause of the file-control entry, declare the file to be OPTIONAL.
2. Have the program close and reopen the file when it detects EOF.
3. Have the operator mount the next tape. When the program detects EOF immediately after an
OPEN statement, the last reel has been read.
4. When all tapes have been read, have the operator respond NO to the tape mount message
to signal the actual end of the file.
Labeled Tape Files
A labeled tape file is a tape file that has standard ANSI or IBM labels. If a tape file has labels of
any other type, an HP COBOL program must bypass them, handling the tape file as unlabeled.
Labeled-tape processing on NonStop systems involves these software elements:
ANSI or IBM standard tape labels (which catalog tape files)
HP COBOL statements and clauses that describe labeled tape files and operate on them
The TACL command DEFINE (which associates the COBOL file name of a labeled tape file
with its system file name and defines its attributes)
Tape processes (which control tape drives)
$ZSVR, the operating environment server for tape processes
MEDIACOM utility
File-system procedures and functions that support labeled-tape processing
842 Tape Input and Output