Interview Questions   Tutorials   Discussions   Programs   Discussion   

VSAM - What is the use of aix in vsam why do we go for aix and what is build index in vsam?

asked mar August 24, 2014 12:44 PM  

What is the use of aix in vsam why do we go for aix and what is build index in vsam?


1 Answers

answered By Mswami   0  
Creating alternate indexes:

An alternate index provides access to the records in a data set that uses more than one key. It accesses records in the same way as the prime index key of an indexed data set (KSDS).

When planning to use an alternate index, you must know:

  •     The type of data set (base cluster) with which the index will be associated
  •     Whether the keys will be unique or not unique
  •     Whether the index is to be password protected
  •     Some of the performance aspects of using alternate indexes
Because an alternate index is, in practice, a VSAM data set that contains pointers to the keys of a VSAM data set, you must define the alternate index and the alternate index path (the entity that establishes the relationship between the alternate index and the prime index). After you define an alternate index, make a catalog entry to establish the relationship (or path) between the alternate index and its base cluster. This path allows you to access the records of the base cluster through the alternate keys.

To use an alternate index, do these steps:

  1. Define the alternate index by using the DEFINE ALTERNATEINDEX command. In it, specify these items:
    •  Name of the alternate index
    •  Name of its related VSAM indexed data set
    •  Location in the record of any alternate indexes and whether they are unique
    •  Whether alternate indexes are to be updated when the data set is changed
    •  Name of the catalog to contain this definition and its password (can use default name)
         In your COBOL program, the alternate index is identified solely by the ALTERNATE RECORD KEY clause in the FILE-CONTROL paragraph. The ALTERNATE RECORD KEY definitions must match the definitions in the catalog entry. Any password entries that you cataloged should be coded directly after the ALTERNATE RECORD KEY phrase.   

        2. Relate the alternate index to the base cluster (the data set to which the alternate index gives you access) by using the DEFINE PATH command. In it, specify these items:
    •  Name of the path
    •  Alternate index to which the path is related
    •  Name of the catalog that contains the alternate index                        & nbsp;                        & nbsp;                  The base cluster and alternate index are described by entries in the same catalog.

        3. Load the VSAM indexed data set.

        4. Build the alternate index by using (typically) the BLDINDEX command. Identify the input file as the indexed data set (base cluster) and the output file as the alternate index or its path. BLDINDEX reads all the records in the VSAM indexed data set (or base cluster) and extracts the data needed to build the alternate index.

        Alternatively, you can use the runtime option AIXBLD to build the alternate index at run time. However, this option might adversely affect performance.

    Build index command:

    //IND220BX JOB OZA,OZA,MSGLEVEL=(1,1),             
    //       CLASS=A,MSGCLASS=A,NOTIFY=&SYSUID        
    //STEP   EXEC PGM=IDCAMS                   
    //SYSPRINT DD SYSOUT=*                    
    //SYSIN  DD *                        
     BLDINDEX -                          
  • flag   
       add comment

    Your answer

    Join with account you already have



    Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!