GDG Stands for ‘Generation data group’ & is used to catalog a group of datasets that have common and similar data formats, and these datasets can be referenced by relative generation and version number. It is mostly used to take periodic backups of critical data for future reference.
All datasets within GDG share the same name except the last qualifier which is made of generation number and version number. The individual files within a group have a generation number added to the end of the name to make each file name unique. e.g. if the base is “XXXXX.YYYYY.ZZZZZ” then the first file created will be given the name “XXXXX.YYYYY.ZZZZZ.G0001V00″. Subsequent files are named by incrementing the generation number resulting in filenames ending in G0002V00 through G9999V00. Once the G9999V00 is reached the numbering will start again from G0001V00.
The benefits are
Note: Generations are updated only at the end of the job i.e. For any executing job, the current generation remains the same until it ends. If the job abends then the next version is also not created.
In this example 20 is the number of generations to create and keep.
//STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE GDG(NAME(XXXXX.YYYYY.ZZZZZ.GDGVER) - LIMIT(20) - NOEMPTY - SCRATCH) /*
NAME – This parameter is used to specify the name of the data set that is to be created.
LIMIT – This parameter is used to specify the total number of generations that the GDG may contain. The maximum value for LIMIT is 255.
EMPTY/NOEMPTY – These two parameters are mutually exclusive. EMPTY specifies that all existing generations of the GDG are to be uncataloged whenever the generations of GDG reached the maximum limit i.e. let’s say the limit is defined as 5 and we are creating the 6th version. In this case version, 1 will be uncataloged while creating the 6th version. NOEMPTY specifies that only the oldest generation of the GDG is to be uncataloged if the limit is reached i.e. let’s say the limit is defined as 5 and we are creating the 6th version. In this case version, 1 to 5 will be uncataloged while creating the 6th version.
SCRATCH/NOSCRATCH – These two parameters are mutually exclusive. SCRATCH parameter specifies that whenever entry of the GDG is removed from the index, it should be deleted physically and uncataloged. NOSCRATCH parameter specifies that whenever entry of the GDG is removed from the index, it should be uncataloged, not physically deleted.
Once the index has been created, a model data set must be created. This model data set contains specifications for the DCB subparameters for all data sets that will belong to that GDG. Programmers can override these default values if they want.
//STEP010 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE GDG(NAME(XXXXX.YYYYY.ZZZZZ.GDGMODL) - LIMIT(20) - NOEMPTY - SCRATCH) /* //STEP020 EXEC PGM=IEFBR14 //GDGMODEL DD DSN=XXXXX.YYYYY.ZZZZZ.GDGMODL, // DISP=(NEW,KEEP,DELETE), // UNIT=SYSDA, // SPACE=(TRK,15), // DCB=(LRECL=80,RECFM=FB,BLKSIZE=0,DSORG=PS)
//GENGDG EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSIN DD DUMMY //SYSUT1 DD * DATA LINE 1 DATA LINE 2 DATA LINE 3 DATA LINE 4 DATA LINE 5 /* //SYSUT2 DD DSN=XXXXX.YYYYY.ZZZZZ.GDGVER(+1), // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,15), // DCB=XXXXX.YYYYY.ZZZZZ.GDGMODEL
You can create a new generation by using below mentioned JCL.
//COPYLOG EXEC PGM=IEBGENER //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=XXXXX.YYYYY.ZZZZZ.DATA, // DISP=SHR //SYSUT2 DD DSN=XXXXX.YYYYY.ZZZZZ.DATAGDG(+1), // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,15), // DCB=XXXXX.YYYYY.ZZZZZ.GDGMODEL //SYSIN DD DUMMY //SYSOUT DD SYSOUT=* //SYSUDUMP DD SYSOUT=*
As shown below, when we have to use generation data sets associated with the group as a single, contiguous file, we can specify the GDG index name without brackets ().
//STEPNAME EXEC PGM=IDCAMS //SYSPRINT DD * //SYSUT1 DD DSN=XXXXX.YYYYY.ZZZZZ.SALES.MONTHLY, <--Concatenated generations //SYSUT2 DD DSN=XXXXX.YYYYY.ZZZZZ.SALES.MONTHLY.PSBKUP, // DISP=(NEW,CATLG,DELETE), // UNIT=PROD,SPACE=(CYL(2,2),RLSE), // DCB=(LRECL=80,RECFM=FB, // BLKSIZE=0,DSORG=PS) //SYSIN DD * REPRO INFILE(SYSUT1) OUTFILE(SYSUT2) /*
If you need to delete your base & delete the individual data sets (G0001V00, G0002V00, etc.) and then run this IDCAM job to delete the GDG.
If you want to DELETE base, then you can use either DELETE GDG FORCE or DELETE GDG PURGE. You can give any one of these options in IDCAMS utility –
//GDGDLTE EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE (XXXXX.YYYYY.ZZZZZ.GDGVER) GDG FORCE /* //GDGDLTE EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DELETE (XXXXX.YYYYY.ZZZZZ.GDGVER) GDG PURGE /*
If you want to delete a particular Generation of a GDG or simply delete all generations, then –
//GDGDLTE EXEC PGM=IEFBR14 //GDGDEL DD DSN=XXXXX.YYYYY.ZZZZZ.GDGVER(0), // DISP=(OLD,DELETE,DELETE)
//GDGMODDL EXEC PGM=IEFBR14 //GDGMODEL DD DSN=XXXXX.YYYYY.ZZZZZ.GDGMODEL, // DISP=(MOD,DELETE,DELETE), // UNIT=SYSDA, // SPACE=(TRK,0), // DCB=(LRECL=80,RECFM=FB,BLKSIZE=800,DSORG=PS)
This example of a GDG was created with 15 generations of data sets using the LIMIT(15) parameter. If you wish to change the number of generations run this IDCAMS alter example where the number of generations is increased to 50. Use the name in the ALTER statement
//STEP1 EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=A //SYSIN DD * ALTER XXXXX.YYYYY.ZZZZZ.GDGVER - LIMIT(50) - NOEMPTY – SCRATCH /*
For testing purposes or for a production incident resolution/re-run, you might need to use different datasets or GDG versions other than the ones specified in the cataloged procedure. In that case, the dataset in the procedure can be overridden in the JCL as mentioned below where we are overriding (-1) version of XXXXX.YYYYY.ZZZZZ.DATAGDG.
//STEPXX EXEC MYPROC //STEP1.SORTIN DD DSN=XXXXX.YYYYY.ZZZZZ.DATAGDG(-1),DISP=SHR //* //* STEP1 of PROC MYPROC is givenbelow ..... ..... //STEP1 EXEC PGM=SORT //SORTIN DD DSN=XXXXX.YYYYY.ZZZZZ.DATAGDG(0),DISP=SHR //SORTOUT DD DSN= XXXXX.YYYYY.OUTPUT(+1), // DISP=(NEW,CATLG,DELETE),UNIT=3390, // SPACE=(CYL,(5,1)),DCB=(LRECL=22) //SYSOUT DD SYSOUT=* //SYSIN DD * OMIT COND=(5,1,CH,EQ,C'M') SORT FIELDS=(20,8,CH,A,10,3,FI,D) SUM FIELDS=(16,4,ZD) OPTION DYNALLOC,ZDPRINT OUTREC FIELDS=(10,3,20,8,16,4,2Z,5,1,C' SUM') /*
A well-maintained product backlog is crucial for successful product development. It serves as a single…
Incremental value to the customer refers to the gradual delivery of small, functional parts of…
A Product Market refers to the group of potential customers who might be interested in…
The Professional Agile Leadership - Evidence-Based Management (PAL-EBM) certification offered by Scrum.org is designed for…
The Professional Agile Leadership (PAL I) certification, offered by Scrum.org, is designed to equip leaders…
Choosing the right Scrum Master Certification depends on your current experience and career goals. If…