Tuesday, July 2, 2013

GDG - Generation Data Group.


GDGs are group of chronologically related datasets.
Suppose we want to keep track of daily sales of  shop.We can create new files everyday, or can run the same job to produce new GDG versions everyday.
So we need to create a model dataset,which is called the GDG Base, and all the new files created by the system will take the properties of the Base version and create new files.

We use IDCAMS utility to build the GDG base.

//STEP1    EXEC PGM=IDCAMS,TIME=4
//SYSDUMP  DD  SYSOUT=$
//SYSPRINT DD  SYSOUT=$
//SYSIN    DD  *
 DEFINE GDG -
        (NAME(TEST.OUTPUT.GDGBASE) -
        SCRATCH -
        NOEMPTY-
        LIMIT(03))
Now we are creating the versions of the GDG and lets see what happens.

//STEP2  EXEC PGM=IEFBR14
//MODEL1 DD   DSN=TEST.OUTPUT.GDGBASE(+1),
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(TRK,(100,100),RLSE),
//            DCB=(LRECL=80,RECFM=FB,BLKSIZE=800)

On submitting this job 3 times, we will get something like this

TEST.OUTPUT.GDGBASE
TEST.OUTPUT.GDGBASE.G0001V00
TEST.OUTPUT.GDGBASE.G0002V00
TEST.OUTPUT.GDGBASE.G0003V00
Now if we submit and create one more version, it will be  TEST.OUTPUT.GDGBASE.G0004V00
We will see that TEST.OUTPUT.GDGBASE.G0001V00 is no more there in the system. It has been DELETED and UNCATLG ed . Its expcted because we defined it with SCRATCH

The NOEMPTY parameter specifies that when the three (3) generation limit is reached the oldest generation data set will be deleted. The remaining generation data sets will be retained. An EMPTY parameter specifies that when the limit is reached the three (3) current files will be deleted and the process will start again with the new file. The SCRATCH parameter specifies that the oldest generation data set will be uncataloged and deleted when the generation limit is exceeded.
Default is NOEMPTY/NOSCRATH.

SCRATCH
specifies that the generation data set's DSCB is to be deleted from the volume's VTOC when the generation data set is uncataloged.
NOSCRATCH
specifies that the generation data set's DSCB is not to be removed from the volume's VTOC when the generation data set is uncataloged. 


Other paramters are there but are not so much frequently like
OWNER       ->  For user identification
TO(DATE)   ->  Retention Period
FOR(DATE) ->  Retention Period

"How do we know the characteristics of a GDG from its name" ???
We use IDCAMS to get its definition.

//STEP001U EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN  DD *
    LISTCAT ENTRY('TEST.OUTPUT.GDGBASE') ALL
//*




 

1 comment:

  1. Good info.
    For GDG related interview questions,you can refer
    http://clearmainframeinterview.blogspot.com/

    ReplyDelete