Re: Stop Run vs GoBack
- From: "Pete Dashwood" <dashwood@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Jun 2007 10:02:53 +1200
"William M. Klein" <wmklein@xxxxxxxxxxxxxxxxx> wrote in message
news:IPyfi.318341$dg3.215593@xxxxxxxxxxxxxxxxxxxxxxxxx
(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.
....or even use STOP RUN in main programs and GOBACK in called ones, in the
certain knowledge that your code will then behave correctly on any COBOL
platform, including PCs, and that you have complied with the "spirit" of
COBOL in making your code semantically accurate. (People for whom IBM is the
World, may see it differently.)
(Of course, if you decide to make a called program a main one, or vice
versa, then you will have to amend the code, and test it, but you would've
done that anyway before promoting it to live, right? :-))
Pete.
.
- Follow-Ups:
- Re: Stop Run vs GoBack
- From: Howard Brazee
- Re: Stop Run vs GoBack
- From: William M. Klein
- Re: Stop Run vs GoBack
- References:
- Stop Run vs GoBack
- From: William M. Klein
- Stop Run vs GoBack
- Prev by Date: Re: (OT) Canada vs New Zealand
- Next by Date: Re: Stop Run vs GoBack
- Previous by thread: Stop Run vs GoBack
- Next by thread: Re: Stop Run vs GoBack
- Index(es):
Relevant Pages
|