Saturday, December 17, 2011

VSAM: Rules for coding DD name for an alternate index (AIX)

The DD NAME for each alternate index path is formed by concatenating the base cluster DD name with an integer, beginning with 1 for the path associated with the first alternate index and incrementing by 1 for the path associated with each successive alternate index.

If the length of the base cluster DD name is already eight characters, then the DD name for the alternate indexes are formed by truncating the base cluster portion of the DD name on the right to reduce the concatenated result to eight characters.

Lets we have a KSDS file and it has three alternate indexes defined on it.

Case 1

Lets say the program uses only AIX3-KEY to process the file even though the AIX1-KEY and AIX2-KEY are specified on the SELECT statement.

SELECT I-FILE
   ASSIGN TO IXFILE
   ORGANIZATION IS INDEXED
   ACCESS IS DYNAMIC
   RECORD KEY IS EMP-KEY
   ALTERNATE RECORD AIX1-KEY AIX2-KEY AIX3-KEY
   FILE STATUS IS FS-CODE.

In this case, the DD name in the JCL has to be coded as shown below.

//IXFILE DD DISP=SHR,DSN=MY.BASE.CLUSTER
//INFILE1 DD DISP=SHR,DSN=MY.PATH.FOR.AIX1
//INFILE2 DD DISP=SHR,DSN=MY.PATH.FOR.AIX2
//INFILE3 DD DISP=SHR,DSN=MY.PATH.FOR.AIX3

Case 2

Lets say SELECT statement in the program is coded as shown below.

SELECT I-FILE
   ASSIGN TO IXFILE
   ORGANIZATION IS INDEXED
   ACCESS IS DYNAMIC
   RECORD KEY IS EMP-KEY
   ALTERNATE RECORD AIX2-KEY
   FILE STATUS IS FS-CODE.

In this case, the DD name in the JCL has to be coded as shown below.

//IXFILE DD DISP=SHR,DSN=MY.BASE.CLUSTER
//INFILE1 DD DISP=SHR,DSN=MY.PATH.FOR.AIX2

Case 3

Lets say SELECT statement in the program is coded as shown below.

SELECT I-FILE
   ASSIGN TO DATAFILE
   ORGANIZATION IS INDEXED
   ACCESS IS DYNAMIC
   RECORD KEY IS EMP-KEY
   ALTERNATE RECORD AIX1-KEY
   FILE STATUS IS FS-CODE.

Note that the DD name for the base cluster is already 8 characters. So, to form the DD name for AIX path, we need to omit the last character from the DD name of base cluster and add 1 to it as shown below.

//DATAFILE DD DISP=SHR,DSN=MY.BASE.CLUSTER
//DATAFIL1 DD DISP=SHR,DSN=MY.PATH.FOR.AIX1

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.