IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to use Branched IF statements in a jcl


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Mon May 25, 2009 6:09 pm
Reply with quote

Hi All


I have a requirement like this. I want to execute a step in a jcl based on the Return code of two different previous steps.

Eg:

IF PS020.RC = 0 THEN

IF PS010.RC = 100 or 200 THEN
execute a different job

ELSE
execute a different job

END-IF
END-IF

Basically the first IF will check for the Emptiness of a file using IDCAMS and the second IF wil check for the Return code a program executed in step PS010( Also i have to check with OR condition in second IF.. is it possible. )

Is this possble in a JCL ?

Please let me if you need any further information

Thanks
Karthik
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Mon May 25, 2009 6:17 pm
Reply with quote

Quote:

IF PS020.RC = 0 THEN

IF PS010.RC = 100 or 200 THEN
execute a different job

ELSE
execute a different job


Do you want to excecute different job or different step in the same job?
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Mon May 25, 2009 6:21 pm
Reply with quote

Ofcourse,, want to execute a different step which wil executes a program and a subsequent step which wil load a job in jobtrac..
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Mon May 25, 2009 6:27 pm
Reply with quote

you can use like this.

IF (PS010R.RC=0100 OR PS010R.RC=0200 OR PS010R.RC=0)

execute your step


ENDIF ......(no hyphen)

similarly you can use AND conditions.
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Mon May 25, 2009 6:42 pm
Reply with quote

Well... the above condition satisfies if either one of the two steps satisfies, but it doesnt suits to my requirement..

Guide me if the following Condition works or not.


IF (PS020.RC=0 AND (PS010.RC=100 OR PS010.RC=200)) THEN

do something

ENDIF

IF (PS020.RC=0 AND (PS010.RC=300 OR PS010.RC=400)) THEN

do something

ENDIF

Thanks
Back to top
View user's profile Send private message
Mathiv Anan

Active User


Joined: 23 Jul 2008
Posts: 106
Location: USA

PostPosted: Mon May 25, 2009 6:51 pm
Reply with quote

what is the problem in it?

you can use it similar to normal if conditions in cobol.

Your above conds will work.
Back to top
View user's profile Send private message
dkarthikreddy

New User


Joined: 14 Mar 2008
Posts: 28
Location: bangalore

PostPosted: Mon May 25, 2009 6:54 pm
Reply with quote

Fine.. I just need the confirmation whether i go can go ahead and use the above condition..Now i wil use it and test it..

Thanks a lot for your valuable reply

Karthik
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Relate COBOL statements to EGL statement All Other Mainframe Topics 0
No new posts Embeding DB2 sql statements in scirpt... DB2 7
No new posts filter COMMIT/ROLLBACK statements DFSORT/ICETOOL 13
No new posts Rexx to create VSAM define statements CLIST & REXX 10
Search our Forums:

Back to Top