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 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 IBEGENER RETURN CODE 12 anilkumar922 All Other Mainframe Topics 5 Wed Dec 13, 2017 11:41 am
No new posts Finding the plan when code compiled u... Ahemad DB2 1 Fri Dec 01, 2017 6:38 pm
No new posts Strange Code amitc23 COBOL Programming 6 Tue Nov 28, 2017 11:25 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am

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