Building a HIDAM primary index on an alternate primary index data set

When the primary index of a HIDAM database is intact, it can be used to build a new primary index. The new index is written to the alternate index data set, which has been previously defined.

About this task

Because the alternate primary index and the existing index must coexist while IMS™ Index Builder is running, the job contains the following three steps:
  • Using IDCAMS, defines the new primary index data set with the same attributes as the existing primary index but with a different name.
  • Builds the new primary index using IMS Index Builder.
  • Uses IDCAMS to delete the old primary index data set and invoke the ALTER command to change the data set name of the new index to the data set name of the old index.

Procedure

  1. Make sure that the alternate (new) and existing primary indexes are both cataloged in the same catalog. Otherwise, problems will be encountered with the ALTER command.
  2. Define the JCL using the following example:
    Figure 1. Example JCL for building a HIDAM primary index on an alternate primary index data set (Part 1 of 2)
    //IIUBBLD  JOB &SYSUID,MSGCLASS=H,REGION=233M,TIME=1339,
    //             RESTART=*,CLASS=A,NOTIFY=&SYSUID
    //*********************************************************************
    //*    Building a HIDAM Primary Index on an Alternate Primary Index   *
    //*             Data Set with IMS IB V3 R1                   IIUSMP07 *
    //*********************************************************************
    //* Provide values for the following variables:
    // SET SIIULMOD=                          Index Builder load library
    // SET SHKTLOAD=                          ITKB load library
    // SET   RESLIB=                          IMS RESLIB
    // SET   MDALIB=                          IMS MDALIB
    // SET   DBDLIB=                          DBD library
    // SET   RECON1=                          Recon1 data set name
    // SET   RECON2=                          Recon2 data set name
    // SET   RECON3=                          Recon3 data set name
    //* NOTE: The Index Builder load library and all other datasets
    //*       concatenated to STEPLIB must be APF authorized.
    //*********************************************************************
    //*
    Figure 2. Example JCL for building a HIDAM primary index on an alternate primary index data set (Part 2 of 2)
    //*-------------------------------------------------------------------*
    //*     Invoke IDCAMS to Create Temporary Index and Copy First Record *
    //*     of Old Index                                                  *
    //*-------------------------------------------------------------------*
    //DEFINE   EXEC PGM=IDCAMS,COND=(0,LT)
    //SYSPRINT DD  SYSOUT=*
    //SYSIN    DD  *
      DEFINE   CLUSTER (NAME(MYTEST.TEST.NEWNDX0) -
        MODEL(MYTEST.TESTDB1.HIDAM.INDEX))
    //*-------------------------------------------------------------------*
    //*     Invoke IMS IB V3 R1 to Build the Primary Index                *
    //*-------------------------------------------------------------------*
    //IIUBSCN  EXEC PGM=IIUSTART,COND=(0,LT)
    //STEPLIB  DD  DISP=SHR,DSN=&SIIULMOD
    //         DD  DISP=SHR,DSN=&SHKTLOAD
    //         DD  DISP=SHR,DSN=&RESLIB
    //         DD  DISP=SHR,DSN=&MDALIB
    //IMS      DD  DISP=SHR,DSN=&DBDLIB
    //RECON1   DD  DISP=SHR,DSN=&RECON1
    //RECON2   DD  DISP=SHR,DSN=&RECON2
    //RECON3   DD  DISP=SHR,DSN=&RECON3
    //IIUPRINT DD  SYSOUT=*
    //IIUCAPT  DD  SYSOUT=*
    //IIUSNAP  DD  SYSOUT=*
    //IIUSOUT  DD  SYSOUT=*
    //IIUIN    DD  *
      PROC     BLD_PRIMARY,TESTDBD1
      INPUT    IBSCAN,DBRC=N
      OUTPUT   DATOUT
    /*
    //TESTDB1P DD  DISP=SHR,DSN=MYTEST.TESTDB1.HIDAM.OSAM
    //TESTDB1X DD  DISP=SHR,DSN=MYTEST.TESTDB1.HIDAM.INDEX
    //DATOUT   DD  DISP=OLD,DSN=MYTEST.TEST.NEWNDX0
    //*-------------------------------------------------------------------*
    //*     Invoke IDCAMS to Replace The Old Index with the New One       *
    //*-------------------------------------------------------------------*
    //REPLACE  EXEC PGM=IDCAMS,COND=(0,LT)
    //SYSPRINT DD  SYSOUT=*
    //SYSIN    DD  *
      DELETE  MYTEST.TESTDB1.HIDAM.INDEX
      IF MAXCC ^= 0 THEN -
        CANCEL
      ALTER MYTEST.TEST.NEWNDX0 -
        NEWNAME(MYTEST.TESTDB1.HIDAM.INDEX)
    /*
    //