× 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.



Dane Cox wrote:
> 
> Not withstanding that LR is specific to RPG (after all, this is an RPG
> specific list), was there a compelling reason to stop shy of
> re-initializing all of the statically bound modules that make up the
> compiled object?  

Nothing even starts re-initializing modules, so it can't stop shy of
doing all of them.  There's just a bit of code generated by the RPG
compiler into every RPG module.  Something like this:

            if static_init_flag = *on;
                fld1 = 0;
                fld2 = *blanks;
                etc.
                open files;
                etc.
                static_init_flag = *off;
                run *inzsr;  (not generated for nomain modules)
            endif;
            ...
            generated for non-nomain modules only:
            if *inlr = *on;
                close files;
                static_init_flag = *on;
            endif;           
            ...
            return;

> Since the 'main' module remains resident until the AG
> is destroyed, apparently there was a requirement to re-initialize these
> 'main' modules at one time or another and LR was used as that mechanism?

This behaviour of LR causing re-initialization predates the concept of
multiple-module programs by a couple of decades.

> ... I mean, from what I am hearing no
> other programs or modules can use them since they are specific to the
> 'main' that they are bound to...no?  Again, I'm just trying to
> understand some of the advantages or disadvantages of these
> mechanics...LR seems a little 'incomplete' to me...in this circumstance.

You're confusing compile time with run time.  A module may or may not be
reused to be part of one or more programs, at compile time.  There is no
concept of persistence here.  At run time, a given module in a program
may be called one or more times in the same activation group.  The
"persistence" of the module is actually the persistence of its static
storage, which is allocated for the lifetime of the activation group. 
There is also the persistence of the _values_ of the static storage;
those persist until something changes them, either the logic of the code
that you write, or the logic of the code that the compiler generates on
your behalf.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.