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



hi Dan,

The RPG LR indicator has no impact on activation groups. Remember, ILE is not an "RPG thing" -- ILE was invented for C, originally, and now supports C, RPG, Cobol, CL and C++. LR, however, is purely an RPG thing and is therefore irrelevant to activation groups.

Let me answer your specific questions:

On 7/29/2013 1:45 PM, Dan Kimmel wrote:

If program B returns without setting on LR and program A or another
program operating in activation group 32 calls program B again, the
system will continue to use the copy of program B in activation
group 33. This is NOT clear in the ILE programmers guide, but I
believe it to be the case.


No, this is not true. Immediately when program B ends, the activation group ("33") will be reclaimed. This is the way that *NEW works, as soon as the first call stack entry in in the activation group has returned, the activation group is reclaimed.

It does not matter if LR is on or off. The activation group is destroyed. (Which causes all files and variables in the program to also be closed/destroyed.... even with LR=off)

If program B sets on LR before returning to program
A, will the system clear the activation group?

Not sure what you mean by "clear the activation group." If you mean that it clears the variables but keeps them in memory, then no... nothing does that to my knowledge. (Not at the activation group level, at any case.)

If "clear" means the same as "reclaim", then yep, it will. It does not matter if LR is on or off. If you use *NEW, the actgrp is reclaimed ("destroyed" or "freed") as soon as the program returns control to it's caller.


That isn't clear either, though it is implied in some statements
about system-defined activation groups along with explicit statements
that the system will NEVER clear user-named activation groups (like
QILE) without an explicit RCLACTGRP.

Named activation groups are different from *NEW. A named activation group does remain active until you do a RCLACTGRP.

I would not say that it 'never' reclaims a named activation group, however. An activation group can end when a program crashes, or when the job ends, in these cases it's reclaimed by the system. Under other uses, a named activation group is only reclaimed when you run RCLACTGRP.


If the system does clear activation group 33 in
that case, it must create another new activation group when Program B
is called again. Even if program B was running in a named activation
group that was not cleared, one would expect files to be closed and
variables to be cleared if program B returned after setting LR.

Yes, if program B is ACTGRP(*NEW), it has to create a new one every time program B is called. This is why it's not a good idea to use *NEW for a program that's called in a loop.

If you use a named actgrp, however... setting on LR causes your RPG program (not the activation group!) to close all files in the module before returning, and to reset all of the global variables on the next call. That's done by code that has been generated into your RPG program by the compiler, though, it's not part of ILE or the activation group.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.