In this example, an alternate index is defined. An example for
DEFINE CLUSTER illustrates the definition of the alternate index's
base cluster, EXAMPLE.KSDS2. A subsequent example illustrates the
definition of a path, EXAMPLE.PATH, that lets you process the base
cluster's data records using the alternate key to locate them. The
alternate index, path, and base cluster are defined in the same catalog,
USERCAT.
//DEFAIX1 JOB ...
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=A
//SYSIN DD *
DEFINE ALTERNATEINDEX -
(NAME(EXAMPLE.AIX) -
RELATE(EXAMPLE.KSDS2) -
KEYS(3 0) -
RECORDSIZE(40 50) -
VOLUMES(VSER01) -
CYLINDERS(3 1) -
NONUNIQUEKEY -
UPGRADE) -
CATALOG(USERCAT)
/*
The DEFINE ALTERNATEINDEX command creates an alternate index entry,
a data entry, and an index entry to define the alternate index EXAMPLE.AIX.
The DEFINE ALTERNATEINDEX command also obtains space for the alternate
index from one of the VSAM data spaces on volume VSER01, and allocates
three cylinders for the alternate index's use. The parameters are:
- NAME indicates that the alternate index's name is EXAMPLE.AIX.
- RELATE identifies the alternate index's base cluster, EXAMPLE.KSDS2.
- KEYS identifies 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.
- VOLUMES indicates that the alternate index is to reside on volume
VSER01. This example assumes that the volume is already cataloged
in the user catalog, USERCAT.
- CYLINDERS allocates three cylinders for the alternate index's
space. The alternate index is extended in increments of one cylinder.
- NONUNIQUEKEY specifies that the alternate key value might be the
same for two or more data records in the base cluster.
- UPGRADE specifies that the alternate index is opened by VSAM and
upgraded each time the base cluster is opened for processing.
- CATALOG defines the alternate index in the user catalog, USERCAT.