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

Use Return-code variable in my cobol program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 213
Location: Chennai

PostPosted: Thu Oct 31, 2013 10:26 am
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
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: 213
Location: Chennai

PostPosted: Thu Oct 31, 2013 10:59 am
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: 213
Location: Chennai

PostPosted: Thu Oct 31, 2013 11:08 am
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
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
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

Senior Member


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

PostPosted: Tue Nov 05, 2013 7:45 am
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

Senior Member


Joined: 07 Feb 2009
Posts: 1306
Location: Vilnius, Lithuania

PostPosted: Tue Nov 05, 2013 3:03 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top