View previous topic :: View next topic |
Author |
Message |
aportoni Beginner
Joined: 18 Feb 2004 Posts: 2 Topics: 1
|
Posted: Wed Feb 18, 2004 4:35 pm Post subject: JCL to check if a file exists |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Wed Feb 18, 2004 5:37 pm Post subject: |
|
|
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 |
|
 |
aportoni Beginner
Joined: 18 Feb 2004 Posts: 2 Topics: 1
|
Posted: Wed Feb 18, 2004 6:01 pm Post subject: |
|
|
Outstanding!!! Works like a charm.
Thanks,
Tony |
|
Back to top |
|
 |
|
|