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
 

 

Use Return-code variable in my cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Susheel singh

New User


Joined: 25 Jul 2013
Posts: 13
Location: INDIA

PostPosted: Thu Oct 31, 2013 10:07 am    Post subject: Use Return-code variable in my cobol program
Reply with quote

Hello,

I want to use Return-code variable in my ims-cobol program. Based on some condition in program i need to get return code of 8 for the program and in jcl i need to execute a step, if the step which uses this program returns RC - 8.

I have never used return-code variable please let me know is it i need to define it in WSS or how can i use it?

Anyone can please help!

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

magesh23586

Active User


Joined: 06 Jul 2009
Posts: 158
Location: Chennai

PostPosted: Thu Oct 31, 2013 10:26 am    Post subject: Reply to: Return-code
Reply with quote

RETURN-CODE doesnt requires any declaretions, its a system declared one.
you can directly use it without declartion.

Code:

Move 8 to return-code.
Back to top
View user's profile Send private message
Susheel singh

New User


Joined: 25 Jul 2013
Posts: 13
Location: INDIA

PostPosted: Thu Oct 31, 2013 10:35 am    Post subject:
Reply with quote

Thanks magesh...........can u answer some of my questions

Is this step is enough to get return code 8 for the program?

After executing this step program will exit and rest of the code will not execute?
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 158
Location: Chennai

PostPosted: Thu Oct 31, 2013 10:59 am    Post subject: Reply to: Return-code
Reply with quote

Move statement is sufficient to set the return code and rest of the code will get executed.

Regards,
Magesh
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 158
Location: Chennai

PostPosted: Thu Oct 31, 2013 11:08 am    Post subject: Reply to: Return-code
Reply with quote

One suggession, Before you request a query check whether it is already answered in any of the website... Most of the problem might be re-solved and you can find it through google....
Back to top
View user's profile Send private message
Susheel singh

New User


Joined: 25 Jul 2013
Posts: 13
Location: INDIA

PostPosted: Thu Oct 31, 2013 11:22 am    Post subject:
Reply with quote

Ok....... thanks magesh!
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Oct 31, 2013 9:09 pm    Post subject: Re: Reply to: Return-code
Reply with quote

magesh23586 wrote:
Move statement is sufficient to set the return code and rest of the code will get executed.

Regards,
Magesh


one would think that setting a return code of 8,
which is not a warning,
but an error,
should be followed by the program stopping - e.g. STOP RUN.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


Joined: 31 Oct 2006
Posts: 961
Location: Richmond, Virginia

PostPosted: Tue Nov 05, 2013 7:45 am    Post subject:
Reply with quote

I think sometimes 8 is used for an error, but one which a program (e.g., a compiler) has made an assumptive "correction," whereas 12 is used for an "unfixable" error and therefore termination. 16 is used for a catastrophic error (e.g., compiler table overflow).

For a program which might issue several return code values not causing termination, I suggest:

1. at each event of interest, set a flag instead, one for each RC level
2. at normal termination, check the flags in descending order to set the highest flagged RC
Back to top
View user's profile Send private message
prino

Active Member


Joined: 07 Feb 2009
Posts: 982
Location: Oostende, Belgium

PostPosted: Tue Nov 05, 2013 3:03 pm    Post subject:
Reply with quote

Phrzby Phil wrote:
I think sometimes 8 is used for an error, but one which a program (e.g., a compiler) has made an assumptive "correction," whereas 12 is used for an "unfixable" error and therefore termination. 16 is used for a catastrophic error (e.g., compiler table overflow).

That's true for among others the PL/I compilers. However, 12 is not unfixable when you're talking about the old PL/I V2.3 compiler. That compiler is able to generate correct code for some programs with multiple S(evere) messages. I've got a PL/I Quine that generates
  • 2 pre-processor 'E' messages,
  • 8 compiler 'S' messages,
  • 10 compiler 'E' messages,
  • 6 compiler 'W' messages, and
  • 2 compiler 'I' messages
but the resulting load module does what it should do, print its own source. Enterprise PL/I completely chokes on it...

The source?
Code:
VIEW       PRINO.RAHP.TEXT(QUINE326) - 01.00
Command ===>
****** ********************************************************************* Top of Data ******
000001 %dcl z%z='put edit';proc options(main;q=''''put list(m;do i=1,2;z(q)skip;do j=
000002 1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q',';dcl(c,q)char,m(2)char(99)init(
000003 '%dcl z%z=''put edit'';proc options(main;q=''''''''put list(m;do i=1,2;z(q)skip;do j=',
000004 '1to 78c=substr(m(i),j;if c=q z(c;z(c;end;z(q'','';dcl(c,q)char,m(2)char(99)init(',
****** ******************************************************************** Bottom of Data ****

This is an extreme example, in real life no program than compiles with a compiler return code > 4 should ever be allowed to go into production, and IBM should really change its standard compile procedures to cater for this!
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 -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the code in CLIST to enable t... jackzhang75 CLIST & REXX 1 Fri Dec 02, 2016 3:02 am
No new posts IDEAL - Code Retrieval yugendran CA Products 0 Fri Nov 25, 2016 3:27 pm
No new posts IMS BMP program causes 878 system abend Artemk IMS DB/DC 7 Tue Nov 22, 2016 8:26 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts DFHWS2LS return value divated CICS 4 Mon Nov 07, 2016 5:44 pm


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