Re: Stop Run vs GoBack
- From: "Roger While" <simrw@xxxxxxxxxxxx>
- Date: Tue, 26 Jun 2007 18:13:05 +0200
OK. Rick, thanks for that clarification.
And now to throw a spanner in the works :-)
When is a "module" a "main" program?
Consider that for MF,ACU,OC the default when compiling
is to produce a "module" which is (when "main") then executed by
respectively
cobrun, runcbl, cobcrun :-)
All of these compilers also have the possibility to produce
an executable - (For MF,OC option -x, don't know currently for ACU)
So, the runtimes need to determine (how/from where) they are being
called.
That's maybe why Fuji needs the compile time determination whether
main/module :-)
Generally speaking on POSIX systems (Win has POSIX components),
one always compiles to a module and executes "main" progs
with a driver program.
Below is OC usage.
Note that I do NOT here include calling from another language.
There are special initialization sequences involved (as indeed with MF)
HOWEVER, it is possible (and has been done) to produce a
library of Cobol progs that are self-initializing (per compile option).
Roger
"Rick Smith" <ricksmith@xxxxxxx> schrieb im Newsbeitrag
news:1381lfha78puod8@xxxxxxxxxxxxxxxxxxxxx
"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 ais
program either.
In fact, I have 2 ported apps that each contain a prog (without L/S) that
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."
.
- Follow-Ups:
- Re: Stop Run vs GoBack
- From: Rick Smith
- 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: MF Runtime Error 077
- Next by Date: Clarification TZ component of CURRENT-DATE
- Previous by thread: Re: Stop Run vs GoBack
- Next by thread: Re: Stop Run vs GoBack
- Index(es):
Relevant Pages
|