Example: entries for alternate indexes

The following example maps the relationships between the COBOL FILE-CONTROL entry and the DD statements or environment variables for a VSAM indexed file that has two alternate indexes.

Using JCL:


//MAINA     DD   DSNAME=clustername,DISP=OLD      (1)
//MAINA1    DD   DSNAME=path1,DISP=OLD            (2)
//MAINA2    DD   DSNAME=path2,DISP=OLD            (3)

Using environment variables:


export MAINA=DSN(clustername),OLD                 (1)
export MAINA=DSN(path1),OLD                       (2)
export MAINA=DSN(path2),OLD                       (3)
. . . 
FILE-CONTROL. 
  SELECT MAIN-FILE ASSIGN TO MAINA              (4)
      RECORD KEY IS EM-NAME
      PASSWORD IS PW-BASE                           (5)
      ALTERNATE RECORD KEY IS EM-PHONE              (6)
          PASSWORD IS PW-PATH1 
      ALTERNATE RECORD KEY IS EM-CITY               (7)
          PASSWORD IS PW-PATH2.
(1)
The base cluster name is clustername.
(2)
The name of the first alternate index path is path1.
(3)
The name of the second alternate index path is path2.
(4)
The ddname or environment variable name for the base cluster is specified with the ASSIGN clause.
(5)
Passwords immediately follow their indexes.
(6)
The key EM-PHONE relates to the first alternate index.
(7)
The key EM-CITY relates to the second alternate index.

Related tasks  
Creating alternate indexes