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 

How to know the existence of a file thru a JCL

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
Milind
Beginner


Joined: 29 Dec 2004
Posts: 26
Topics: 20

PostPosted: Tue Jun 14, 2005 4:13 am    Post subject: How to know the existence of a file thru a JCL Reply with quote

Hi All,

I have a query regarding dataset existence:

How can I know whether a dataset exists or not in a JCL? Based on this I will decide my DISP parameter. Either new or old.

Thanks in advance.

Milind Deshmukh.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Jun 14, 2005 5:23 am    Post subject: Reply with quote

Milind,

You can use IDCAMS REPRO to figure out if the dataset exists and if exists if it was empty or not by using the following JCL

Code:

//*********************************
//* RC=0 - DATASET HAS RECS      **
//* RC=4 - DATASET EMPTY         **
//* RC=12 - DATASET NOT FOUND    **
//*********************************
//STEP0100 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
  PRINT IDS(YOUR.DATA.SET) CHARACTER COUNT(1)
/*


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
Milind
Beginner


Joined: 29 Dec 2004
Posts: 26
Topics: 20

PostPosted: Tue Jun 14, 2005 5:37 am    Post subject: Reply with quote

THANKS KOLUSU.

Cheers,

Milind Deshmukh.
Back to top
View user's profile Send private message Send e-mail
nevilh
Beginner


Joined: 11 Aug 2004
Posts: 115
Topics: 0

PostPosted: Tue Jun 14, 2005 5:48 am    Post subject: Reply with quote

If you have already submitted the job how will you change the disposition
the decision has already been made
Back to top
View user's profile Send private message
Bill Dennis
Advanced


Joined: 03 Dec 2002
Posts: 579
Topics: 1
Location: Iowa, USA

PostPosted: Tue Jun 14, 2005 10:12 am    Post subject: Reply with quote

Your JCL would have multiple execution paths (NEW or OLD) based on the CCODE from the IDCAMS step. See the IF,THEN logic for JCL.
_________________
Regards,
Bill Dennis

Disclaimer: My comments on this foorum are my own and do not represent the opinions or suggestions of any other person or business entity.
Back to top
View user's profile Send private message
nevilh
Beginner


Joined: 11 Aug 2004
Posts: 115
Topics: 0

PostPosted: Tue Jun 14, 2005 10:17 am    Post subject: Reply with quote

Fine for Jes2 . Jes3 will give you an error
Back to top
View user's profile Send private message
semigeezer
Supermod


Joined: 03 Jan 2003
Posts: 1014
Topics: 13
Location: Atlantis

PostPosted: Tue Jun 14, 2005 3:23 pm    Post subject: Reply with quote

Why not just have an IEFBR14 step that uses DISP=MOD (which will allocate the file if it does not exist, and do nothing if it does), then use DISP=OLD in the subsequent step(s). That is how this is normally done, as far as I know.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) 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