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

S0C4 - When returning to Main PGM (STOP RUN)


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Chris Chapel

New User


Joined: 11 Sep 2007
Posts: 10
Location: Marshfield, WI

PostPosted: Thu Feb 11, 2010 9:19 pm
Reply with quote

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.
Code:
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 11, 2010 9:29 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Feb 11, 2010 10:21 pm
Reply with quote

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
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Feb 12, 2010 5:05 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Feb 12, 2010 7:25 am
Reply with quote

Hi Kjeld,

I like your thought better than my guess. . . icon_smile.gif

d
Back to top
View user's profile Send private message
Chirantan Banerjee

New User


Joined: 08 Oct 2009
Posts: 12
Location: Kolkata, India

PostPosted: Fri Feb 12, 2010 10:05 am
Reply with quote

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
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Fri Feb 12, 2010 2:59 pm
Reply with quote

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
View user's profile Send private message
Chris Chapel

New User


Joined: 11 Sep 2007
Posts: 10
Location: Marshfield, WI

PostPosted: Fri Feb 12, 2010 11:09 pm
Reply with quote

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
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Sat Feb 13, 2010 7:40 am
Reply with quote

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
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 Abend S0C4 11 (Page Translation Excep... PL/I & Assembler 16
No new posts ICE039A H INSUFFICIENT MAIN STORAGE -... DFSORT/ICETOOL 3
No new posts How to stop a runaway CICS trans with... CICS 13
No new posts S0C4 Reason Code 10 COBOL Programming 1
No new posts Query regarding STOP REGION XX ABDU... IMS DB/DC 11
Search our Forums:

Back to Top