COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
alt-key
is an alphanumeric or unsigned numeric data item declared in the record description entry
of the file. It is used to access records within the file. Its size and location must agree with
the size and location of the alternate key within the file, defined when the alternate key file
was established by the Guardian environment File Utility Program (FUP). (For information
about FUP, see the File Utility Program (FUP) Reference Manual.)
DUPLICATES
means that alternate key values are not necessarily unique.
FILE STATUS clause
defines filestat as the file-status data item for the file. When a COBOL run-time I-O routine
completes an operation on the file, it stores the status code in filestat before returning
control to your program (see I-O Status Code (page 247)).
filestat
is a 2-character alphanumeric, nonnational data item defined in the Working-Storage
Section, Extended-Storage Section, or Linkage Section.
Usage Considerations:
• Relative Key
Every record in a relative file is uniquely identified by a positive integer called the relative
record number. Each record’s number defines its logical position in the file. The first logical
record has a relative number of 1, the second logical record has a relative number of 2, and
so on. A file is not required to contain records in every logical position; record 3 can exist
even when record 2 is missing.
NOTE: COBOL record numbers begin at 1. This is different from the Guardian file-system
convention of beginning record numbers at 0. The COBOL run-time I-O routines deduct 1 from
the COBOL relative record number to obtain the Guardian file-system record number. When
a COBOL program requests record 1, it receives the first record in the file—the record that
the Guardian file system designates 0. Remember this difference if other HP products are to
operate on a file.
• Alternate Record Keys
The records within the file can be accessed in ascending order of the alt-key value. The
order in which records are obtained using alt-key can differ from the order obtained using
rel-key. You can define up to 31 alternate keys for a file.
If you include the DUPLICATES phrase in the ALTERNATE RECORD KEY clause, the value of
alt-key need not be unique for each record in the file. Depending on the INSERTIONORDER
parameter of the alternate key file, records with duplicate alternate key values are inserted
(or retrieved) in either prime key order or in the order in which they were inserted in the file.
The data description entry for alt-key cannot contain an OCCURS clause or be subordinate
to an entry that contains an OCCURS clause. The leftmost character position of an alt-key
item cannot correspond to the leftmost character position of another alt-key item in that
file.
The file-control entry can contain at most one ALTERNATE RECORD KEY clause that describes
a particular alternate record key of the file.
130 Environment Division










