View previous topic :: View next topic
|
Author |
Message |
rajandhla
Active User
Joined: 18 Oct 2005 Posts: 182 Location: Luton UK
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
- 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 |
|
|
rajandhla
Active User
Joined: 18 Oct 2005 Posts: 182 Location: Luton UK
|
|
|
|
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 |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
|
|
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 |
|
|
umeshkmrsh
New User
Joined: 21 Sep 2005 Posts: 79 Location: India
|
|
|
|
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 |
|
|
rajandhla
Active User
Joined: 18 Oct 2005 Posts: 182 Location: Luton UK
|
|
|
|
Thanks for the support
jai |
|
Back to top |
|
|
|