Create an Alternate Index

An Alternate Index permits access to the Data Table using a different key, organization and/or search method than those originally defined in the physical table attributes. Using this feature, many different indexes on the Data Table can be created. Since there is a single copy of the Data Table, any Views based on Alternate Indexes reflect any changes made to the Data Table. Conversely, changes made in an Alternate Index are also made in the Data Table.

To edit or browse a table using an Alternate Index:

  1. Create a View in the Define Table and View menu (see Table Defining Options)
    Copy and modify an existing View (see Copy View).

  2. Define the fields of Alternate Index View (select the key(s), edit the display order, and other fields as appropriate as you would to define any View).
  3. Select Option 6 – CREATE ALTERNATE from the Define Table and View menu.
To create an Alternate Index for a table, the Data Table must have been defined as a pointer table.
On the Create an Alternate Index screen (see Figure 141), enter the name of the library where the Alternate Index for the table will be stored, the name to be assigned to the Alternate Index, and the name of the table to which the Alternate Index applies. Next, specify an Index Organization, Search Method, Key Location and Key Length. To complete the creation of the Alternate Index, press <PF2>. A new Alternate Index and an Alternate Index View have now been created.

Figure 141. Create Alternate Index Screen
Create Alternate Index Screen

The key location and key size of the Alternate Index View can be obtained by selecting Option 2 – DEFINE VIEW SUPPLMT from the Define Table and View menu and copying the values from the View Key Location and View Key Size fields.