| 
 | 
From: Jon Paris <Jon.Paris@Partner400.com>
> >> EXIT PROGRAM leaves the run unit alone (and all variables and open files
> etc in their current state). Why do you say "You can "now".?
>
> See my other note Lief - it only leaves the run unit alone _if_ it is
> executed.  In the circumstances Brian was discussing it will be ignored
> completely.
>
why is this so hard?
Consider a program A (ANY program written in RPG, MI, COBOL, CL, ...)
that calls program B (written in COBOL). A does this:
begin
    number P
    call B (P)
    call B (P)
    call B (P)
    print P
end
B looks like this:
...
77  MY-COUNT  PIC 9999 VALUE ZERO.
LINKAGE SECTION.
01  THE-PARM PIC 9999.
PROCEDURE DIVISION USING THE-PARM.
BEGIN-ME.
     ADD 1 TO MY-COUNT
     MOVE MY-COUNT TO THE-PARM
     .
END-ME.
    EXIT PROGRAM
    .
STOP-ME.
    STOP RUN
    .
======
Program A will print the number 3.
QED.
It does that because:
1) the run unit is not terminated
2) EXIT PROGRAM is executed
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.