Summary -

In this topic, we described about the below sections -

Based on the needs, the same records in VSAM dataset needs to be retrieved in other ways. The above one will be satisfied with Alternate key solution.

Alternate key is the key which is used to retrieve the records from the dataset but not the primary key. In other words, secondary key created on the dataset called as alternate key which is not primary key.

Alternate keys are just like the primary key in a KSDS. VSAM allows KSDS and ESDS (but not RRDS or extended ESDS) data sets to have alternate keys.

Alternate Key should be defined when the dataset created and the index built for the Alternate key is called as Alternate index. An Alternate Index AIX provides a view of data different from the one offered by the primary key.

Alternate Indexes may crate/define on one or more Alternate Key(s) of the dataset.Alternate Index will also reduces redundancy and no need to keep a separate dataset for different views

The records will be easily updated automatically when the base cluster is updated. Alternate Indexes do not support a reusable base cluster. So NOREUSE which is the default should be specified.


Many Alternate Indexes built on a KSDS may lead to reduce the performance as access by alternate key requires twice as many I/O’s.

VSAM first searches in the primary key from the alternate index and then the Control Interval information. Alternate index building can be done in three steps.

  1. Define Alternate index
  2. Define path
  3. Build index

Define Alternate index:

Syntax -


Define Alternate index can be explained in detail here .

Define path:

Alternate Index requires the path in between Alternate index and base cluster for the faster access of the data from the dataset. So path needs to be defined before building the index for alternate index.

IDCAMS DEFINE PATH command used to define an Alternate Index Path. Define path can be explained in detail here .

Build index:

The last step is build index for the alternate index. The build index step will build index for the alternate key by verifying the records with primary index and creates the corresponding alternate index for each primary index.

In other words, Build index performs the load operation after the alternate index defined. Build index can be explained in detail here .