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

IF Statement to check if the return code is equal to 50


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

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Sep 28, 2007 3:21 pm
Reply with quote

Hi,

I am required to display a dataset (DA) in the spool region if the return code is equal to 50 else i am to display another dataset (DB) if return from a previous step is non zero.

I have thought of the following code.

Can any one please let me know whether I am correct in my approach or not:

Code:
//ABIF1 IF STEP02.RC>0 THEN                                           
//CALLLIST EXEC PGM=COPYHASP                                           
//*                                                                   
//SYSIN    DD DSN=PV5240A.ONCALL.DATA,DISP=SHR                   
//SYSOUT   DD SYSOUT=*                                                 
//*                                                                   
//ABIF2 IF STEP02.RC=50 THEN                                           
//SYSIN    DD DSN=PV5240A.PROGRAM.ERROR,DISP=SHR           
//SYSOUT   DD SYSOUT=*                                                 
//  ELSE                                                               
//SYSIN    DD DSN=PV5240A.SERVICE.ERROR,DISP=SHR           
//SYSOUT   DD SYSOUT=*     
//  ENDIF                                           


Thank you in advance for your response.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Sep 28, 2007 3:41 pm
Reply with quote

You can not code only DD statements in IF ELSE. You need to code EXEC statements for that. Also your requirement is not clear to us, because rc > 0 will get satisfied when rc = 50, how do you want to deal with such situation?
Please clarify.
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Sep 28, 2007 3:46 pm
Reply with quote

In the COBOL program I would be returning two different return code values to the variable.

According to this return code, I want to print the error file in the spool.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Sep 28, 2007 3:55 pm
Reply with quote

You need to do something like -
Code:
//ABIF1 IF STEP02.RC>0 THEN                                           
//CALLLIS1 EXEC PGM=COPYHASP                                           
//*                                                                   
//SYSIN    DD DSN=PV5240A.ONCALL.DATA,DISP=SHR                   
//SYSOUT   DD SYSOUT=*                                                 
//*                       
//  ENDIF                                                           
//ABIF2 IF STEP02.RC=50 THEN                                           
//CALLLIS2 EXEC PGM=COPYHASP                                           
//SYSIN    DD DSN=PV5240A.PROGRAM.ERROR,DISP=SHR           
//SYSOUT   DD SYSOUT=*                                                 
//  ELSE                                                               
//CALLLIS3 EXEC PGM=COPYHASP                                           
//SYSIN    DD DSN=PV5240A.SERVICE.ERROR,DISP=SHR           
//SYSOUT   DD SYSOUT=*   
// ENDIF
 

You still have not answered my question -
Also your requirement is not clear to us, because rc > 0 will get satisfied when rc = 50, how do you want to deal with such situation?

Please clarify, so that we can help you to get the solution.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Sep 28, 2007 4:00 pm
Reply with quote

Swanadeep,

chnage the rc>0 condition to (rc>0 and rc ne 50)
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Sep 28, 2007 4:12 pm
Reply with quote

Abhijit,

swapnadeep.ganguly wrote:
In the COBOL program I would be returning two different return code values to the variable.


According to this return code, I want to print the error file in the spool.

One of the variable would contain a value of 50 and other any non zero value.

For the return code = 50, I would call the dataset DA and for the other case, the other dataset (DB)

Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Sep 28, 2007 4:15 pm
Reply with quote

Swapnadeep,

Quote:
CALLLIS1 EXEC PGM=COPYHASP

Is this the cobol program?
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Sep 28, 2007 4:21 pm
Reply with quote

no

the cobol program is called in STEP02..

i am checking the return code from STEP02
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Oct 01, 2007 11:20 am
Reply with quote

Did you get solution to your problem yet? I hope you have considered Murali's point about 'condition check'..
Back to top
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Mon Oct 01, 2007 11:38 am
Reply with quote

Yes.

I got the solution to my problem.

Thanks to all of you who helped me to get the solution to my problem.
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 run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts SCOPE PENDING option -check data DB2 2
No new posts Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top