|
Joe, Why on Earth would you call a module? That is the strangest design decision I have seen on this ILE architecture (not your's specifically just in general). I mean if you have: CALLP 'MYMODULE' What is the benefit? Bob Cozzi Cozzi Consulting www.rpgiv.com -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Joe Pluta Sent: Tuesday, December 30, 2003 10:39 AM To: 'RPG programming on the AS400 / iSeries' Subject: Initialization of static variables (AGH! I reposted this because I forgot to change the subject.) I was trying to figure out why static variables in a subprocedure are not being reinitialized when I reenter the program. Being a good boy, I did a little research and found Barbara's answer from two years ago, which as always is clear and complete. Unfortunately, it's very frustrating, because it's not what I want to hear <grin>. "I think what you're suggesting is that when a _module_'s (not program) main procedure returns with LR on, when that main procedure gets called again, the subprocedure static should get reinitialized along with the other globals in the module. Maybe that would have been the right behaviour, maybe not. What about calls to the subprocedures between calls to the main procedure? Should the subprocedures be reinitialized even before the main procedure gets called again? As to whether this is right or wrong, maybe it would have been better to have different behaviour for subprocedures in a module with a main. Maybe the subprocedures' static should have been subject to LR reinitialization. Or at least non-exported subprocedures. But then there would have been different behaviour for a subprocedure in a NOMAIN module. Our thinking was that subprocedures are more ILE-ish than RPG-ish, and should behave like ILE things, and not be subject to the RPG cycle." Okay, I can buy this. It simply means that anything I want reinitialized whenever the program restarts has to be global. Pluses and minuses there, but it's at least a workaround. I would ask for one thing. I would love a keyword either on the D spec (or even up at the PI level) along the lines of *GLBREINZ that would say "reinitialize this variable whenever global reinitialization is done". That would allow us the best of both worlds. Joe _______________________________________________ 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.