Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

COND parameter at job Card
Goto page 1, 2  Next
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Thu Feb 12, 2009 6:41 pm    Post subject: COND parameter at job Card
Reply with quote

Hi,
In my jcl a have a lot of steps, I want to interrupt the executing if the steps return codes are greater than 4 and not equal to 166.
But coding "IF/THEN/ELSE.." for every step is not practical.

The JCL will execute the next step if RC = 1,2,3,4 and 166. otherwise will terminete the executing. And I want achieve it by the job card.

Is it possible? Thanks.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Feb 12, 2009 6:58 pm    Post subject:
Reply with quote

What about RC = 0?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Thu Feb 12, 2009 6:59 pm    Post subject:
Reply with quote

Unfortunately the COND= checks are ' OR ' checks, so as long as any one condition is met the job will terminate.
Back to top
View user's profile Send private message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Thu Feb 12, 2009 7:00 pm    Post subject:
Reply with quote

Yes, sorry. 0 means not error.
The JCL will execute the next step if RC = 0,1,2,3,4 and 166.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Fri Feb 13, 2009 12:09 am    Post subject:
Reply with quote

How many is "a lot of steps"? It might be better to bite the bullet now rather than force others to deal with the reverse logic of COND statements.
Back to top
View user's profile Send private message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Fri Feb 13, 2009 12:24 pm    Post subject:
Reply with quote

There are 15, 20 setps in a JCL.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Sat Feb 14, 2009 12:23 pm    Post subject:
Reply with quote

With ISPF's editing capabilities, it would take less than 20 minutes to insert 20 IF/THEN/ENDIF statements in a JCL. Why is this not practical?
Back to top
View user's profile Send private message
parsesource

New User


Joined: 06 Feb 2006
Posts: 97

PostPosted: Sun Feb 15, 2009 1:18 am    Post subject: Re: COND parameter at job Card
Reply with quote

ozgurseyrek wrote:
Hi,
In my jcl a have a lot of steps, I want to interrupt the executing if the steps return codes are greater than 4 and not equal to 166.
But coding "IF/THEN/ELSE.." for every step is not practical.

The JCL will execute the next step if RC = 1,2,3,4 and 166. otherwise will terminete the executing. And I want achieve it by the job card.

Is it possible? Thanks.


try this using a single IF
Code:

//... JOB ...
// IF  (RC LE 4 OR  RC EQ 166) THEN
// all your steps
// ENDIF
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sun Feb 15, 2009 12:24 pm    Post subject:
Reply with quote

Hi,

has this been tested or is it just a stab in the dark
Code:
//... JOB ...
// IF  (RC LE 4 OR  RC EQ 166) THEN
// all your steps
// ENDIF


Gerry
Back to top
View user's profile Send private message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Sun Feb 15, 2009 1:40 pm    Post subject:
Reply with quote

"IF/ENDIF" doesn't work I think, because if any of my steps in "IF/ENDIF" clause return greater than 4 RC, the JCL will run the next step.

I will type COND parameter for each step.
Code:
COND=((166,EQ,STEP1),(4,LT))


thanks.
Back to top
View user's profile Send private message
parsesource

New User


Joined: 06 Feb 2006
Posts: 97

PostPosted: Sun Feb 15, 2009 2:42 pm    Post subject:
Reply with quote

you donĀ“t believe me? try this

Code:

// ... Job ...
// IF (RC=0) THEN
//STEP1 EXEC PGM=IDCAMS        => creates RC=12
//STEP2 EXEC PGM=IEFBR14
// ENDIF


STEP2 will be flushed. RC (= max-RC of all previous steps) will be evaluated at every step.

i was very surprised too, when i first saw this behaviour. the jcl-reference
is not clear about this
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Sun Feb 15, 2009 3:33 pm    Post subject:
Reply with quote

parsesource wrote:
the jcl-reference is not clear about this
RC (= max-RC of all previous steps) will be evaluated at every step.
This is what I could in find in the same manual.

"An IF statement specified before the first EXEC statement in a job is not evaluated before the first step executes. If the IF statement applies to later steps in the job, the statement will be evaluated when the system decides whether to process the later steps."

Hence in your example if you had 4 steps and if the 2nd step had an RC=12, still the remaining steps would still be executed. But if the first step returns an non-zero-RC then all the remaining steps would be bypassed.
ozgurseyrek wrote:
I will type COND parameter for each step.
Why not code the same in your JOB statement instead?
Back to top
View user's profile Send private message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Sun Feb 15, 2009 4:11 pm    Post subject:
Reply with quote

Answer to parsesource;

Code:
// ... Job ...
// IF (RC=0) THEN
//STEP1 EXEC PGM=IDCAMS        => creates RC=12
//STEP2 EXEC PGM=IEFBR14
// ENDIF


at that code sample IF STEP1 creates RC=12, STEP2 is executing.
(Check that you are not using COND parameter at JOB card)
Back to top
View user's profile Send private message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Sun Feb 15, 2009 4:16 pm    Post subject:
Reply with quote

Answer to arcvns;
You asked that
"Why not code the same in your JOB statement instead?"
Code:
COND=((166,EQ,STEP1),(4,LT))


I can not type that COND paramaters at the JOB CARD. It is in JCL Error.
I can not use Stepname at Job card CONDitions.
Back to top
View user's profile Send private message
ozgurseyrek

New User


Joined: 22 Feb 2008
Posts: 70
Location: Turkey

PostPosted: Sun Feb 15, 2009 4:20 pm    Post subject:
Reply with quote

New answer to arcvns;
IF you suggesting the use COND parameter at job card likte that;
Code:
COND=((166,NE),(4,LT))


It dosnt't work. For 166 RC, the JCL will terminate because "4,LT" condition item will be true.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Sun Feb 15, 2009 9:56 pm    Post subject:
Reply with quote

Why are you insisting upon using COND instead of the newer and recommended IF/THEN/ELSE/ENDIF construct? Why can't you insert the following 2 statements between each of your 20 steps:
Code:
//     ENDIF
//     IF (RC GE 0001 AND RC LE 0004) OR (RC EQ 0166) THEN
and add an IF before the 1st step and an ENDIF after the last step? Using either a block copy or a copy and paste, this would take very little time to code. This is untested JCL since I don't have mainframe access.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2158
Location: @my desk

PostPosted: Sun Feb 15, 2009 10:01 pm    Post subject:
Reply with quote

ozgurseyrek,

I dint really see your condition codes. May be you'll have to use the posted IF/THEN approach.
Back to top
View user's profile Send private message
parsesource

New User


Joined: 06 Feb 2006
Posts: 97

PostPosted: Tue Feb 17, 2009 2:50 am    Post subject:
Reply with quote

arcvns wrote:
parsesource wrote:
the jcl-reference is not clear about this
RC (= max-RC of all previous steps) will be evaluated at every step.
This is what I could in find in the same manual.

"An IF statement specified before the first EXEC statement in a job is not evaluated before the first step executes. If the IF statement applies to later steps in the job, the statement will be evaluated when the system decides whether to process the later steps."

Hence in your example if you had 4 steps and if the 2nd step had an RC=12, still the remaining steps would still be executed. But if the first step returns an non-zero-RC then all the remaining steps would be bypassed.
ozgurseyrek wrote:
I will type COND parameter for each step.
Why not code the same in your JOB statement instead?


you are right. the reason for my wrong assumption is a misleading statement in the JCL Reference "Note: At the start of execution, RC is initially set to zero."

Because of this I thought, that before execution of STEP1 the "IF RC=0" statement evaluates to TRUE. So bypassing of STEP2 could only happen because RC is reevaluated within IF,ENDIF
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Tue Feb 17, 2009 3:13 am    Post subject:
Reply with quote

To get around the JCL rule that the RC is always zero prior to executing the 1st step, 2 options are possible:
    1. Do not enclose the 1st step with an IF/ENDIF statement or
    2. Include 0000 as an acceptable RC for executing step 1.
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1238
Location: Richfield, MN, USA

PostPosted: Tue Feb 17, 2009 3:14 am    Post subject:
Reply with quote

P.S. A 3rd option is to exec an IEFBR14 as the 1st step in the job.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts How to display value of an exit param... lind sh CICS 2 Sun Oct 09, 2016 12:28 pm
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts how to DYNAMICALLY write sort cond to... mohamedmubee COBOL Programming 13 Fri Aug 26, 2016 11:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us