DEFINE GENERATIONDATAGROUP


DEFININING GDG:

·        A generation data group is a group of related datasets, usually created in chronological order.
·        Before creating the first generation of a generation data group, two steps are required. 
1)     Creating a GDG base.
2)     A model must be created for the DCB parameters of the individual datasets to be created.

·        Syntax:

DEFINE GENERATIONDATAGROUP
    (NAME(entryname)
    LIMIT(limit)
    [EMPTY  |  NOEMPTY]
    [SCRATCH  |  NOSCRATCH]
    [TO(date)  |  FOR(days)])

    [CATALOG(catname[/password])] 

·        LIMIT specifies the maximum number (from 1 to 255) of generations that are to be kept.  
·        EMPTY specifies that all the generation datasets are to be uncataloged when the maximum is reached and another generation dataset is to be cataloged. 
·        NOEMPTY (the default) specifies that only the oldest generation dataset is to be uncataloged when the maximum is reached.
·        SCRATCH specifies that the generation dataset's entry is to be deleted from the Volume Table Of Contents when the generation dataset is uncataloged. The generation dataset ceases to exist. 
·        NOSCRATCH (the default) specifies that the generation dataset's entry is not to be removed from the VTOC when the generation dataset is uncataloged. 
MODEL DSCB:
·        When generation datasets are created, the DCB information for the new dataset must come from a model dataset. 
·        The model dataset does not occupy any storage space, but exists only as a VTOC entry. 
·        The model must be on the same volume where the catalog in which the generation data group is cataloged resides. 
·        Since the name for the GDG base is already in the catalog, the model (which also has the same name) cannot be cataloged. 
·        An alternative is to have a single model DSCB that is used for all generation datasets catalogued on a system pack, such as the System Residence.  
The following jobstream defines a Generation Data Group and also creates a model DSCB which can be used for the creation of the generation datasets.

//DEFGDG   JOB 'JAY MOSELEY',CLASS=A,MSGLEVEL=(1,1),MSGCLASS=A
//IDCAMS  EXEC PGM=IDCAMS,REGION=4096K                       
//MODEL    DD  DSN=MVS501.ACH.TRANS,DISP=(NEW,KEEP),      à not catalogued    
//             UNIT=3350,VOL=SER=MVS501,SPACE=(TRK,0), à Space provided is 0      
//             DCB=(RECFM=FB,LRECL=80,BLKSIZE=3120)          
//SYSPRINT DD  SYSOUT=A                                      
//SYSIN    DD  *                                             
                                                             
  /* DELETE GENERATION DATA GROUP, IF IT EXISTS             */
                                                             
  DELETE MVS501.ACH.TRANS GENERATIONDATAGROUP                
                                                             
  /* DEFINE GENERATION DATA GROUP                           */
                                                             
  DEFINE GENERATIONDATAGROUP (                              -
               NAME(MVS501.ACH.TRANS)                       -
               LIMIT(5)                                     -
               SCRATCH )                                     
                                                              
  IF LASTCC = 0 THEN                                        -
        LISTCAT ALL ENTRIES(MVS501.ACH.TRANS)                
                                               
Note that the SPACE specified for the model is (TRK,0), so no space is reserved for the model.  

No comments:

Post a Comment