Page 1 of 1

Question on GDG.

Posted: Fri Apr 18, 2014 2:11 pm
by durga
Hi,

I have faced the following question in aninterview.

There are 6 steps in my JCL.

Step01 creates a new GDG.

Step02 creates another generation of GDG.

Step03 deletes the generation created in Step02.

In Step04, we need to access the generation created in Step01.

The question was should I put (0) or (+1) to refer the generation created in Step01 in Step04?

In Step05 I am creating one more generation of same GDG. How should this be mentioned, (+2) or (+1) ?

I could not answer this question well, can someone please guide.

Re: Question on GDG.

Posted: Fri Apr 18, 2014 4:44 pm
by zprogrammer
I am sorry

Your question is not so clear

Step 01 creates a GDG dataset or a new generation for a GDG?

Re: Question on GDG.

Posted: Fri Apr 18, 2014 7:35 pm
by Robert Sample
Assuming that the GDG base exists and your JCL is adding generations using relative numbers, remember that the JCL Reference manual explicitly tells you to code the SAME reference throughout your JCL for the same generation. Hence the generation you create in step 1 is referred to as (+1) throughout your entire job; the generation created in step 2 will be (+2) throughout the entire job. It would be a VERY BAD coding practice to delete a generation in the same job that creates it. I would have to experiment to see if the generation created in step 5 would be referenced as (+2) or as (+3) -- I don't know and won't speculate.

Re: Question on GDG.

Posted: Sun Apr 27, 2014 3:52 pm
by durga
Pandora-Box wrote:I am sorry

Your question is not so clear

Step 01 creates a GDG dataset or a new generation for a GDG?
Generation of GDG.

Re: Question on GDG.

Posted: Sun Apr 27, 2014 3:53 pm
by durga
Thanks Robert.

Re: Question on GDG.

Posted: Mon Apr 28, 2014 11:38 pm
by Anuj Dhawan
Below, after "--" is the answer for different steps, please have a look:

Step01 creates a new GDG. -- (+1)

Step02 creates another generation of GDG. -- (+2)

Step03 deletes the generation created in Step02. -- (+2)

In Step04, we need to access the generation created in Step01. -- (+1)

The question was should I put (0) or (+1) to refer the generation created in Step01 in Step04? -- (+1)

In Step05 I am creating one more generation of same GDG. How should this be mentioned, (+2) or (+1) ? -- it can not be (+1) but if the only choices are (+1) and (+2) - I'd choose (+2)*. I'm not sure if it was the hint from interviewer so I'll inquire.

* - I'm not sure if JES2/3 will play some role here; I'll study and let you know - I can't really test it as I'm "virtually Job less" at the moment.

Re: Question on GDG.

Posted: Tue Apr 29, 2014 12:26 am
by Anuj Dhawan
I thought that the answer might differ from JES2 to JES3, though it does not matter:
Relative Generation Numbers

When creating a generation data set, the relative generation number tells the system whether this is the first data set being added during the job, the second, the third, etc. When retrieving a generation data set, the relative generation number tells the system how many data sets have been added to the group since this data set was added.

The first time you use a relative generation number for a generation data group within a job, the system establishes the relationship between the relative generation number and the absolute generation number. The system maintains this relationship throughout the job.

For example, if you create a generation data set with a relative generation number of (+1), the system recognizes any subsequent reference to (+1) throughout the job as having the same absolute generation number.

Relative generation numbers are obtained from the catalog as it existed:

* For JES2, at the beginning of the first step that specifies the generation data set by relative generation number.

Note: In a shared DASD environment, if two or more jobs running on different systems simultaneously create new generations of the same data set, one of the jobs could fail with a JCL error.

* For JES3, when the job is set up, and again by the system at the beginning of the first step that specifies the generation data set by relative generation number. If the most recent data set is not the same at both times, the results are unpredictable.
So now it's clear that it does not matter when the generation is cataloged (in JES2 or 3), the first reference to a relative generation number fixes the sequence for the entire job! Since the relative numbers were fixed at the time of first reference, the generation cataloged in step 5 should be (+3) even though generations (+2) was deleted in previous step.

Re: Question on GDG.

Posted: Wed Apr 30, 2014 3:51 pm
by durga
Really appreiciate your reply Anuj. It's more than what I've expected. :)

Thanks again.

Re: Question on GDG.

Posted: Wed Apr 30, 2014 4:51 pm
by Anuj Dhawan
You're welcome and Good Luck for the coming interviews! :)

Re: Question on GDG.

Posted: Fri May 02, 2014 2:46 am
by nicc
After a few tests...starting with a new GDG base so no generations yet:
step 1: create +1 creates G0001V00
step 2: create +2 creates G0002V00
step 3: delete +2 (now left with #1)
step 4: create +2 creates G0002V00
DSLIST shows #1 and #2
Second test:
step 1: create +1 creates G0003V00
step 2: create +2 creates G0004V00
step 3: delete +2 (now left with #1, #2 and #3)
step 4: create +3 creates G0005V00
DSLIST shows #1, #2, #3 and #5

So...you can create +2, delete it and recreate it all within the same job and it will create the same generation number
and...you can create +2 and delete it and then create +3 and you will have different generation numbers for +2 and +3.

Re: Question on GDG.

Posted: Wed Dec 02, 2015 3:19 pm
by durga
nicc wrote:After a few tests...starting with a new GDG base so no generations yet:
step 1: create +1 creates G0001V00
step 2: create +2 creates G0002V00
step 3: delete +2 (now left with #1)
step 4: create +2 creates G0002V00
DSLIST shows #1 and #2
Second test:
step 1: create +1 creates G0003V00
step 2: create +2 creates G0004V00
step 3: delete +2 (now left with #1, #2 and #3)
step 4: create +3 creates G0005V00
DSLIST shows #1, #2, #3 and #5

So...you can create +2, delete it and recreate it all within the same job and it will create the same generation number
and...you can create +2 and delete it and then create +3 and you will have different generation numbers for +2 and +3.
Thanks for the reply nicc. I did not notice your reply. But in your reply where is #4? Should the step4 be creating #4 instead #5?

Re: Question on GDG.

Posted: Wed Dec 02, 2015 7:54 pm
by nicc
No, because it is creating +3 - not +2. These are all relative to the catalog entries at the start of the job, The catalog is not updated until step end.
Why not try it out yourself?

Re: Question on GDG.

Posted: Thu Dec 10, 2015 12:33 pm
by durga
Thanks nicc. Tried it and I think I understand it better now. Will do some more tests.