jclvsam

Defining Alternate Index for VSAM KSDS


I have problem defining alternate index for my VSAM KSDS. It says

IDC3211I KEYWORD 'DATA' IS IMPROPER  

Here is my VSAM KSDS definition:

  DEFINE CLUSTER                            -    
       (NAME(IBMUSER.TEST.SAMPLE.KSDS)      -    
        VOLUMES(ZASYS1)                     -    
        TRACKS(15 15)                       -    
        INDEXED                             -    
        SHAREOPTIONS(1 3) UNIQUE            -    
        RECORDSIZE(100 100)                 -    
        KEYS(18 0)                          -    
      DATA(NAME(IBMUSER.TEST.SAMPLE.KSDS.DATA))- 
     INDEX(NAME(IBMUSER.TEST.SAMPLE.KSDS.INDEX)) 

This is my Alternate Index definition:

  DEFINE AIX (NAME(IBMUSER.TEST.SAMPLE.AIX)- 
  RELATE(IBMUSER.TEST.SAMPLE.KSDS)       -   
  CISZ(4096)                             -   
  FREESPACE(20,20)                       -   
  KEYS(20,19)                            -   
  NONUNIQUEKEY                           -   
  UPGRADE                                -   
  RECORDSIZE(61,61)                    -     
  DATA(NAME(IBMUSER.TEST.SAMPLE.AIX.DATA))-  
  INDEX(NAME(IBMUSER.TEST.SAMPLE.AIX.INDEX)) 

I don't get why it says keyword DATA is improper.


Solution

  • There are a few issues. The first one is a syntax issue in the command.

      DEFINE CLUSTER                                   -                          
           (                                           -                          
            NAME(IBMUSER.TEST.SAMPLE.KSDS)             -                          
            TRACKS(15 15)                              -                          
            INDEXED                                    -                          
            VOLUMES(ZMSHR1)                            -                          
            SHAREOPTIONS(1 3) UNIQUE                   -                          
            RECORDSIZE(100 100)                        -                          
            KEYS(18 0)                                 -                          
          DATA(NAME(IBMUSER.TEST.SAMPLE.KSDS.DATA))    -                          
    IDC3211I KEYWORD 'DATA' IS IMPROPER                                           
         INDEX(NAME(IBMUSER.TEST.SAMPLE.KSDS.INDEX))                              
    IDC3202I ABOVE TEXT BYPASSED UNTIL NEXT COMMAND. CONDITION CODE IS 12         
    

    This is because you are missing a closing parenthesis after the KEYS clause which completes the CLUSTER section. Adding a closing parenthesis like follows will complete the DEFINE CLUSTER section.

      DEFINE CLUSTER                                   -
           (                                           -
            NAME(IBMUSER.TEST.SAMPLE.KSDS)             -
            TRACKS(15 15)                              -
            INDEXED                                    -
            VOLUMES(ZMSHR1)                            -
            SHAREOPTIONS(1 3) UNIQUE                   -
            RECORDSIZE(100 100)                        -
            KEYS(18 0)                                 -
           )                                           -
          DATA(NAME(IBMUSER.TEST.SAMPLE.KSDS.DATA))    -
         INDEX(NAME(IBMUSER.TEST.SAMPLE.KSDS.INDEX))
    IDC0508I DATA ALLOCATION STATUS FOR VOLUME ZMSHR1 IS 0         
    IDC0509I INDEX ALLOCATION STATUS FOR VOLUME ZMSHR1 IS 0        
    IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 0      
    

    When that is corrected you'll get another error because you need a space and volume specification for the AIX. Use the definition below that has the needed parameters for the AIX.

      DEFINE AIX                                       -
             (                                         -
              NAME(IBMUSER.TEST.SAMPLE.AIX)            -
              TRACKS(15 15)                            -
              VOLUMES(ZMSHR1)                          -
              RELATE(IBMUSER.TEST.SAMPLE.KSDS)         -
              CISZ(4096)                               -
              FREESPACE(20,20)                         - 
              KEYS(20,19)                              - 
              NONUNIQUEKEY                             - 
              UPGRADE                                  - 
              RECORDSIZE(61,61)                        - 
             )                                         - 
            DATA(NAME(IBMUSER.TEST.SAMPLE.AIX.DATA))   - 
           INDEX(NAME(IBMUSER.TEST.SAMPLE.AIX.INDEX))    
    

    Complete JOB to accomplish the creation of the CLUSTER and the ALTERNATEINDEX follows. I formatted the statements to be more readable:

    //IDCAMS   JOB CLASS=A,NOTIFY=&SYSUID               
    //STEP0010 EXEC PGM=IDCAMS                          
    //SYSPRINT DD  SYSOUT=*                             
    //SYSIN    DD  *                                    
      DELETE IBMUSER.TEST.SAMPLE.KSDS                   
      DELETE IBMUSER.TEST.SAMPLE.AIX                    
      SET MAXCC = 0                                     
                                                        
      DEFINE CLUSTER(                                   -
                     NAME(IBMUSER.TEST.SAMPLE.KSDS)     -
                     TRACKS(15 15)                      -
                     INDEXED                            -
                     VOLUMES(ZMSHR1)                    -
                     SHAREOPTIONS(1 3) UNIQUE           -
                     RECORDSIZE(100 100)                -
                     KEYS(18 0)                         -
             )                                          -
             DATA(                                      -
               NAME(IBMUSER.TEST.SAMPLE.KSDS.DATA)      -
             )                                          -
             INDEX(                                     -
                   NAME(IBMUSER.TEST.SAMPLE.KSDS.INDEX) -
             )    
                                                                                                            
      DEFINE AIX(                                       -
                 NAME(IBMUSER.TEST.SAMPLE.AIX)          -
                 TRACKS(15 15)                          -
                 VOLUMES(ZMSHR1)                        -
                 RELATE(IBMUSER.TEST.SAMPLE.KSDS)       -
                 CISZ(4096)                             -
                 FREESPACE(20,20)                       -
                 KEYS(20,19)                            -
                 NONUNIQUEKEY                           -
                 UPGRADE                                -
                 RECORDSIZE(61,61)                      -
                )                                       -
             DATA(                                      -
                  NAME(IBMUSER.TEST.SAMPLE.AIX.DATA))   -
                 )                                      -
             INDEX(                                     -
                   NAME(IBMUSER.TEST.SAMPLE.AIX.INDEX)  -
                  )         
    /*                                                  
    //