COBOL Manual for TNS/E Programs (H06.08+, J06.03+)
1985 ISO/ANSI COBOL standard specifies insertion order, but HP COBOL provides a mechanism
to enable you to choose either order.
Each such file has an INSERTIONORDER attribute that governs this behavior for all its alternate
keys. An insertion-ordered alternate key cannot share an alternate key file with other keys of
different lengths, or with other alternate keys that are not insertion ordered. The attribute can be
changed only by using either a call to the operating system routine SET or by use of the File Utility
Program (FUP), not by any COBOL language phrase or clause. In FUP, the BUILDKEYRECORDS
and LOADALTFILE commands do not support loading of insertion-ordered alternate key records.
There are size and performance penalties for using insertion-ordered duplicate alternate keys; the
size of the alternate file increases and the access time increases as the number of records having
duplicate alternate keys increases. For more information see the File Utility Program (FUP) Reference
Manual or the Guardian Procedure Calls Reference Manual.
The data description of each altkey, its relative location within the file record, and the specification
of the DUPLICATES attribute must correlate with one of the alternate record keys defined when the
file was created. The file-control entry can contain at most one ALTERNATE RECORD KEY clause
that describes a particular alternate record key of the file. If an alternate record key is not referenced
in the source program Procedure Division, then it is not necessary to describe it in the file-control
entry. A maximum of 31 alternate record keys can be described for a single file.
No altkey can reference an item whose leftmost character position within the file record
corresponds to the leftmost character position of the item referenced by any other altkey
associated with this file.
File-Control Entries for Sequential Files
HP COBOL supports two types of sequential disk files:
• A disk file created as a sequential file (also called an entry-sequenced file on NonStop systems)
• An unstructured disk file
Also, a COBOL file defined as sequential can be assigned to a tape file, to a device such as a
terminal or process, or to $RECEIVE. See OPEN (page 375) and RECEIVE-CONTROL Paragraph.
In HP COBOL, entry-sequenced disk files can have alternate record keys, whose values can identify
individual records. A file-control entry for a sequential file includes an ORGANIZATION
SEQUENTIAL clause or no ORGANIZATION clause (in which case the file has sequential
organization by default).
118 Environment Division










