Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
S0C4 - When returning to Main PGM (STOP RUN)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: S0C4 - When returning to Main PGM (STOP RUN)
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: 2504
Location: Atlanta, Georgia, USA

PostPosted: Thu Feb 11, 2010 9:29 pm    Post subject: Reply to: S0C4 - When returning to Main PGM (STOP RUN)
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

Site Director


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

PostPosted: Thu Feb 11, 2010 10:21 pm    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Feb 12, 2010 7:25 am    Post subject: Reply to: S0C4 - When returning to Main PGM (STOP RUN)
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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    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 Missing Java main class akg Java & MQSeries 3 Wed May 25, 2016 4:05 pm
No new posts READQ TS returning inconsistent addre... moezbud CICS 14 Wed May 04, 2016 1:09 am
No new posts Sending IMS (DBCTL) command and get r... lind sh CICS 2 Tue Mar 01, 2016 2:32 pm
No new posts Cobol Sub-Program and Main-Program Chetan Kumar Mainframe Interview Questions 7 Sat Oct 17, 2015 10:48 am
No new posts Stop Process when file is empty Roland Brosio DFSORT/ICETOOL 4 Thu Jun 25, 2015 1:20 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us