COBOL Manual for TNS and TNS/R Programs
Tape Input and Output
HP COBOL Manual for TNS and TNS/R Programs—522555-006
27-11
Labeled Tape Files
The system label-processing software checks that the DEFINE attributes are
consistent with the tape label specifications; if they are not, the operating environment
issues an open error.
If the tape label and the data on the tape are inconsistent (for example, if the tape label
specifies fixed-length records but the tape contains variable-length records), results are
unpredictable.
Converting HP COBOL Programs to Use Labeled Tape Files
To convert an HP COBOL program to use a labeled tape file, set up an OBEY
command file that:
1. Assigns the file-name in the file description entry to a DEFINE name
2. Enables the creation of DEFINEs
3. Deletes any existing DEFINE that has the name selected in Step 1
4. Creates the DEFINE
5. Runs the program
6. Clears the assignment (from Step 1) and the DEFINE (from Step 4) to prevent their
affecting other processes created by the same TACL process
In Example 27-5, the commands in the OBEY command file commands convert the
HP COBOL program to use a labeled tape file. The file-name in the file description
entry is MONTHLY-SALES, the DEFINE name is =SALES^JAN86, and the program
name is QUOTAS.
The DEFINE in Example 27-5 is for a tape file with ANSI standard labels and fixed-
length records 80 characters long. Because the file description entry contains the
clause LABEL RECORDS ARE OMITTED, the HP COBOL run-time library sets the file
status code, STATUS-KEY, to “97.” If the program does not contain code that takes
specific action when STATUS-KEY is “97.” the program can use a labeled tape file
without changes to the source code or recompilation.
Example 27-5. Converting a COBOL95 Program to Use Labeled Tape
Files (page 1 of 2)
HP COBOL file-control entry:
SELECT MONTHLY-SALES ASSIGN TO $TAPE2
ORGANIZATION SEQUENTIAL
ACCESS MODE SEQUENTIAL
FILE STATUS IS STATUS-KEY.
...
HP COBOL file description entry for a tape file:
FD MONTHLY-SALES
RECORD CONTAINS 80 CHARACTERS
LABEL RECORDS ARE OMITTED.