COND codes, if any of above step fails then execute laststep

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
megba
Member
Posts: 1
Joined: Thu Apr 03, 2014 6:55 pm

COND codes, if any of above step fails then execute laststep

Post by megba » Thu Apr 03, 2014 7:01 pm

Hi,

If I have a job with 5 steps, step01.. thru step05.
I want to run step05 only when any of the above steps (step01 thru step04) completes with RC > 8. As step05 is the step which will send out error-notification email.
What condition I must put at step05 ?

I tried to seek help from IBM team, but they suggested me to use IF-Else statements.
Is it possible to run with step level condition codes only?
Please help.

Many thanks!

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Fri Apr 04, 2014 1:11 am

Why not IF? It is clearer and easy to code. You only need one IF and that is immediately before your STEP05.
Otherwise look in the JCL manual and do a few experiments to check your understanding. A few IEFBR14 or IDCAMS steps would do fine although a little program that will take a parameter to use as a return code would be better.
Regards
Nic

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

Post by DikDude » Sun Apr 06, 2014 5:14 am

Is it possible to run with step level condition codes only?
Definitely. We used cond codes for Many years before IF/THEN was implemented in JCL.

One thing I Always have available is a step that will do nothing but generate a condition code that can be used for testing. Make sure the code is taken as input and NOT hardcoded.

Then run a few steps and learn what happens.

Someone will be here if you have questions/problems.
Have a good one

dhiraj
Member
Posts: 48
Joined: Tue May 06, 2014 11:22 am

Post by dhiraj » Wed May 07, 2014 12:05 pm

Depends on requirement.

to execute desired step you need to SET the RC if previous steps abended.

and if your next step using previous step's out file then you also need to create empty file for this with if-else.

Thanks
--Dhiraj

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