MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Checking existence of a dataset in JCL at runtime

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
suhas_pm
Beginner


Joined: 12 Oct 2004
Posts: 3
Topics: 1
Location: Pune

PostPosted: Tue Oct 12, 2004 5:47 am    Post subject: Checking existence of a dataset in JCL at runtime Reply with quote

In a JCL, I want to execute a step on the basis of existence of a particular version of a GDG. How to do this?

e.g. consider that I want to execute STEP020 only if dataset NODE1.NODE2.NODE3.NODE4(-14) exists.

//STEP010 EXEC PGM=ABC
//STEP020 EXEC PGM=XYZ <=== execute this if above dataset exists
//STEP030 EXEC PGM=DEF
//*

Could anyone please suggest any way to do this?
regards,
-Suhas
Back to top
View user's profile Send private message Yahoo Messenger
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Tue Oct 12, 2004 7:49 am    Post subject: Reply with quote

You do realize that if the generation in question does not exist then your job will fail with a JCL error?

You might want to re-consider your requirement and run an IDCAMS LISTCAT to generate a list of all generations of the base:

Code:

//LIST EXEC PGM=IDCAMS
//SYSPRINT DD DSN=&&T1,DISP=(NEW,PASS),...
//SYSIN DD *
  LISTCAT LVL(NODE1.NODE2.NODE3.NODE4)


And then check the contents of &&T1 and go from there...
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Oct 12, 2004 9:22 am    Post subject: Reply with quote

Suhas,

If you can spell out the absolute gdg version number instead of the relative number, then you can simply use LISTCAT to figure out if the dataset existed.

Code:

//STEP0100 EXEC PGM=IDCAMS                       
//SYSPRINT DD SYSOUT=*                           
//INGDG    DD DSN=YOUR.GDG.TEST(-4),           
//            DISP=SHR                           
//SYSIN    DD *                                   
   LISTCAT ENT('NODE1.NODE2.NODE3.NODE4.G0011V00')
/*


The above step will end with a return code of 4.

Now you can check the return code and skip the job.
Code:

//STEP020 EXEC PGM=XYZ,COND=(4,EQ,STEP0100) 


The above approach is not possible with relative gdg number ex(NODE1.NODE2.NODE3.NODE4(-14).

So you need to go with superk's solution.

Hope this helps...

Cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group