For Programmers: Free Programming Magazines  


Home > Archive > Cobol > June 2007 > Differences Between GOBACK and STOP RUN









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Differences Between GOBACK and STOP RUN

2007-06-23, 9:56 pm


All righty... there's been a bit of back-and-forth on this, seasoned with
heaping helpings of 'I recall (x)' and 'it seems to me that (y)'... so
when in doubt, turn to The Manual.

I mentioned that my work and training were in IBM mainframe environments
so I dug around a bit; the first one I've come across is rather recent,
Document Number SC26-9046-00 (COBOL for OS/390 & VM). Copyright dates on
this are 1991 and 1998 so - in COBOL terms - it is a mere toddler... but
one needs to begin someplace.

According to
<http://publibz.boulder.ibm.com/cgi-...=19980112234143>

--begin quoted text:

The GOBACK statement functions like the EXIT PROGRAM statement when it is
coded as part of a called program (or the EXIT METHOD statement when it is
coded as part of an invoked method) and like the STOP RUN statement when
coded in a main program.

[snip]

If control reaches a GOBACK statement while a CALL statement is active,
control returns to the point in the calling program immediately following
the CALL statement, as in the EXIT PROGRAM statement.

--end quoted text

There is, at the bottom of the page, a table which shows the actions taken
for the GOBACK:

Main Program: Return to calling program. (Can be the system and thus
causes the application to end.)

Subprogram: Return to calling program.

Next... according to the Index
<http://publibz.boulder.ibm.com/cgi-...=19980112234143>
both STOP and STOP RUN are detailed on the same page,
<http://publibz.boulder.ibm.com/cgi-...112234143&CASE=>.

--begin quoted text:

The STOP RUN statement closes all files defined in any of the programs
comprising the run unit.

--end quoted text

.... and in the table at the bottom of the page, similar to that of the
GOBACK cited above, it states that the actions of STOP RUN are:

--begin quoted text

Main Program: Return to calling program.* (May be the system and cause the
application to end.)

Subprogram: Return directly to the program that called the main program.*
(May be the system and cause the application to end.)

--end quoted text

It seems that what I was taught - GOBACK always does the same thing while
STOP RUN can have unintended consequences, especially for a Main program
that has become a subroutine - is reflected in this; it would be
interesting to see what data others with manuals more hoary than this
one might be able to report.

DD

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com