IAM Alternate Index support
The IAM Alternate Index
An alternate index provides an additional index to an indexed type of data set (KSDS), or an index to an entry sequence data set (ESDS). Users can define one or more alternate indexes to any base data set. The alternate index data set itself is an IAM KSDS data set that is indexed by the alternate key. The records in the alternate index contain some control information, the alternate key, and the primary key value for the record in the base data set with the corresponding alternate key. An alternate index is defined as containing UNIQUE keys when there is only one base record with any specific alternate key. Alternate indexes can also be defined as containing NONUNIQUE keys, where any particular alternate key can be contained in multiple base records. As with VSAM, the alternate index data set can be explicitly processed by programs without ending the base cluster or can be used to access the records in the base cluster. To use an alternate index data set to access the records in the base cluster, a PATH must be defined.
An additional attribute of alternate index data sets is whether they are upgradeable. When an alternate index is defined with the UPGRADE attribute, IAM will automatically update the alternate index either when updates are made to the base cluster, through the primary key or when accessed through an alternate key. Any alternate index defined with the NOUPGRADE attribute will not be automatically updated by IAM, and it is the application programs responsibility to ensure that the alternate index is updated in a manner to remain synchronized with the base data set.
The IAM path
A Path provides the mechanism to access a base cluster through an alternate index. When a path is defined, one must provide the name of the path and the name of the related alternate index to be used to access the base cluster, or the base cluster to be processed whenever the path itself is referenced. The UPDATE or NOUPDATE attribute is specified for each path defined. When a path is defined with the NOUPDATE attribute, any upgradeable alternate indexes will not be updated automatically when this path is used to access a base cluster either directly or through an alternate index.
For VSAM data sets, a PATH is only a catalog entry that is quite similar to an ALIAS entry. With IAM, a PATH will become a one-track data set containing the name of the related alternate index or base cluster and the UPDATE or NOUPDATE attribute of the PATH. A single-track data set was chosen instead of an ALIAS type of catalog entry because of concerns about there not being adequate data set management utility program support for ALIAS entries, which might result in the loss of the entry.
Using an IAM Alternate Index
The procedure for defining and using IAM data sets with alternate indexes is identical to the VSAM process. The only difference is to specify on the DEFINE that the base cluster is to be an IAM data set. This specification is typically done by either adding the OWNER($IAM) parameter to the define parameters, changing the name to include the $IAM literal, or using a DATACLAS or STORCLAS with $IAM in the class name. Most applications that are going to be using IAM for their alternate index already have the general procedures established. To convert to IAM, the only change needed is on the define step of the base cluster. An overview of the process for using IAM alternate indexes is described below.
- Defining the base cluster in Defining IAM Files
- Loading the base cluster with data in Loading IAM Datasets
- Defining the alternate index(es) in Defining an IAM Alternate Index
- Building the alternate index(es) typically done with IDCAMS BLDINDEX command in Building an IAM Alternate Index
- Defining paths to the alternate index(es) and if used, paths to the base cluster in Defining an IAM Path
- Using paths to access data in Accessing Data Through an IAM Alternate Index
- Special Considerations with IAM Alternate Indexes in Special Considerations with IAM Alternate Indexes
In general, there are no JCL changes required when using IAM Alternate Indexes and Paths. To access a base cluster through an alternate index, simply specify the name of the Path on the DD statement, just as is done with VSAM. When the Path is opened, IAM will dynamically allocate and open all of the required alternate indexes and the associated base cluster using the relation information stored within the IAM file structure. When the Path is closed, IAM will close and de-allocate all of the alternate indexes and the base cluster that were allocated during the open process.
IAM alternate indexes and paths do not automatically group together in a sphere with their associated base cluster, as done by many data set management utility programs because they are non-VSAM data sets. Some changes to your data set management procedures may be necessary when using IAM Alternate Indexes. After renaming a component of an IAM sphere or performing a restore or copy to a new name, a define recatalog may be necessary. IAM will attempt to automatically perform the define recatalog when an IAM AIX is opened when the identical name change was made to each of the components, that is base cluster, alternate index, and paths.