Re: Stop Run vs GoBack



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 a
program either.
In fact, I have 2 ported apps that each contain a prog (without L/S) that
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."





.



Relevant Pages

  • Re: using MISC (post 1987 Forth hardware) opcodes
    ... command, or else it executes the line and throws it away. ... You could have the compiler pick up and compile the rest of that line, ... a deferred command and finds it, FOO. ...
    (comp.lang.forth)
  • Re: Matlab Compiler - General Program Design Question
    ... I've written a pretty involved program in Matlab that I've compiled with the Matlab compiler, and I have a question about redesigning the program to meet my needs. ... My first idea is to compile the time-intensive pre-computational code into an executable which executes and remains in memory. ... And then compile another executable that somehow communicates with the program that has all the stuff in memory. ... You might consider generating this data offline, saving it to a MAT file and have your 'another executable' just load and it use it as part of the web server. ...
    (comp.soft-sys.matlab)
  • Re: a question about compiling C source codes
    ... The a.out file executes fine, ... chmod go-rwx program2.c ... The way you compile C code into object files to be linked into ... executables is fairly consistent among all Unix platforms, ...
    (comp.unix.solaris)
  • Re: Creating a lib group with a WIDE library ?
    ... All libs and main progs are written in C. ... > When I compile it and put it in "mlibs" with binder. ... > And when I run this progs, it gives runtime errors 002, illegal address ...
    (comp.sys.tandem)
  • Re: COmpacting database in 2002 vs. 2000
    ... the compiled version (the binary that actually executes.) ... But any change to the code means it has to compile again in the new version. ... A compact alone doesn't get rid of these errors. ... My practice is to decompile as soon as there is any clue that something's going wrong. ...
    (microsoft.public.access.modulesdaovba)