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 

JCL to check if a file exists

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


Joined: 18 Feb 2004
Posts: 2
Topics: 1

PostPosted: Wed Feb 18, 2004 4:35 pm    Post subject: JCL to check if a file exists Reply with quote

I'm creating a job that runs when 2 input files exist. The problem is one of the files will not always be there. I need to figure out a way in the JCL to check if a file is cataloged already without blowing up with a nocatlog2 error and if it isn't, create an empty file and if it is go to the next step. Any ideas?
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: Wed Feb 18, 2004 5:37 pm    Post subject: Reply with quote

aportoni,

Code a IEFBR14 step with disp=mod prior to your actual processing step.If the dataset exist it will continue or else it will allocate a new dataset

Code:

//STEP0100 EXEC PGM=IEFBR14
//*
//FILE01    DD DSN=YOUR MISSING FILE,
//             DISP=(MOD,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(TRK,(1,1),RLSE),
//             DCB=(LRECL=ZZZ,RECFM=FB,BLKSIZE=0)
//*


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


Joined: 18 Feb 2004
Posts: 2
Topics: 1

PostPosted: Wed Feb 18, 2004 6:01 pm    Post subject: Reply with quote

Outstanding!!! Works like a charm. Very Happy Very Happy Very Happy

Thanks,
Tony
Back to top
View user's profile Send private message
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