Define Alternate Index
IDCAMS Define Alternate Index Example
Scenario - Create alternate index for EMPL-DEPT-ID on the employee KSDS file.
Input File Layout (COBOL) -
01 EMPL-REC.
05 EMPL-ID PIC X(03).
05 EMPL-NAME PIC X(15).
05 EMPL-DESIGNATION PIC X(05).
05 EMPL-DEPT-ID PIC X(05).
05 EMPL-LOC PIC X(05).
05 EMPL-SALARY PIC 9(07).
Input File - MATEPK.EMPL.KSDS
JCL -
----+----1----+----2----+----3----+----4----+----5----+
//MATEPKA JOB (123),'MTH',CLASS=A,MSGCLASS=A,
// MSGLEVEL=(1,1),NOTIFY=&SYSUID
//******************************************
//* DEFINE ALTERNAME INDEX
//******************************************
//STEP10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE AIX -
(NAME(MATEPK.EMPL.DEPTAIX) -
RELATE(MATEPK.EMPL.KSDS) -
CISZ(4096) -
KEYS(5,24) -
NONUNIQUEKEY -
UPGRADE -
RECORDSIZE(47,47) -
CYLINDERS(2,1) -
FREESPACE(10,20) -
VOLUMES(DEVHD4)) -
DATA(NAME(MATEPK.EMPL.DEPTAIX.DATA)) -
INDEX(NAME(MATEPK.EMPL.DEPTAIX.INDEX))
/*
Output -
Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, AIX successfully created.
Verify the AIX in 3.4 (Dataset List utility) or any File management tools for the existance.
Explaining Example -
In the above example,
- AIX (NAME(MATEPK.EMPLDEPT.AIX) specifies the AIX cluster name.
- RECORDSIZE(47,47) specifies the record average length is 47, and the maximum size is 47. So the KSDS file used is fixed-length.
- CYLINDERS(2,1) specifies the primary memory allocation is 2 CYLINDERS, and secondary memory allocation is 1 CYLINDER.
- CISZ(4096) specifies the control interval size is 4096.
- KEYS(5,24) specifies the alternate key position in the EMPL KSDS file.
- VOLUMES(DEVHD4) specifies that allocate the ESDS on volume DEVHD4.
- NONUNIQUEKEY parameter specifies the alternate key can have duplicates.
- UPGRADE specifies the AIX should update when base cluster is updated.
- DATA(NAME(MATEPK.EMPLDEPT.AIX.DATA)) specifies the AIX DATA component name.
- INDEX(NAME(MATEPK.EMPLDEPT.AIX.INDEX)) specifies the AIX INDEX component name.