Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
IF Statement in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Thu Dec 13, 2007 4:43 pm    Post subject: IF Statement in JCL
Reply with quote

Hi All,

I have a problem for which I require your help.

I am using IF statement in the JCL. The situation that arises is described under:

"STEP03 or STEP04 or both the steps can return a high code (100 or 50 are the return codes that can be returned by both the steps). Based on the return codes, one of the two files that are created in the program is to be deleted. "

How can I code this situation? Can anyone please help me out?
Back to top
View user's profile Send private message

Agni

New User


Joined: 22 Nov 2007
Posts: 83
Location: Chennai

PostPosted: Thu Dec 13, 2007 5:17 pm    Post subject: Reply to: IF Statement in JCL
Reply with quote

Hi Swapnadeep,

Please follow the below steps:

1) Have a separate DD for IF condition. That should be after the step03 and Step04.

//JOBCHKB2 IF STEP03.RC = 50 THEN

2) IF the condition is satisfied then you can have separate job step to delete the file (u can use IEFBR14 utility to do the same)

//JOBCHKB2 ELSE

3) If the condition is not satisfied, then do what ever you want in the ELSE part.

//JOBCHKB2 ENDIF

4) Then last step would be ENDIF.


I have given the above example for simple IF-THEN-ELSE. Try giving OR condition and please let me know the result.

Thanks
Agni.
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Thu Dec 13, 2007 5:26 pm    Post subject:
Reply with quote

Hi Agni,

Thanks for your response. Actually I would delete the step only if the RC from STEP03/STEP04 is not equal to zero. Thus basically its a nested condition. Actually STEP04 is executed even if the RC from Step03 is not equal to zero.
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Thu Dec 13, 2007 6:48 pm    Post subject:
Reply with quote

what is ur condition??

1) delete some file if RC os STEP3 and STEP4 not = 0

or

2) delete the file if RC of STEP3 or STEP4 not = 0
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Dec 14, 2007 8:57 am    Post subject:
Reply with quote

My condition is:

Delete some file if RC of STEP3 or STEP4 not = 0
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Dec 14, 2007 11:45 am    Post subject:
Reply with quote

Hi All,

I was able to solve the problem. But I think its a crude manner in which I was able to provide the logic. For the reference of all I am pasting the code underneath.

Code:

// IF RC > 0 THEN                                       
//  IF RC = 100 THEN                                     
//DEL01    EXEC PGM=IEFBR14                             
//PROGERR  DD DSN=&NAME..PROGRAM.ERROR,                 
//            DISP=(MOD,DELETE,DELETE),SPACE=(TRK,(1,1))
//  ENDIF                                               
//  IF RC = 50 THEN                                     
//DEL02    EXEC PGM=IEFBR14                             
//SERVERR  DD DSN=&NAME..SERVICE.ERROR,                 
//            DISP=(MOD,DELETE,DELETE),SPACE=(TRK,(1,1))
//  ENDIF                                               
//*                                                     
//STEP05   EXEC PGM=ABORT2                               
//UCC11NR  DD DUMMY                                     
//SYSPRINT DD SYSOUT=*                                   
//SYSOUT   DD SYSOUT=*                                   
//CEEDUMP  DD SYSOUT=*                                   
//SYSUDUMP DD SYSOUT=C                                   
// ENDIF                                                 
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
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us