|
Barbara, Sounds like I'd like you to add NOMAIN(*REINZ) to the list of things for V5R4. And of course this would only "work" when being bound to a *PGM not *SRVPGM program. NOMAIN(*REINZ) - Causes the global variables in the module to be reset to the initial values when the entry module sets on *INLR and returns to the caller. When the program containing this module is compiled to a named activation group and called a second time after setting on *INLR, the global variables in all NOMAIN(*REINZ) modules are reset. -Bob Cozzi -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris Sent: Tuesday, January 11, 2005 4:35 PM To: rpg400-l@xxxxxxxxxxxx Subject: Re: A different kind of persistence? 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. -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.