View previous topic :: View next topic
|
Author |
Message |
Chris Chapel
New User
Joined: 11 Sep 2007 Posts: 10 Location: Marshfield, WI
|
|
|
|
We have a Main COBOL LE program calling a COBOL LE SubPgm and EOJ to generate a standard audit report. When the run unit executes the processing completes (EOJ), the call to SubPgm is executed, and control returns to the Main Pgm (based on DISPLAY to sysout) but the Main program abends w/ S0C4 (ABEND=S0C4 U0000 REASON=00000004 644) when the Main Pgm has a STOP RUN statement. I had the programmer substitute the STOP RUN for a GOBACK in the Main Program and the run unit end successfully. I consulted the IBM Enterprise COBOL programmer guide for the functional differences between STOP RUN and GOBACK and nothing jumped off the page.
w/ STOP RUN (fail - S0C4)
Code: |
OPEN INPUT INPUT-FILE.
PERFORM 2000-PROCESS-RECS THRU 2000-EXIT
UNTIL EOF-SW = 'Y'.
CLOSE INPUT-FILE.
CALL WK-GG09103 USING MSGA,
LENGTHA,
LINESA,
PROGRAMA,
TITLEA.
DISPLAY 'MADE IT BACK FROM GG09103...'.
STOP RUN. |
w/ GOBACK (success)
Code: |
OPEN INPUT INPUT-FILE.
PERFORM 2000-PROCESS-RECS THRU 2000-EXIT
UNTIL EOF-SW = 'Y'.
CLOSE INPUT-FILE.
CALL WK-GG09103 USING MSGA,
LENGTHA,
LINESA,
PROGRAMA,
TITLEA.
DISPLAY 'MADE IT BACK FROM GG09103...'.
GOBACK. |
Has anyone experienced this in their experiences.
Thanks,
Chris.
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
I've only used STOP RUN on Main Program's when they're returning control to the Operating System (EOJ). Using GOBACK when a sub-program needs to return to the Caller is the manner that is used most often. Sometimes EXIT PROGRAM is used instead, but GOBACK is the method used in most shops.
Bill |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Many of the places i've been no longer allow STOP RUN - everything ends with GOBACK.
Just a guess, but maybe something in the process has walked on storage causing the abend when STOP RUN is issued. . . |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
If you didn't invoke your program in the JCL with EXEC PGM=myprog, but instead have started within another environment like EXEC PGM=DFSRRC00 (IMS) or EXEC PGM=IKJEFT01 (TSO) you might get this kind of abends if you don't give the control back to the calling environment with GOBACK. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Kjeld,
I like your thought better than my guess. . .
d |
|
Back to top |
|
|
Chirantan Banerjee
New User
Joined: 08 Oct 2009 Posts: 12 Location: Kolkata, India
|
|
|
|
Kjeld wrote: |
If you didn't invoke your program in the JCL with EXEC PGM=myprog, but instead have started within another environment like EXEC PGM=DFSRRC00 (IMS) or EXEC PGM=IKJEFT01 (TSO) you might get this kind of abends if you don't give the control back to the calling environment with GOBACK. |
Thanks Kjeld - you've just helped me out on this exact issue that i was facing. |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
Glad to help.
As Dick and others pointed out, GO BACK has been adopted as the standard at many sites, as it always works. |
|
Back to top |
|
|
Chris Chapel
New User
Joined: 11 Sep 2007 Posts: 10 Location: Marshfield, WI
|
|
|
|
Thanks for all of your responses! We are in the process of redefining (or just plain defining) the "exit point" standards in our application development in Enterprise COBOL.
Best Regards,
Chris |
|
Back to top |
|
|
Terry Heinze
JCL Moderator
Joined: 14 Jul 2008 Posts: 1249 Location: Richfield, MN, USA
|
|
|
|
Also, the danger of using EXIT PROGRAM in a program that is not called from another program is that it will be interpreted as a "no operation" statement and the logic will "fall through". I learned this the hard way years ago! |
|
Back to top |
|
|
|