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

Setting of return code


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Thu Jan 05, 2006 9:04 pm
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
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 REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
Search our Forums:

Back to Top