Creating Generation Data Groups

There are two main ways to set up a GDG:

The following example illustrates a job that can be used to create a generation data group. STEP00 creates the GDG base and STEP01 creates five new GDG generations.

//MFIDMFGD JOB 'MFIDMFGD',CLASS=A,MSGCLASS=A,NOTIFY=MFIDF
//STEP00 EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//AMSDUMP DD SYSOUT=*
//SYSIN DD *
DELETE MFIDMF.TEST.GDG
DEFINE GENERATIONDATAGROUP(NAME(MFIDMF.TEST.GDG) 
       EMPTY NOSCRATCH LIMIT(96))/*
//STEP01 EXEC PGM=IEFBR14
//SYSUXX DD DSN=MFIDMF.TEST.GDG(+1),DISP=(NEW,CATLG),SPACE=(TRK,(5,2))
//SYSUXY DD DSN=MFIDMF.TEST.GDG(+2),DISP=(NEW,CATLG),SPACE=(TRK,(5,2))
//SYSUXZ DD DSN=MFIDMF.TEST.GDG(+3),DISP=(NEW,CATLG),SPACE=(TRK,(5,2))
//SYSUXA DD DSN=MFIDMF.TEST.GDG(+4),DISP=(NEW,CATLG),SPACE=(TRK,(5,2))
//SYSUXB DD DSN=MFIDMF.TEST.GDG(+5),DISP=(NEW,CATLG),SPACE=(TRK,(5,2))

Five generations named MFIDMF.TEST.GDG.G0001V00, MFIDMF.TEST.GDG.G0002V00, MFIDMF.TEST.GDG.G0003V00, MFIDMF.TEST.GDG.G0004V00 and MFIDMF.TEST.GDG.G0005V00 are created by STEP01.

A generation can be processed by its relative number, its actual reference or as a part of the entire generation data group. For example, each of the following statements could be executed after running the previous job.

//SYSUT1 DD DSN=MFIDMF.TEST.GDG,DISP=SHR

This would cause the entire generation data group MFIDMF.TEST.GDG, consisting of a set of concatenated data sets MFIDMF.TEST.GDG.G0001V00 through MFIDMF.TEST.GDG.G0005V00, to be referenced.

//SYSUT1 DD DSN=MFIDMF.TEST.GDG(0),DISP=SHR

The relative number 0 would cause the data set named MFIDMF.TEST.GDG.G0005V00 to be referenced.

//SYSUT1 DD DSN=MFIDMF.TEST.GDG(-1),DISP=SHR

The relative number -1 would cause the data set named MFIDMF.TEST.GDG.G0004V00 to be referenced.

//SYSUT1 DD DSN=MFIDMF.TEST.GDG(+1),DISP=SHR

The relative number +1 would cause a new data set named MFIDMF.TEST.GDG.G0006V00 to be referenced.

//SYSUT1 DD DSN=MFIDMF.TEST.GDG.G0003V00,DISP=SHR

The actual reference G0003V00 would cause the data set named MFIDMF.TEST.GDG.G0003V00 to be referenced.

The increment of numbers occurs per job, so if you had two consecutive steps that referenced +1, then each step would be using the same data set.