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 Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts QUESTION: RETURN CHANNEL pahiker CA Products 21 Thu Apr 20, 2017 12:31 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm


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