Creating new secondary indexes

Use IMS™ Index Builder to create new secondary indexes without a full reorganization of the physical database.

About this task

You can create a new secondary index only when the segments in the physical database are not changed and only indexes are added.
Restriction:
The create secondary index function is available only when DBRC is off. HALDB are not supported.
Requirement:
If you are creating a new secondary index with a target segment that is not a root segment and is not the target of an already existing secondary index, you must use the IMS Reorganization Reload utility to create the physical parent pointer.

Procedure

  1. Define new DBDs for the physical database and for the new indexes.
  2. Put the resulting DBDs into a separate library because the old DBD for the physical database is needed for the scan.
  3. Run IMS Index Builder against the database using the IBSCAN keyword on the INPUT statement. Use DD name IMS for the library containing the old DBD for the physical database. Use DD name IMSALT for the library containing the new DBDs for the physical database and the new indexes. IMS Index Builder always checks whether DD name IMSALT was defined. If so, it reads all the DBDs needed to build the secondary indexes from DD name IMSALT instead of using DD name IMS. If IMSALT was not specified, it uses the IMS DD name statement, which must point to the new DBDs.
  4. After IMS Index Builder has successfully completed, copy the new DBDs into the regular DBD library.

Example

In the example that is shown in the following figure, a new index called TSTNDX5 is added to database TESTDBD1. Dynamic allocation is used for the database DSGs and the primary index. The TSTNDX5 index is allocated using DD name TSTNDX5.

Before executing IMS Index Builder, the DBD for index TSTNDX5 and the new DBD for database TESTDBD1 must be generated and stored in the first library of the concatenation for DD name IMSALT. The old DBD for database TESTDBD1 must not be deleted until IMS Index Builder has successfully completed.

Figure 1. Example JCL for creating a new secondary index to an existing database
//IIUBBLD  JOB &SYSUID,MSGCLASS=H,REGION=233M,TIME=1339,                
//             RESTART=*,CLASS=A,NOTIFY=&SYSUID                         
//********************************************************************* 
//*      Creating a New Secondary Index to an Existing Data Base      * 
//*               with IMS IB V3 R1 (UG FIGURE 03)           IIUSMP02 * 
//********************************************************************* 
//* Provide values for the following variables:                         
// SET SIIULMOD=                          Index Builder load library    
// SET SHKTLOAD=                          ITKB load library             
// SET   RESLIB=                          IMS RESLIB                    
// SET   DBDLIB=                          DBD library                   
// SET  ADBDLIB=                          ALT DBD library               
//* NOTE: The Index Builder load library and all other datasets         
//*       concatenated to STEPLIB must be APF authorized.               
//********************************************************************* 
//IIUBSCN  EXEC PGM=IIUSTART                                            
//STEPLIB  DD  DISP=SHR,DSN=&SIIULMOD                                   
//         DD  DISP=SHR,DSN=&RESLIB                                     
//         DD  DISP=SHR,DSN=&SHKTLOAD                                   
//IMS      DD  DISP=SHR,DSN=&DBDLIB                                     
//IMSALT   DD  DISP=SHR,DSN=&ADBDLIB                                    
//         DD  DISP=SHR,DSN=&DBDLIB                                     
//IIUPRINT DD  SYSOUT=*                                                 
//IIUCAPT  DD  SYSOUT=*                                                 
//IIUSNAP  DD  SYSOUT=*                                                 
//IIUSOUT  DD  SYSOUT=*                                                 
//IIUIN    DD *                                                         
  PROC     BLD_SECONDARY,TESTDBD1,SELECTED                              
  INDEX    TSTNDX5                                                      
  INPUT    IBSCAN,DBRC=N                                                
//*                                                                     
//TESTDB1P DD  DISP=SHR,DSN=MYTEST.TESTDB1.HIDAM.OSAM                   
//TESTDB1X DD  DISP=SHR,DSN=MYTEST.TESTDB1.HIDAM.INDEX                  
//TESTDB5Y DD  DISP=SHR,DSN=MYTEST.TSTNDX5.SECINDEX                     
//