Code Comments
Programming Forum and web based access to our favorite programming groups.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-.../> 80112234143> --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-... /> 0112234143> 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
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.