Module 4: Alternate INDEX
Alternate INDEX - Overview
- Alternate indexes (AIXs) allows logical records of a KSDS or of an ESDS base cluster to be accessed sequentially and randomly by more than one key field.
- The Alternate Index enables one or more secondary index structures (other than the primary key) to be created for a VSAM object based on data in the records.
- This capability allows for a Key Sequenced dataset to be accessed in a different order other than the primary key and also allows the creation of an index for a non-indexed object, such as an Entry Sequenced cluster.
- Example, There is “Employee details” KSDS VSAM file, containing fields EMP-ID (Primary key), EMP-NAME, EMP-AGE, and EMP-SALARY. In this case we can access records sequentially or randomly using primary key field, but what if we want to retrieve data based on EMP-NAME. In this case we can create EMP-NAME as alternate index field which will allow us to access records randomly based on EMP-NAME too.
When Alternate INDEX required?
- KSDS file can be accessed using primary key field but we have requirement to access the file randomly with another key field too.
- To access ESDS file randomly based on some field.
In upcoming articles we have covered:
- Defining Alternate index
- Building Index
- Defining Path