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

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
dgkarthik.mfs
Member
Posts: 6
Joined: Wed Sep 05, 2007 5:28 pm

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

Post by dgkarthik.mfs » Wed Sep 05, 2007 5:54 pm

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

agkshirsagar
Member
Posts: 2
Joined: Fri Aug 25, 2006 12:15 pm

Post by agkshirsagar » Thu Sep 06, 2007 4:19 pm

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..

dgkarthik.mfs
Member
Posts: 6
Joined: Wed Sep 05, 2007 5:28 pm

Post by dgkarthik.mfs » Thu Sep 06, 2007 7:16 pm

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

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Fri Sep 07, 2007 2:28 am

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.

dgkarthik.mfs
Member
Posts: 6
Joined: Wed Sep 05, 2007 5:28 pm

Post by dgkarthik.mfs » Mon Sep 17, 2007 7:20 pm

Hi Veera,

Many Many Thanks for your reply.

The code which you mentioned is working fine.

Once again Thanks.

Regards,
Karthik D.G.

Veera
Moderator
Posts: 111
Joined: Wed Feb 22, 2006 2:59 pm

Post by Veera » Tue Sep 25, 2007 4:53 am

Glad we could help Karthik, i appreciate your feedback.

Thanks,
Veera.

yugandharj
Member
Posts: 4
Joined: Thu Jan 23, 2014 6:20 pm

Post by yugandharj » Tue Nov 04, 2014 6:24 pm

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.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Sat Nov 08, 2014 1:56 pm

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.
Regards
Nic

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others