Wednesday, 30 January 2013

GDG : Generation data groups 

In production there are daily, weekly, quarterly, monthly or yearly running jobs, so in order to take BKUP of data, generally we use GDGs, there is no need to provide different names to datasets when you create, system on it's own will take care of it. 

These datasets are chronologically and functionally similar datasets.

Note : Under one GDG base datasets can be created with different combination of record length, record formats.


to create GDG datasets first we need to create GDG base, then GDG dataset can be created.
Maximum 255 datasets can be defined under one GDG base.

1) Create GDG base 

//OZA201AS JOB (GENERAL),'CRE GDG BASE',CLASS=A,   
//         NOTIFY=OZA201                     

//*     
//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT    DD SYSOUT=*
//SYSIN       DD *
DEFINE GDG -
(NAME(XA7384A.GDG.BASE) - 
LIMIT(10) -
NOEMPTY -
SCRATCH -
)
//*

This JCL will create GDG base.


Parameters : 

1) LIMIT - 
It specifies maximum number of datasets that can be created under one GDG base.

2) NOEMPTY - It specifies older version.

3) EMPTY      - It specifies all versions. 
Either EMPTY or NOEMPTY can be used at one time. 

4) SCRATCH - It will delete dataset. 

5) NOSCRATCH - It will uncatalog dataset.  
Either SCRATCH or NOSCRATCH can be used at one time. 

Different combinations - 

LIMIT(10)
NOEMPTY 
SCRATCH
This combination will allow to create maximum 10 datasets when 11th dataset will be created it will delete 1st dataset(Older version). 


LIMIT(10)

NOEMPTY 
NOSCRATCH
This combination will allow to create maximum 10 datasets when 11th dataset will be created it will Uncatalog 1st dataset(Older version). 

LIMIT(10)
EMPTY 
SCRATCH
This combination will allow to create maximum 10 datasets when 11th dataset will be created it will Delete all previous 10 versions. 

LIMIT(10)
EMPTY 
NOSCRATCH
This combination will allow to create maximum 10 datasets when 11th dataset will be created it will Uncatalog all previous 10 versions. 



JCL to create GDG dataset :

//OZA201AS JOB (GENERAL),'CRE GDG DS',CLASS=A,   
//         NOTIFY=OZA201                     
//*     
//STEP1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT    DD SYSOUT=*
//DD1          DD DSN=XX7384A.GDG.BASE(+1),
//                DISP=(NEW,CATLG,DELETE),
//                UNIT=SYSDA,
//                DCB=(LRECL=80,RECFM=FB,BLKSIZE=800),
//                SPACE=(CYL,(2,3))
//* 

here +1 indicates new version,

0 indicates current version
-1 indicates previous version
-2 older then -1 and so on.... 

XA7384A.GDG.BASE              
XA7384A.GDG.BASE.G0001V00     
XA7384A.GDG.BASE.G0002V00
XA7384A.GDG.BASE.G0003V00



Note : GDG dataset will be updated after completion of JCL only. 

No comments:

Post a Comment