× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This is a multipart message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
.
.
Jon.

Thank you for a thorough explanation.  So we can just forget EXIT
PROGRAM/STOP RUN and only  use GOBACK, then, in all programs, without
considering whether they are called as main- or subprograms (or both)?


Mvh.

Geir Kildal






"Jon Paris" <Jon.Paris@Partner400.com>
Sent by: cobol400-l-admin@midrange.com
03.05.2002 18:01
Please respond to cobol400-l


        To:     <cobol400-l@midrange.com>
        cc:
        Subject:        RE: GOBACK vs EXIT PROGRAM


 >> please explain the difference between GOBACK and EXIT PROGRAM for
me(and
maybe a lot of others?)

GOBACK was added in ANSI '85 (I think) as an answer to the age-old problem
caused by the fact that EXIT PROGRAM is ignored when in the main program.
It is just a no-op and cause the logic to drop-though to whatever is next
in
the code.  Nasty and produces some very hard to debug situations.  This
causes problems in a multi-language environment where a generic routine
may
be called form COBOL as a sub program or from another language, in which
case it would tend to become main.  In many cases programs would be coded
as
EXIT PROGRAM followed by STOP RUN on the next line to avoid dropping
through
into unexpected logic.  Alternatively in implementations that allowed
non-COBOL programs to appear within the run unit (such as the OS/400 COBOL
implementations) a "stub" program is often used in front of the non-COBOL
programs to ensure that any subsequent COBOL programs are sub programs.
This has the added benefit of increasing performance as the run unit is
not
constantly being torn down and then rebuilt.

GOBACK was the "solution" since they couldn't change the definition of
EXIT
PROGRAM.  GOBACK acts as an EXIT PROGRAM in a sub program and STOP RUN if
it
is in a main.

Jon Paris
Partner400


_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l
or email: COBOL400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.