COBOL Manual for TNS and TNS/R Programs

Tape Input and Output
HP COBOL Manual for TNS and TNS/R Programs522555-006
27-15
Adding DEFINEs for Tape Files
NATIVE-n
HP COBOL stores a NATIVE-n data item as a signed, numeric, twos-complement,
binary integer. A NATIVE-n data type is stored in n bytes:
Handling Variable-Length Records
Software for systems other than NonStop systems sometimes provides a mechanism
for writing variable-length blocked records on tape—usually a block-length field at the
beginning of each block and a record-length field at the beginning of each record. HP
software does not have a similar mechanism. If your HP COBOL program must read a
file tape that has variable-length blocked records and was not created on an HP
system, you must write HP COBOL or TAL code to deblock the records. It might be
easier to produce another tape with fixed-length records (blocked or not) on the system
on which the file was created.
Adding DEFINEs for Tape Files
If your HP COBOL program assigns a tape file to a DEFINE name (which is optional
for an unlabeled tape file, but required for a labeled tape file), then you must add that
DEFINE name before executing your program, or the program will not be able to open
the file.
The values of the DEFINE attributes must match corresponding values in the tape
label. The tape process compares corresponding values when the program tries to
open the tape file, and if any corresponding values do not match, the tape process
issues an error message, and the open operation fails (see Consistency Checking of
Labeled Tape Information).
These topics explain the attributes of DEFINEs for:
Unlabeled Tape Files
Labeled Tape Files
In the Guardian environment, you must enable the creation of DEFINEs with the TACL
command SET DEFMODE ON before you can add them. In the OSS environment, you
can add DEFINEs with the command add_define.
An HP COBOL program running in the OSS environment can assign a file to
“GUARDIAN tape-device” or “GUARDIAN define-name.” In the latter case, you must
use the add_define command to create a TAPE DEFINE before running the
program.
Data Type Storage
NATIVE-2 2 bytes
NATIVE-4 4 bytes
NATIVE-8 8 bytes