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

ACCESS MODE SEQUENTIAL.
...
DATA DIVISION.
FILE SECTION.
FD SEQ-FILE
RECORD CONTAINS 30 CHARACTERS
01 SEQ-RECORD PIC X(30).
...
Consistency Checking of Labeled Tape Information
HP COBOL run-time routines check that the HP COBOL program specifications are consistent with
these DEFINE attributes:
LABELS
RECFORM
BLOCKLEN
RECLEN
FILESEQ
USE
If a program specification is inconsistent with an attribute, an HP COBOL run-time routine takes
one of these actions, depending on the attribute:
Allows the DEFINE attribute to override the program specifications
Issues an open error because of inconsistency
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 267, 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 267 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 267 Converting a COBOL95 Program to Use Labeled Tape Files
HP COBOL file-control entry:
SELECT MONTHLY-SALES ASSIGN TO $TAPE2
ORGANIZATION SEQUENTIAL
844 Tape Input and Output