COBOL Manual for TNS and TNS/R Programs

Tape Input and Output
HP COBOL Manual for TNS and TNS/R Programs522555-006
27-12
Tape Files of Types Other Than HP
Tape Files of Types Other Than HP
If a system that is not an HP system creates a tape file, a HP COBOL program can still
read it, but might encounter features that are not HP features, such as:
Labels
Extended Binary Coded Decimal Interchange Code (EBCDIC)
Packed-decimal or floating-point binary data
Variable-length records
Labels are explained in Labeled Tape Files.
Topics:
EBCDIC Files
Converting Other Data Types to HP COBOL Data Types
Handling Variable-Length Records
EBCDIC Files
To read an EBCDIC file, an HP COBOL program must include a CODE-SET clause in
the file description entry. The CODE-SET clause causes translation between the native
USASCII character code convention and the EBCDIC code convention for all input-
output operations. For more information about the CODE-SET clause—including
restrictions—see CODE-SET Clause.
If you cannot include a CODE-SET clause in the file description entry for an EBCDIC
file, you must copy the EBCDIC file to an ASCII file with the File Utility Program (FUP)
COPY command. The ASCII file can be a tape file or an existing disk file. To create a
disk file, use the FUP CREATE command.
The FUP command in Example 27-6 copies the EBCDIC tape file on tape drive
$DRIVE1 to a tape file on tape drive $DRIVE2, converting it to ASCII in the process.
OBEY command file commands:
ASSIGN MONTHLY-SALES, =SALES^JAN86
SET DEFMODE ON
DELETE DEFINE =SALES^JAN86
ADD DEFINE =SALES^JAN86, CLASS TAPE, LABELS ANSI,&
VOLUME SLS1Q86, RECFORM F, RECLEN 80,&
BLOCKLEN 4000
RUN QUOTAS
CLEAR ASSIGN MONTHLY-SALES
DELETE DEFINE =SALES^JAN86
Example 27-5. Converting a COBOL95 Program to Use Labeled Tape
Files (page 2 of 2)