Usage Considerations
- The sequencing of alternate keys is the same as the primary key. If the
primary key spans multiple DDS key fields in the file, the alternate key sequence
is determined by the first primary key field. If permanent alternate indexes
are used, the key sequence of the logical file must also be the same as the
physical file. That is, if the DDS keyword DESCEND is specified in the physical
file DDS, it must also be specified in the logical file DDS. Otherwise, ILE COBOL will
not be able to find the permanent alternate index.
- Files with alternate keys cannot have a primary record key that is externally
defined.
- The maximum number of alternate keys allowed per file is 253.
- Blocking is implicitly disabled for files with alternate keys.
- Parameter values specified on an override command, other than TOFILE,
MBR, LVLCHK, WAITRCD, SEQONLY, and INHWRT are ignored when ILE COBOL builds an
alternate index.
- In order to use alternate record keys, the database file must meet the
following requirements. Otherwise, the OPEN operation will fail and the file
status will be set to 39.
- The field(s) in the database file that is to be used as an alternate
key must be an input, output, or both input/output field.
- The database file cannot be a Distributed Data Management (DDM) file.
- The database file must not share an open data path.
- The DUPLICATES clause specified for each key in the program must match
the duplicates attribute of the database file. This includes the primary key.
If you are using permanent alternate indexes, the DDS keyword UNIQUE is use
to specify unique keys. The absence of this keyword implies that the file
allows duplicate keys. If you are using temporary alternate indexes and the
DUPLICATES clause is not specified, you must ensure that existing records
in the database file do not have duplicate values in the fields that are defined
as keys in the program.
- The following will cause an OPEN operation to fail with the file status
set to 90.
- ILE COBOL will open one additional file for each alternate key. These files
are opened with open identifiers that begin with "QARK". Open identifiers
must be unique within the activation group that the program is running in.
The OPEN operation will fail if ILE COBOL detects a non-unique open identifier.
This may be possible if you use the OPNDBF and/or OPNQRYF commands along with
your ILE COBOL program and specify open identifiers that begin with "QARK".
- If the CRTARKIDX option is not specified, and a permanent index cannot
be found by ILE COBOL, the OPEN operation will fail.
- The maximum number of contiguous DDS fields that can be used to form an
alternate key is 156. If this limit is exceeded, the OPEN operation will fail.