Page 1 of 2

GDG (+1), DISP=New

PostPosted: Sun Jan 15, 2012 5:34 pm
by reebahs
Hi All,

I have a Query reg GDG`s.

What happens if we use (+1),DISP=New in Step1 and (+1),DISP=New in Step2 ? How many generations will be created for my base ?

Eg:

//Step1 EXEC ..........
//DD1 DD DSN=Base(+1),DISP=(NEW,CATLG,DELETE)
//Step2 EXEC .........
//DD2 DD DSN=Base(+1),DISP=(NEW,CATLG,DELETE)

Thanks,
Reebahs.

Re: GDG

PostPosted: Sun Jan 15, 2012 5:37 pm
by BillyBoyo
One generation will be created for each step that gets a chance to complete successfully.

Re: GDG

PostPosted: Sun Jan 15, 2012 5:44 pm
by reebahs
ThankQ

Reg,
Reebahs.

Re: GDG

PostPosted: Sun Jan 15, 2012 6:14 pm
by nevilh
One generation will be created for each step that gets a chance to complete successfully.
Are you sure ? I have not done this for a while but GDG's always used to be rolled in at JOB end. If this is still the case only one GDG will be created

Re: GDG

PostPosted: Sun Jan 15, 2012 6:33 pm
by BillyBoyo
Now that you say that, nevilh, I am very far from sure. Maybe a "not catlg" or "duplicate dataset" is on the way. Now I will check.

Haven't used GDGs for a while myself, and looking more closely :oops: I've never used them that way. Thanks,

Reebahs, hold that thought, or let us know what happened when you did run it.

Re: GDG

PostPosted: Sun Jan 15, 2012 7:16 pm
by skankatala
reebahs wrote:Hi All,

I have a Query reg GDG`s.

What happens if we use (+1),DISP=New in Step1 and (+1),DISP=New in Step2 ? How many generations will be created for my base ?

Eg:

//Step1 EXEC ..........
//DD1 DD DSN=Base(+1),DISP=(NEW,CATLG,DELETE)
//Step2 EXEC .........
//DD2 DD DSN=Base(+1),DISP=(NEW,CATLG,DELETE)

Thanks,
Reebahs.


Reebhas,

I think you will get a JCL error saying "File already cataloged" at STEP2. If you use the Same GDG base repeatedly in a single job, you should use the generation number like this : +1, +2, +3 ......

If you use +2 in STEP02, then you will get 1 generation for each step.

Regards,
Srikanth K

Re: GDG

PostPosted: Sun Jan 15, 2012 7:50 pm
by steve-myers
1.

The allocation will fail in the second step if the GDG is SMS managed, or if it is not SMS managed, in the second step a dataset will be allocated with the same dataset name as in the first step, but it will not be cataloged.

Re: GDG

PostPosted: Sun Jan 15, 2012 8:13 pm
by steve-myers
I tried this job -
//A       EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD  *
DATA IN FIRST STEP
//SYSUT2   DD  DISP=(,CATLG),UNIT=SYSDA,
//             SPACE=(TRK,1),
//             DSN=XXXXXX.TESTGDG(+1)
//SYSIN    DD  DUMMY
//B       EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD  *
DATA IN SECOND STEP
//SYSUT2   DD  DISP=(,CATLG),UNIT=SYSDA,SPACE=(TRK,1),
//             DSN=XXXXXX.TESTGDG(+1)
//SYSIN    DD  DUMMY
The GDG index existed when the job started, but it was empty, and the datasets are SMS managed. The job failed in the second step with message

IEF286I ... - DISP FIELD INCOMPATIBLE WITH DSNAME

Re: GDG

PostPosted: Mon Jan 16, 2012 8:01 pm
by MrSpock
Of course, the answer is one because of the inevitable JCL error. Why would you want to attempt to create and catalog two datasets with the exact same name?

Re: GDG

PostPosted: Tue Jan 17, 2012 2:46 am
by halfteck
Regarding your question, is it possible you and a colleague were discussing this issue, with no real reason for doing it. As, although i have seen in the very very dim and distant past, where jobs created multiple new generations in the same job. Today i find this extremely unlikely.
But in answer to the errors above. The (+1) becomes (0) at END of JOB, not end of step, even though it can be catalogued earlier.
The 'DISP FIELD INCOMPATIBLE WITH DSNAME' is due to the fact that there is already a (+1) in existance, and with a DISP=(NEW,CATLG) you are trying to create something that dfihnately already exists.
I would be very interested to know in what context you consider it a requirement to create 2 or more generatoins of the same GDG base in the same job.