× 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 Duane,

<snip>
I think what Kurt is saying he wants is a static variable for the life of the subprocedure no mater which activation group calls it. To do this your subprocedure would need to be in a service program which has it's own named activation group. The service program would then be isolated and the value of the static variable within the subprocedure would be "static" for the life of the service program's activation group.
</snip>

I think Kurt is alluding to the fact that variables declared as static within subprocedures are not re-initialised if the program returns with *INLR on and is called again. This, I believe, is a result of the program being closed, but not unloaded (it is still active).

The easy way to unload the program (de-activate it) is to end the activation group the program resides within. Of course, putting the program in a *NEW activation group does this implicitely. But this is not what Kurt wants. Kurt wants the static subprocedure variables to re-initialise each time the program is closed and re-called (just as global variables are). - At least I think that's what he wants.

Kurt,

I don't believe there is a standard way to do this as the variables are only visible within the subprocedure and your prototype is already defined.

The only way I know is to include an additional (optional) parm to the subprocedure call which specifies initialisation. OR, make all parms optional and initialise if you pass nothing.

Such as:

//call as usual...
callProcAsUsual(parm1 :parm2 :parm3);


//call within *inzsr...
callProcAsUsual(*blanks :*blanks :*blanks :initialise);
OR
callProcAsUsual();

Cheers

Larry Ducie



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.