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
 

 

Setting of return code

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

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Thu Jan 05, 2006 8:54 pm    Post subject: Setting of return code
Reply with quote

Hi ,

after reading the file i will check/validate the record. if the record is not valid i will abort the program by setting the returncode. but the program is not getting aborted with return code i am setting.

the wf-retun code value is 999 is setting in error occured para.

the piece of code iam using
DISPLAY 'RETURN CODE ' WF-RETURN-CODE
MOVE WF-RETURN-CODE TO RETURN-CODE.
IF WF-ERROR-OCCURED
DISPLAY 'RETURN CODE ' WF-RETURN-CODE
PERFORM D-TERM-OSC1255N
END-IF.
STOP RUN.

please help me if iam wrong.

thanks in advance
jai
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Thu Jan 05, 2006 9:04 pm    Post subject: Re: Setting of return code .
Reply with quote


  • What do your two DISPLAY statements look like during the run-time execution?
  • Is it possible that D-TERM-OSC1255N also sets the RETURN-CODE?
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Thu Jan 05, 2006 9:07 pm    Post subject: Re: Setting of return code .
Reply with quote

superk wrote:

  • What do your two DISPLAY statements look like during the run-time execution?
  • Is it possible that D-TERM-OSC1255N also sets the RETURN-CODE?

Hi
i have kept displays just to find any where the return code vaiable value is changing. the value is not changing in spool i can find the return code as 999, but the program is not aborted
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Thu Jan 05, 2006 11:06 pm    Post subject: Re: Setting of return code .
Reply with quote

Hi rajandhla,

Setting the return-code to a non 0 value will not abort the program, it just send the return-code to the operating system and to the JCL. Sending non zero return-codes from a Cobol program is a common way to communicate with the JCL to selectively execute subsequent steps. One of a couple of ways you can handle this.

1 - Force an ABEND/abort within the program. i.e. divide by zero, or add 1 to an un-initialized comp-3 field etc.

2 - Have a program in the JCL that runs just after your program and executes if the condition-code is not = 0.

3 - Sometimes a shop will have a subroutine that you can call who's function of is to abend

Hope this helps,

Dave
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Fri Jan 06, 2006 11:14 am    Post subject:
Reply with quote

What 'DavidatK' said is correct. Return Code set in program is just to comunicate to JCL, it in turn sets the return code of the JCL step executing the program.

To abort a program use CALL 'ABORT'.
Back to top
View user's profile Send private message
rajandhla

Active User


Joined: 18 Oct 2005
Posts: 182
Location: Luton UK

PostPosted: Fri Jan 06, 2006 5:46 pm    Post subject:
Reply with quote

Thanks for the support
jai
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 How to Capture the Max return code of... anilkumar922 All Other Mainframe Topics 0 Thu Jan 12, 2017 12:02 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 PL/I code tuning/Performance improvement Virendra Shambharkar PL/I & Assembler 4 Mon Dec 05, 2016 11:57 am
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


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