Stop Run vs GoBack



(new thread, "old" topic)

Facts and Options inter-mixed:

1) GoBack is in the '02 Standard (but not any earlier ones).

2) In previous (pre-02) Standards, it was "non-conforming" (but often accepted
as an extension) to code an EXIT Program immediately followed by a Stop Run.

3) COBOL (unlike many - possibly MOST - other languages) does NOT require you to
"declare" a program as either a "MAIN" or "SUB" at compile time. (Having a
LINKAGE section *implies* that you are a subprogram, but that is neither
required nor universally even true if you access the fields in it).

4) For as long as I have been involved in IBM mainframe (mostly MVS)
programming, the use of GOBACK "universally" instead of Stop Run and Exit
Program has been recommended by most shops (and classes). (As mentioned
elsewhere - at one time it was REQUIRED for CICS and some IMS programming).

5) Use of STOP RUN in a DECLARATIVE (or ABEND routine) is medium common. This
means that when the situation occurs, one wants the application to STOP - no
matter whether it is "sub" or "main".

6) The "biggest" issue with GoBack (IMHO) has to do with "multi-language"
applications. It is a little unclear where a GoBack takes you - to the CALLing
non-COBOL system or to the operating system. IBM even changed this (at one
stage) with VS COBOL II - although it is now back to the "traditional" return to
the CALLing program (or CLASS/Method - in the case of OO).

***

Personally, I can't see any reason NOT to "universally" use GOBACK - (except to
require immediate application termination). However, if you want "portable"
code to non-IBM compatible (and pre '02 Standard) applications, you might want
to think twice about it.

--
Bill Klein
wmklein <at> ix.netcom.com


.



Relevant Pages

  • Re: Stop Run vs GoBack
    ... RM - and any '02 conforming compiler) by using GOBACK. ... While one can design a program to be both a MAIN or a SUB it is ... Exit Program ... If you really think that COPYed procedure code might be sensible then ...
    (comp.lang.cobol)
  • Re: EXIT SECTION/PARAGRAPH
    ... GOBACK, etc. ... so exit should be at the same level. ... This will, in effect, transfer control to the ... perform end-of-program. ...
    (comp.lang.cobol)
  • Re: Report enhancements
    ... I don't agree that the functionality of GOBACK is directly and completely ... reflected within EXIT, even in '02 COBOL. ... Whatever syntax can be constructed for getting into and out of a "perform ... the use of "forever perform" syntax to the in-line subset. ...
    (comp.lang.cobol)
  • Re: COBOL record length on z/series
    ... I currently always use GOBACK in new programs. ... Many Cobol programs I have worked on can be either. ... I used to use EXIT PROGRAM mostly, unless it was a batch program that was built as an EXE, then I used STOP RUN. ... I didn't know you could use GOBACK in a main program in IBM environments, and that's why it struck me as odd. ...
    (comp.lang.cobol)