DEFINE USERCATALOG command


Creating a User Catalog:

Ø  DEFINE USERCATALOG is the command used to create a user catalog.

Ø  Following is the Syntax for creating a User Catalog:
DEFINE  USERCATALOG 
    (NAME(entryname)

    { CYLINDERS(primary[ secondary])  |
       RECORDS(primary[ secondary])  |
       TRACKS(primary[ secondary]) } 

    VOLUME(volser)    
à NEED TO SPECIFY SOME EMPTY VOLUME

    [FILE(ddname)] 
    [TO(date)  |  FOR(days)] 
   
    [DATA 
    [CYLINDERS(primary[ secondary])  |  
à NOTE THAT UNLIKE DEFINE CLUSTER WE ARE ONLY SPECIFYING THE SIZE OF THE COMPONENTS AND NOT The NAME
     RECORDS(primary[ secondary])  | 
     TRACKS(primary[ secondary])]

    [INDEX 
    [CYLINDERS(primary[ secondary])  | 
     RECORDS(primary[ secondary])  | 
     TRACKS(primary[ secondary])] 

 [CATALOG(mastercatname[/password])] 
Ø  Example:
//DEFUCAT1 JOB 'JAY MOSELEY',CLASS=A,MSGLEVEL=(1,1),MSGCLASS=A         
//IDCAMS   EXEC PGM=IDCAMS,REGION=4096K                                
//SYSPRINT DD  SYSOUT=A                                                 
//MVS801   DD  UNIT=3380,VOL=SER=MVS801,DISP=OLD                       
//MVS802   DD  UNIT=3380,VOL=SER=MVS802,DISP=OLD                       
//SYSIN    DD  *                                                        
                                                                       
  DEFINE USERCATALOG (                                      -          
               NAME (UCMVS801)                              -          
               VOLUME (MVS801)                              -          
               TRACKS (13259 0)                             -          
               FOR (9999) )                                 -          
         DATA (TRACKS (15 5) )     imp: There is no Comma in between                         -          
         INDEX (TRACKS (15) )                                          
                                                                       
  IF LASTCC = 0 THEN                                        -          
        LISTCAT ALL CATALOG(UCMVS801)                                  
                                                                       
  DEFINE USERCATALOG (                                      -          
               NAME (UCMVS802)                              -          
               VOLUME (MVS802)                              -          
               TRACKS (15)                                  -          
               FOR (9999) )                                            
                                                                        
  IF LASTCC = 0 THEN                                        -          
        LISTCAT ALL CATALOG(UCMVS802)                                  
                                                                        
/*                                                                     
//                                     
Ø  Since a VSAM catalog owns the volume on which it resides, the VSAM catalog must be the first VSAM object stored on a volume.  Thus the volume provided to it must be empty

Ø  When a VSAM catalog is defined, AMS automatically defines a data space on that volume and then allocates space for the VSAM catalog from within that data space. 

Ø  Separate space allocation subparameters can be specified for the index(INDEX) and data (DATA) components. 

Ø  If separate SPACE subparameters (DATA and INDEX) are not specified for the index and data components, the entire data space (created automatically by AMS) is assigned to the catalog.  There is separate command to define one or more data spaces owned by the catalog in which to create future VSAM objects.

Ø  If separate index and data component space allocation subparameters are coded. the SPACE parameter for the catalog as a whole defines the size of the data space that is created, and the SPACE subparameters that are specified for the data and index components determine the portion of the data space that is assigned to the catalog.  The remainder of the data space becomes available for other VSAM objects.

Ø  If you run the above code and  look at the catalog listing in the SYSOUT (following the AMS statements defining the user catalog UCMVS801), you can see that under MVS801's dataspace extent information 13,259 tracks have been allocated to the data space, of which only some tracks are used for user catalog. IF we compare this with MVS802 and you can see that only 15 tracks were allocated for the data space and all 15 have been used for the catalog.  Before any VSAM objects can be created on volume MVS802, a separate data space will need to be defined. This can be done using DEFINE SPACE command.

No comments:

Post a Comment