Page 1 of 1

need to check a GDG generation is present in catalog or not

Posted: Wed Sep 05, 2007 5:54 pm
by dgkarthik.mfs
Hi every one,

I have a job JOB1 in which a GDG generation is created.This generation triggers an another job JOB2. In the JOB2 this generation is taken as backup and it is deleted.

the issue is.......................

JOB1 has been triggered twice.In the first run of JOB1 a generation is created and in the second run another generation is created. Each created generation triggers JOB2 .

In the first run of JOB2 the two generations which is created by the two runs of JOB1 has been taken backup and those two generations are deleted. Then for the second run there is no GDG generations to process. So the job is abending with JCLERROR.

So I want to check in the first step of JOB2 whether the GDG has generations or not .Could you plz tell me how can I solve this issue.............................................................

Regards,
Karthik

Posted: Thu Sep 06, 2007 4:19 pm
by agkshirsagar
add this step at appropriate position in your JOB2
//step1 exec pgm=idcams
//sysprint dd sysout=*
//sysin dd *
listcat entries('dataset name')
/*

IDCAMS returns 4 when the dataset does not exists.
Use conditional parameters in further steps to use this..

Posted: Thu Sep 06, 2007 7:16 pm
by dgkarthik.mfs
Hi

Thanks for ur reply.

I tried the samething which u said in ur reply.Its working fine if the generation is not present But its not working if the GDG generation is present.

Its giving RC=12 if the generation is not present and also if it is present.
Even if the generation is present its skiiping the next steps.

Please help me in this issue.

Regards,
Karthik

Posted: Fri Sep 07, 2007 2:28 am
by Veera
Karthik,

Try this...with LISTCAT LEVEL

//PS010 EXEC PGM=IDCAMS
//SYSPRINT DD DUMMY
//SYSOUT DD SYSOUT=*
//SYSIN DD *
LISTCAT LEVEL(DATASET NAME)

The above JCL gives return-code of 0 when you have generations for the dataset
if you do not have any generations it will return 4.

Thanks,
Veera.

Posted: Mon Sep 17, 2007 7:20 pm
by dgkarthik.mfs
Hi Veera,

Many Many Thanks for your reply.

The code which you mentioned is working fine.

Once again Thanks.

Regards,
Karthik D.G.

Posted: Tue Sep 25, 2007 4:53 am
by Veera
Glad we could help Karthik, i appreciate your feedback.

Thanks,
Veera.

Posted: Tue Nov 04, 2014 6:24 pm
by yugandharj
H All,

Any one can tel me how to How to create 5 GDG versions at time.

it means i need to create 5 versions in single step.

Posted: Sat Nov 08, 2014 1:56 pm
by NicC
Why are you tagging onto a topic that is over 7 years old? You shuld know that when you have a new query you should start a new topic.

To create a new version you need to specify the datasetname, generation nmber and version number in full. If, on the other hand, you mean create multiple generations then create them as +1, +2 etc and read up about relative generations in the relevant manuals.