Generation Data Groups (GDG)

1.9k views Asked by At

If a (+1) generation dataset is created in the first step of a job, how can it be referenced in later steps of the same job for input?

2

There are 2 answers

1
Gilbert Le Blanc On

Once the job step creating the (+1) generation data group (GDG) file has completed, the most recent GDG file is (+1).

The current GDG does not become zero until after the job ends or abends.

Here's an example from one of our batch jobs.

//STEP05   EXEC PGM=OUTBOUND,REGION=4M,TIME=60                
//STEPLIB  DD  DSN=M5.M593CLLV.LOAD,DISP=SHR                  
//SYSTCPD  DD  DSN=M5.M51TCDLV.IBM.TCPPARMS(TCPDATA),DISP=SHR 
//INDD1    DD  DSN=J3.J3DVLP.W.J1PPB70.RDEXFILE(+1),DISP=OLD  
//OBNSTAT  DD  DSN=J3.J3PZOUTB.DVLP.OBNSTAT,DISP=SHR         
//SYSPRINT DD  SYSOUT=*                                 
//SYSUDUMP DD  SYSOUT=*                                
//SYSIN    DD  DUMMY       

This is generally not a good practice, as restarting after an abend becomes difficult. You have to change all of the GDG (+1) to (+0) or (0).

Better practice is to create an ordinary file to use throughout the job. Then, in your last job step, you copy the ordinary file into the GDG (+1).

0
JackCColeman On

Sometimes on large datasets you don't want to repeat your I/Os, but you still want to be able to restart a job. Batch schedulers (CA7?) can keep track for you.

However, if managing your own job streams, then (and it has been awhile since I've coded JCL), so this is a very general example:

//         PROC RSTART="+1"
//* other job steps
//STEP05   EXEC PGM=OUTBOUND,REGION=4M,TIME=60              
//STEPLIB  DD  DSN=M5.M593CLLV.LOAD,DISP=SHR                  
//SYSTCPD  DD  DSN=M5.M51TCDLV.IBM.TCPPARMS(TCPDATA),DISP=SHR 
//INDD1    DD  DISP=OLD,DSN=J3.J3DVLP.W.J1PPB70.RDEXFILE(&RSTART)  <<<RSTART 
//OBNSTAT  DD  DSN=J3.J3PZOUTB.DVLP.OBNSTAT,DISP=SHR         
//SYSPRINT DD  SYSOUT=*                                 
//SYSUDUMP DD  SYSOUT=*                                
//SYSIN    DD  DUMMY     

When resubmitting this job, set RSTART="0", etc.