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

How do you set the return code from the program


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ravindra reddy

New User


Joined: 21 Jan 2008
Posts: 7
Location: banglore

PostPosted: Thu Apr 17, 2008 10:49 am
Reply with quote

How do you set the return code from the program?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Apr 17, 2008 11:06 am
Reply with quote

Hello,

That depends on the programming language.

In COBOL, you would:
Code:
    MOVE nnnn TO RETURN-CODE.
where nnnn can be from 0 to 4095.
Back to top
View user's profile Send private message
ravindra reddy

New User


Joined: 21 Jan 2008
Posts: 7
Location: banglore

PostPosted: Thu Apr 17, 2008 11:37 am
Reply with quote

But what is that RETURN-CODE whether it is register or what?
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Thu Apr 17, 2008 11:42 am
Reply with quote

Hi

ravindra reddy wrote:
But what is that RETURN-CODE whether it is register or what?


Yes that is register for the return code
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Thu Apr 17, 2008 12:12 pm
Reply with quote

vasanthkumarhb wrote:
Hi

ravindra reddy wrote:
But what is that RETURN-CODE whether it is register or what?


Yes that is register for the return code


Hi vasanth,
i think this return-code concept is used with sub programs.If the program is excuted successfully we will set the return-code and use in in the main program for other process based on this.Correct me if i am wrong and pls provide other info where it can be used.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Apr 17, 2008 12:47 pm
Reply with quote

Hi,

sri_mf wrote:
i think this return-code concept is used with sub programs.If the program is excuted successfully we will set the return-code and use in in the main program for other process based on this.

Not always, you might like to MOVE one code to RC in one condition & other in some different condition; as in
Code:
IF EOF-MYFILEIN                                         
       DISPLAY '    PROGRAM XX100 ABEND'             
       DISPLAY '    MY INPUT FILE IS EMPTY    '       
       MOVE +4003          TO   ABDCODE               
                                RETURN-CODE           
       PERFORM 9999-ABEND                             
ELSE                                                 
    IF RECORD-CODE OF MY-INP-RECORD NOT = '00' 
        DISPLAY '    PROGRAM XX100 ABEND'             
        DISPLAY '    MY INPUT FILE HEADER IS MISSING' 
        MOVE +4004          TO   ABDCODE             
                                 RETURN-CODE         
        PERFORM 9999-ABEND                           
    END-IF                                           
END-IF.                                               



Quote:
Correct me if i am wrong and pls provide other info where it can be used.
..just searching for an adjective... icon_smile.gif and other info is above I hope.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Thu Apr 17, 2008 1:05 pm
Reply with quote

Thanks Anuj icon_biggrin.gif
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Apr 17, 2008 1:31 pm
Reply with quote

Pleasure is all mine.. icon_wink.gif
Back to top
View user's profile Send private message
ravindra reddy

New User


Joined: 21 Jan 2008
Posts: 7
Location: banglore

PostPosted: Thu Apr 17, 2008 2:33 pm
Reply with quote

Thanks to all icon_smile.gif
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 -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
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 Return codes-Normal & Abnormal te... JCL & VSAM 7
No new posts DB2 Event passed to the Application P... DB2 1
Search our Forums:

Back to Top