Joined: 06 Jun 2008 Posts: 8232 Location: Dubuque, Iowa, USA
(+0) always refers to the current generation. However, if you want to refer to the generation you just created, you must use (+1) to get to it throughout the job; once the job is complete the +1 generation will become the +0 generation.
Joined: 11 Dec 2008 Posts: 59 Location: Pune , India
One thing more to be kept in mind while coding the PRC is to take care of the RESTART instructions in the subsequent steps.
For example , if STEP10 creates a GDG generation ( i.e +1 ) and STEP20 uses this current GDG generation ( i.e +1) then while executing the program if the STEP20 abends and you go for restaring STEP20 then the GDG generation being picked up in the new run will depend on the type of scheduler .
Some scheduler remember the last GDG used in the STEP and hence will use the one last referred in the abended step ( in this case same as the one created in STEP10 ) , however other will try to read +1 generation of the base which will not be there and will cause the job to abend.
So you need to check with the RESTART instruction carefully depending on the scheduler being used.
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
As Debarata mentioned, schedulers will usually handle correctly the generations needed when restarting. If you restart without the aid of a scheduler, one common method is to assign symbolic variables to the generations, e.g., GEN1='(+1)', GEN2='(+2)', GEN3='(+3)', etc. When restarting you can change the gens referenced in your JCL by simply changing GEN1 to '(0)', GEN2 to '(+1)', GEN3 to '(+2)', etc. without changing the body of the JCL. You won't always be subtracting just 1 from the initial number, but you should get the drift. Each gen will be decremented by the same amount in this fashion.