- Before you can create a GDG data set you have to define a GDG index. You do this with IDCAMS, us nearly extinct dinosaurs might do this using IEHPROGM, or as a valid, though infrequently used method, from the TSO READY prompt using DEFINE GDG(NAME(...) ...). The DEFINE command, whether it is entered in TSO or in batch using IDCAMS have the same syntax.
DEFINE GENERATIONDATAGROUP(NAME(GDG name)
EMPTY | NOEMPTY
SCRATCH | NOSCRATCH
LIMIT(n)
EXTENDED | NOEXTENDED
FIFO | LIFO )
The defaults are underlined. You can use GDG rather than GENERATIONDATAGROUP.
At a minimum you must enter two parameters and their related keywords: the GDG name and the maximum number of data sets to catalog in the GDG index.
Originally, a GDG index was limited to 256 data sets. Now you can specify a larger limit, up to 999, when you also specify the EXTENDED option.
The FIFO and LIFO option specifies the order in which the data sets cataloged in a GDG appear when you list the entire index. The default goes back to OS/360.
EMPTY directs the system to delete every data set in the GDG index when the index is at its limit and there is a requirement to add a new generation to the GDG index. - You create new data set in a GDG index by specifying a positive relative index - typically (+1) in JCL.
//NEWGDG DD DSN=GDGindex(+1),DISP=(NEW,CATLG),... - You can retrieve GDG data sets in JCL by specifying its relative index as either (0) or as (-n).You cannot use relative indexes in TSO. They can be used in FTP, though with extreme care. The FTP issues are beyond the scope of this post.//OLDGDG DD DSN=GDGindex(0),DISP=OLD
In JCL, a relative GDG maps to its corresponding data set at the time the job started. It does not change. For example, in step B in this JCL, relative generation (0) is the same data set as it was when the job started//A EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD ...
//SYSUT2 DD DSN=GDGindex(+1),DISP=(NEW,CATLG),...
//SYSIN DD DUMMY
//B EXEC PGM=COMPARE
//SYSPRINT DD SYSOUT=*
//NEWDS DD DSN=GDGindex(+1),DISP=OLD
//OLDDS DD DSN=GDGindex(0),DISP=OLD
Yes, you can create a partitioned data set in a GDG.
//PDSINGDG DD DSN=GDGindex(+1),DISP=(NEW,CATLG),
// SPACE=(TRK,(primary,secondary),blocks),...
// SPACE=(TRK,(primary,secondary),blocks),...
What you cannot do is specify a member name in the JCL. The sample DD statement might be used with IEBCOPY, but it would not be appropriate for IEBGENER.