Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 4650
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 Speed-up/reduce CPU use of code prino PL/I & Assembler 0 Tue Sep 26, 2017 12:05 am
No new posts Setting Font Type for XMIT satish.ms10 All Other Mainframe Topics 3 Fri Sep 15, 2017 10:01 pm
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Finding IMS resource blocker after se... Hooman24 IMS DB/DC 1 Wed Aug 16, 2017 9:17 pm
This topic is locked: you cannot edit posts or make replies. how to code for GDG in Rexx cvnlynn CLIST & REXX 13 Wed Aug 09, 2017 9:13 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us