Define Alternate Index (AIX)


Define Alternate Index (AIX) defines the alternate index components (cluster, DATA, and INDEX) and their catalog entries. At this point, an alternate index does not have any link with the base cluster data. DEFINE ALTERNATEINDEX command is used to define an alternate index for alternate keys on the VSAM file.

Note! An alternate index defines over a KSDS or ESDS cluster. An alternate index not allowed to define on a reusable cluster, a fixed or variable-length RRDS, an extended ESDS, a catalog, another alternate index, an LDS, or a non-VSAM dataset.

The alternate index has three components, and those are -

  • An AIX cluster
  • DATA Component
  • INDEX Component

Syntax -

//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  DEFINE ALTERNATEINDEX
  	  (NAME(entryname)
  	  [RELATE(entryname)]
	  [ad_common_parameters]
	  [adi_common_parameters])
	[DATA (
  	  [NAME(entryname)]
	  [ad_common_parameters]
	  [adi_common_parameters])]
	[INDEX (
  	  [NAME(entryname)]
  	  [adi_common_parameters])]
  	[CATALOG(catname)]
/*

ad_common_parameters applicable to AIX, and DATA -

  	  [KEYS(length  offset|64 0)  ]
  	  [RECORDSIZE(average maximum| 4086 32600)]
	  [UNIQUEKEY | NONUNIQUEKEY]
	  [UPGRADE | NOUPGRADE]
	  [BUFFERSPACE(size)]
	  [TO(date) | FOR(days)]
	  [FREESPACE(CI-percent[ CA-percent]| 0 0)]
	  [SPEED | RECOVERY]
	  [ERASE | NOERASE]

adi_Common_parameters applicable to AIX, DATA, and INDEX -

  	  [FILE(ddname)]
  	  [MODEL(entryname[ catname])]
	  [CONTROLINTERVALSIZE(size)]
  	  {CYLINDERS(primary[ secondary])|
  	   KILOBYTES(primary[ secondary])|
  	   MEGABYTES(primary[ secondary])|
  	   RECORDS(primary[ secondary])|
  	   TRACKS(primary[ secondary])}
  	  [OWNER(ownerid)]
	  [SHAREOPTIONS (crossregion[ crosssystem]|1 3)]
  	  [REUSE | NOREUSE]
	  [VOLUMES(volser...)]
	  [WRITECHECK | NOWRITECHECK]
  	  [ORDERED | UNORDERED]

Mandatory Parameters


  • ALTERNATEINDEX - used to define the cluster or re-catalog cluster or cluster entry. The parameters specified with the ALTERNATEINDEX keyword are applied to the whole cluster that is going to create. Short Description: AIX
  • NAME (entryname) - Specifies the name of the alternate index to be created. This name must be unique within the catalog. entrynames are different for the cluster, its DATA component, and its INDEX component. The name is automatically generated if no names are coded for the DATA or INDEX component. The name of AIX can be up to 44 alphanumeric characters.
  • RELATE (entryname) - Specifies the name of the base cluster (KSDS) to which the alternate index will be related. This is a mandatory entry and if missed to provide, the DEFINE ALTERNATEINDEX job gets abended.
  • CYLINDERS (primary[ secondary])
    KILOBYTES (primary[ secondary])
    MEGABYTES (primary[ secondary])
    RECORDS (primary[ secondary])
    TRACKS (primary[ secondary]) -
    used to specify the amount of space allocated to the cluster, DATA and INDEX component in CYLINDERS (CYL), KILOBYTES (KB), MEGABYTES (MB), RECORDS (REC), or TRACKS (TRK) from the volume's available space. Short Description: CYL, KB, MB, REC, TRK
    primary - Specifies the amount of space that should allocate initially.
    secondary Specifies an amount of space required each time when it extends.
  • VOLUMES (volser[ volser...]) - Specifies the volume serial numbers where the alternate index will reside. If there is not enough space on the volume as specified, the allocation is unsuccessful. Short Description: VOL

Optional Parameters


  • BUFFERSPACE (size) - Specifies the amount of space to allocate for buffers. The buffer size is calculated using the DATA and INDEX component's control interval sizes. Short Description: BUFSP or BUFSPC
  • CONTROLINTERVALSIZE (size) - Specifies the control interval size for the alternate index. If it is coded at the cluster level, it applies to the all components where it is not coded. If it is not coded, AIX determines the size of control intervals. Short Description: CISZ or CNVSZ
  • DATACLASS (class) - Specifies allocation attributes for the new AIX datasets. The storage administrator provides the data class name (1-8 characters). Short Description: DATACLAS
  • ERASE | NOERASE - Default: NOERASE
    • ERASE - specifies the cluster components memory is to be erased with binary zeroes when cluster is deleted. Short Description: ERAS
    • NOERASE - specifies the cluster components memory is not to be erased when cluster is deleted. Short Description: NERAS
  • FILE (ddname) - specifies DDname that identifies the file.
  • FREESPACE (CI-percent[ CA-percent]|0 0) - Specifies the percentage of each control interval and control area to leave free for future insertions. Short Description: FSPC. Default: FREESPACE (0 0)
  • KEYS (length offset | 64 0) - specifies the information about the alternate key field in the base cluster's data record. Default: KEYS (64 0)
  • MODEL (entryname[ catname]) - used to specify an already-defined cluster entry is to be used as a model.
  • OWNER (ownerid) - Allows specifying the owner of the alternate index.
  • RECORDSIZE (average maximum|4086 32600) - specifies the AIX average and maximum record lengths in bytes. Short Description: RECSZ
  • SHAREOPTIONS (crossregion[ crosssystem]|1 3) - specifies the sharing options of how a AIX component or cluster can share among users. Short Description: SHR. Default: SHR (1 3). crossregion specifies the amount of sharing allowed among regions. Valid values are 1 to 4. crosssystem option specifies the amount of sharing allowed among systems. Valid values are 1 to 4.
  • SPEED (does not preformat) | RECOVERY (does preformat) - specifies whether the data component control areas are to be preformatted before AIX records are loaded into them. Default: SPEED. Short Description: SPEED or RCVY
  • REUSE | NOREUSE -
    • REUSE - allows the dataset to be reused if it is deleted and then recreated. Short Description: RUS
    • NOREUSE - indicates that the dataset is not reused after being deleted. Short Description: NRUS
  • UNIQUEKEY | NONUNIQUEKEY -
    • UNIQUEKEY - ensures all keys are unique in the alternate index. Short Description: UNQK
    • NONUNIQUEKEY - allows duplicate alternate keys. Short Description: NUNQK
  • UPGRADE | NOUPGRADE -
    • UPGRADE - ensures the AIX is automatically updated when changes happend in the base cluster. Short Description: UPG
    • NOUPGRADE - specifies no automatic updates to AIX for changes in the base cluster. Short Description: NUPG
  • CATALOG (catname) - Specifies the catalog name in which the AIX cluster is to be defined. Short Description: CAT

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

Employee File Mapping

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//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.

AIX SYSPRINT

Verify the AIX in 3.4 (Dataset List utility) or any File management tools for the existance.

AIX Output