Background Information:
My input data contains three different types of data that executes different steps. For example:
Step: Data and/or Function?
1-4: All data - puts data into one of three DSNs
5-8: Processes data type 1 (with step 5 being an IDCAMS to
determine is there is any of this data type)
9-12: Processes data type 2 (with step 9 being an IDCAMS to
determine is there is any of this data type)
13-16: Processes data type 3 (with step 13 being an IDCAMS to
determine is there is any of this data type)
End of Job: Delete all work files using IEFBR14
Because I use IDCAMS to see if there's any data in the various files it will occasionally throw a return code of 4 if no data is present. I use the IF command in the JCL to process the applicable steps.
My Issue: We delete all of our work files at the end of the job. Because some steps are not executed (e.g. no data type 2 causes step 9 to give a return code of 4 and steps 10-12 are not executed) those work files are not there to delete. How can I setup the delete step(s) to delete the various combinations of files that might exist?
Best Practices - Multpl data in job executes different steps
Moderators: Frank Yaeger, DikDude, Moderator Group
Possibly using temporary datasets would solve the problem. The system automatically deletes temporary data sets at the end of job.We delete all of our work files at the end of the job.
Otherwise, set up a last step that executes IEFBR14 and have a dd statement for each work file. Use DISP=(MOD,DELETE,DELETE) for each of these dd statements. If the dataset exists, it will be deleted. If it does not exist, it will be created and deleted.
Either way will get rid of everything with no decisions made along the way making understanding and maintenance easier.
Have a good one
I tried the second method but it did not seem to work.DikDude wrote:Possibly using temporary datasets would solve the problem. The system automatically deletes temporary data sets at the end of job.We delete all of our work files at the end of the job.
Otherwise, set up a last step that executes IEFBR14 and have a dd statement for each work file. Use DISP=(MOD,DELETE,DELETE) for each of these dd statements. If the dataset exists, it will be deleted. If it does not exist, it will be created and deleted.
Either way will get rid of everything with no decisions made along the way making understanding and maintenance easier.
Here's the DD statement in the non-executed step:
140 //PRTOUT2 DD DSN=DAE142.TST.DOWNLOAD.EP.BATCHES.TXT,
// UNIT=TSTWRK,
// AVGREC=K,
// SPACE=(132,(5,1),RLSE),
// DCB=(RECFM=FBA,LRECL=132),
// DISP=(NEW,CATLG,DELETE)
Here's the delete:
476 //DDNAME15 DD DSN=DAE142.TST.DOWNLOAD.EP.BATCHES.TXT,
// DISP=(MOD,DELETE,DELETE)
Here's the error:
IEF344I DAE142TS STEP99 DDNAME15 - ALLOCATION FAILED DUE TO DATA FACILITY SYSTE
IGD17045I SPACE NOT SPECIFIED FOR ALLOCATION OF DATA SET
DAE142.TST.DOWNLOAD.EP.BATCHES.TXT
David Earhart
You need to read up on how to allocate a dasd dataset. . .
You will probably need at least a SPACE (TRK,0), a UNIT specification, and possibly a DATACLAS depending on the rules at your site.
Typo corrected
You will probably need at least a SPACE (TRK,0), a UNIT specification, and possibly a DATACLAS depending on the rules at your site.
Typo corrected
Last edited by DikDude on Thu Nov 10, 2011 10:53 pm, edited 1 time in total.
Have a good one
As suggested and per our sites standards I put in the following DD for each file (of course, unique for each file):
//DDNAME33 DD DSN=DAE142.TST.AR4101DL.WORK.AR412702,
// UNIT=TSTWRK,
// AVGREC=U,
// SPACE=(150,(1000,200),RLSE),
// DCB=(RECFM=FB,LRECL=150),
// DISP=(MOD,DELETE,DELETE)
In this way, if the file didn't exist it would still define it and then immediately delete it. If it did exist it would "modify" it and them immediately delete it.
Thanks for the suggestions - it worked!
//DDNAME33 DD DSN=DAE142.TST.AR4101DL.WORK.AR412702,
// UNIT=TSTWRK,
// AVGREC=U,
// SPACE=(150,(1000,200),RLSE),
// DCB=(RECFM=FB,LRECL=150),
// DISP=(MOD,DELETE,DELETE)
In this way, if the file didn't exist it would still define it and then immediately delete it. If it did exist it would "modify" it and them immediately delete it.
Thanks for the suggestions - it worked!
David Earhart
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
- Cobol Interview Questions
50+ Interview Questions - JCL Interview Questions
50+ Interview Questions - DB2 Interview Questions
100+ Interview Questions - CICS Interview Questions
70+ Interview Questions - VSAM Interview Questions
27 Interview Questions
Other References
Mainframe Tools and others
- XPEDITER Reference
Explains how we can debug a program - FILEAID Reference
Explains how to browse , edit and delete datasets - Change Man Reference
Quick Start tutorial on Changeman - Abend Reference
Important Abend codes explained - FaceBook Page
MainframeGurukul FaceBook Page - LinkedIn Page
MainframeGurkul Linkedin Page