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 to check if the return code is equal to 50

 
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: Fri Sep 28, 2007 3:21 pm    Post subject: IF Statement to check if the return code is equal to 50
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: 686
Location: Earth

PostPosted: Fri Sep 28, 2007 3:41 pm    Post subject:
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    Post subject:
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: 686
Location: Earth

PostPosted: Fri Sep 28, 2007 3:55 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Sep 28, 2007 4:00 pm    Post subject:
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    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Sep 28, 2007 4:15 pm    Post subject:
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    Post subject:
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: 686
Location: Earth

PostPosted: Mon Oct 01, 2007 11:20 am    Post subject:
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    Post subject:
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    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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts IMS region inactive - User abend code... gthmrj IMS DB/DC 5 Tue Mar 07, 2017 12:29 pm
No new posts CA Workload Automation event code help vinu78 CA Products 10 Wed Mar 01, 2017 10:05 am
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm


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