In this example, an SMS-managed alternate index is defined. Data
class is not used, and explicitly defined attributes override any
attributes in the default data class.
//DEFAIX JOB ...
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
DEFINE ALTERNATEINDEX -
(NAME(EXMP2.AIX) -
RELATE(EXAMPLE.SMS2) -
KEYS(3 0) -
RECORDSIZE(40 50) -
KILOBYTES(1600 200) -
NONUNIQUEKEY -
UPGRADE)
/*
The DEFINE ALTERNATEINDEX command creates an alternate index entry,
a data entry, and an index entry to define the alternate index EXMP2.AIX.
The command's parameters are:
- NAME indicates that the alternate index's name is EXMP2.AIX.
- RELATE identifies the alternate index base cluster,
EXAMPLE.SMS2. Because an SMS-managed alternate index is being defined,
the base cluster must also be SMS-managed.
- KEYS specifies the length and location of the alternate key field
in each of the base cluster's data records. The alternate key field
is the first three bytes of each data record.
- RECORDSIZE specifies that the alternate index's records are variable
length, with an average size of 40 bytes and a maximum size of 50
bytes.
- KILOBYTES allocates the minimum number of tracks required to contain
1600 kilobytes for the alternate index's space. When the alternate
index is extended, it is to be extended by the minimum number of tracks
required to contain 200 kilobytes.
- NONUNIQUEKEY means the alternate key value might be the same for
two or more data records in the base cluster.
- UPGRADE opens the alternate index by VSAM and upgrades it each
time the base cluster is opened for processing.