Question on GDG.

All sort of Mainframes Interview Questions.
Post Reply
durga
Registered Member
Posts: 53
Joined: Mon Jul 01, 2013 3:28 pm

Question on GDG.

Post 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.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

Re: Question on GDG.

Post by zprogrammer »

I am sorry

Your question is not so clear

Step 01 creates a GDG dataset or a new generation for a GDG?
zprogrammer
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1900
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Question on GDG.

Post 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.
durga
Registered Member
Posts: 53
Joined: Mon Jul 01, 2013 3:28 pm

Re: Question on GDG.

Post 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.
durga
Registered Member
Posts: 53
Joined: Mon Jul 01, 2013 3:28 pm

Re: Question on GDG.

Post by durga »

Thanks Robert.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Question on GDG.

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Question on GDG.

Post 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.
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
durga
Registered Member
Posts: 53
Joined: Mon Jul 01, 2013 3:28 pm

Re: Question on GDG.

Post by durga »

Really appreiciate your reply Anuj. It's more than what I've expected. :)

Thanks again.
User avatar
Anuj Dhawan
Founder
Posts: 2816
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

Re: Question on GDG.

Post by Anuj Dhawan »

You're welcome and Good Luck for the coming interviews! :)
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Question on GDG.

Post 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.
Regards
Nic
durga
Registered Member
Posts: 53
Joined: Mon Jul 01, 2013 3:28 pm

Re: Question on GDG.

Post 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?
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Question on GDG.

Post 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?
Regards
Nic
durga
Registered Member
Posts: 53
Joined: Mon Jul 01, 2013 3:28 pm

Re: Question on GDG.

Post by durga »

Thanks nicc. Tried it and I think I understand it better now. Will do some more tests.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”