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
 

 

How do you set the return code from the program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: How do you set the return code from the program
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

Site Director


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

PostPosted: Thu Apr 17, 2008 11:06 am    Post subject:
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    Post subject:
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: 276
Location: Bang,iflex

PostPosted: Thu Apr 17, 2008 11:42 am    Post subject:
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: 216
Location: India

PostPosted: Thu Apr 17, 2008 12:12 pm    Post subject:
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

Senior Member


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

PostPosted: Thu Apr 17, 2008 12:47 pm    Post subject:
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: 216
Location: India

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

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

Senior Member


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

PostPosted: Thu Apr 17, 2008 1:31 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 pm
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts I can not compile my program PL1 V3.R... Miguel Fernandez PL/I & Assembler 13 Tue Dec 06, 2016 8:30 pm


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