Build Index for AIX


Build index process builds the corresponding alternate index for the existing records. BLDINDEX command is used to build the index for the alternate key and is the last step in creating the AIX process.

Build index performs the data load operation to the AIX DATA component and indexes to the AIX index component from the base cluster according to the Alternate key. Base cluster should have atleast have one record to build the index.

Syntax -

//JOBNAME  JOB job-card-parameters
//STEP1    EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  BLDINDEX 
    [INFILE(indd) | 
	 INDATASET(input-dataset-name)]
  	[OUTFILE(outdd1...])|
	 OUTDATASET(output-dataset-name1...])}
  	[EXTERNALSORT | INTERNALSORT]
  	[SORTCALL | NOSORTCALL]
  	[SORTFILENUMBER(number)]
  	[WORKFILES(workfile-ddname1...])
   [CATALOG(catalog-name)]
/*

Mandatory Parameters


  • INFILE(indd) - Specifies the DDname that identifies the base cluster. Short Description: IFILE
  • INDATASET(input-dataset-name) - Specifies the file (DSN) name. Short Description: IDS
  • OUTFILE (outdd1...]) - Specifies the DDname that identifies the AIX. Short Description: OFILE
  • OUTDATASET(output-dataset-name1...]) - Specifies the dataset name that identifies the AIX. Short Description: ODS

Optional Parameters


  • EXTERNALSORT | NOSORTCALL -
    • EXTERNALSORT - Specifies external sort is used to sort the records. Two external-sort work files (ESDS) need to be provided with DD names - IDCUT1 and IDCUT2. Short Description: ESORT
    • INTERNALSORT - Specifies internal sort is used to sort the key pairs within the user-specified virtual storage. If the virtual storage is not sufficient for processing, the BLDINDEX processing ends with an error message. Short Description: ISORT
  • SORTCALL | NOSORTCALL -
    • SORTCALL - Specifies DFSORT should use to sort the AIX. If DFSORT is called, EXTERNALSORT, INTERNALSORT, WORKFILES, CATALOG, IDCUT1, and IDCUT2 are ignored. SORTCALL is the default.
    • NOSORTCALL - Specifies BLDINDEX should use IDCAMS internal sort (or external sort if specified) instead of DFSORT to sort the AIX. When the IDCAMS internal or external sort is used, SORTMESSAGELEVEL, SORTDEVICETYPE, SORTMESSAGEDD and SORTFILENUMBER parameters are restricted.
  • SORTFILENUMBER (number) - Specifies the maximum number of work datasets passed to DFSORT. Short Description: SORTFN or SFN
  • WORKFILES (workfile-ddname1...]) - Specifies the DD statements of the work files that BLDINDEX require an external sort of the key-pointer pairs. Short Description: WFILE
  • CATALOG (catalog-name) - Specifies the catalog in which the work files are to be defined. Short Description: CAT

Example -


Scenario - Build index for alternate index on the employee KSDS file.

Input KSDS File - MATEPK.EMPL.KSDS

Input Alternate Index - MATEPK.EMPL.DEPTAIX

Input Path - MATEPK.EMPL.DEPTAIX.PATH

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//STEP10   EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN    DD *
  BLDINDEX - 
        INDATASET (MATEPK.EMPL.KSDS) - 
        OUTDATASET(MATEPK.EMPL.DEPTAIX) - 
		INTERNALSORT -
        NOSORTCALL
/*
...

Output -

Once the above JCL is submitted, check the MAXCC of the job for any errors. If the MAXCC is 00 or 04, then BLDINDEX is successful.

BUILD AIX Sysprint

Verify the loaded AIX in 3.4 (Dataset List utility) or any File management tools for the existance. AIX keys should load with the combination of the primary keys, as shown below -

Verify AIX Data