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
 

 

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 -913/-911 Deadlock during UPDATE stat... NoSleep319 DB2 5 Fri Nov 18, 2016 12:37 am
No new posts COBOL DB2 - CALL statement - high CPU... TS70363 DB2 15 Sun Sep 11, 2016 6:07 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
This topic is locked: you cannot edit posts or make replies. Updating value of key using rewrite s... ParminderKumar COBOL Programming 4 Thu Aug 04, 2016 12:46 am
No new posts Inspect statement spoorni COBOL Programming 5 Mon Jun 06, 2016 9:53 pm


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