Re: Stop Run vs GoBack
- From: "Frank Swarbrick" <Frank.Swarbrick@xxxxxxxxxxxxxx>
- Date: Tue, 26 Jun 2007 11:37:21 -0600
<1381lfha78puod8@xxxxxxxxxxxxxxxxxx>,On 6/26/2007 at 2:56 AM, in message
Rick Smith<ricksmith@xxxxxxx> wrote:
"Roger While" <simrw@xxxxxxxxxxxx> wrote in message
news:f5q485$ngp$03$1@xxxxxxxxxxxxxxxxxxxx
[snip]
Of course, ABSENCE of L/S does not imply anything about athat
program either.
In fact, I have 2 ported apps that each contain a prog (without L/S)
is
both run as a free-standing (main) program and as a callable
module.
Original machine environment for these app's is unknown
except it was "big iron".
Interestingly enough, both of these progs have a single exit
point which is an EXIT PROGRAM as the last statement in
the source. (That, at least, is the state in which I received them;
I can not say if they have been modified from the real original)
Beginning with COBOL 85, if control passes through
the last statement in a program, the runtime behavior
is an implicit EXIT PROGRAM statement followed
by an implicit STOP RUN statement. With 2002, an
implicit GOBACK statement is executed.
FDIS ISO/IEC 1989:2002, page 388, 14.5.3 Explicit
and implicit transfers of control,
"There is also no next executable statement after the last
statement in a source element when the paragraph in
which it appears is not being executed under the control
of some other COBOL statement in that source element,
after the end marker, and if there are no procedure
division statements in a program, function, or method. In
these cases, an implicit GOBACK statement without any
optional phrases is executed."
That, combined with what Roger said, makes sense. The problem I have when I
accidentally use EXIT PROGRAM in a main program is when I have something
like this.
PROCEDURE DIVISION.
PERFORM HOUSEKEEPING
PERFORM MAINLINE
PERFORM CLEANUP
EXIT PROGRAM.
* ^^ should be STOP RUN or GOBACK
HOUSEKEEPING.
* DO STUFF HERE
MAINLINE.
* DO STUFF HERE
CLEANUP.
* DO STUFF HERE
After it does the expected CLEANUP it then starts over and does
HOUSEKEEPING, MAINLINE and CLEANUP all over again. Not good! :-)
Frank
.
- Follow-Ups:
- Re: Stop Run vs GoBack
- From: Doug Miller
- Re: Stop Run vs GoBack
- References:
- Stop Run vs GoBack
- From: William M. Klein
- Re: Stop Run vs GoBack
- From: Howard Brazee
- Re: Stop Run vs GoBack
- From: Frank Swarbrick
- Re: Stop Run vs GoBack
- From: Roger While
- Re: Stop Run vs GoBack
- From: Rick Smith
- Stop Run vs GoBack
- Prev by Date: Re: COBOL record length on z/series
- Next by Date: Re: COMP-1 and COMP-2 resolution on unix (using microfocus)
- Previous by thread: Re: Stop Run vs GoBack
- Next by thread: Re: Stop Run vs GoBack
- Index(es):