Best Practices - Multpl data in job executes different steps

In this Mainframe Forum - You can post your queries on JCL, OS/390 JCL, MVS JCL, z/OS JCL, JES2 & JES3

Moderators: Frank Yaeger, DikDude, Moderator Group

Post Reply
lnpdavid
Member
Posts: 11
Joined: Tue Apr 28, 2009 8:48 pm
Location: Missouri USA

Best Practices - Multpl data in job executes different steps

Post by lnpdavid » Tue Oct 25, 2011 8:52 pm

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?
David Earhart

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Tue Oct 25, 2011 9:30 pm

We delete all of our work files at the end of the job.
Possibly using temporary datasets would solve the problem. The system automatically deletes temporary data sets at the end of 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

lnpdavid
Member
Posts: 11
Joined: Tue Apr 28, 2009 8:48 pm
Location: Missouri USA

Post by lnpdavid » Wed Oct 26, 2011 2:29 am

DikDude wrote:
We delete all of our work files at the end of the job.
Possibly using temporary datasets would solve the problem. The system automatically deletes temporary data sets at the end of 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.
I tried the second method but it did not seem to work.

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

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Wed Oct 26, 2011 2:53 am

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
Last edited by DikDude on Thu Nov 10, 2011 10:53 pm, edited 1 time in total.
Have a good one

lnpdavid
Member
Posts: 11
Joined: Tue Apr 28, 2009 8:48 pm
Location: Missouri USA

Post by lnpdavid » Thu Nov 10, 2011 10:16 pm

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!
David Earhart

DikDude
Moderator
Posts: 1001
Joined: Fri Jul 22, 2011 8:39 am
Location: usa

Post by DikDude » Thu Nov 10, 2011 10:55 pm

Good to hear it is working - thanks for letting us know :)

dd

Post Reply

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



Other References
Mainframe Tools and others