|
> From: Haas, Matt > > Why not just initialize the values in the C specs? It's for sure not as > pretty to look at but it gets the job done without using global variables. Hey Matt! These are variables whose values remain constant between calls. For example, I might store a "last key value" in a data get routine. If I re-enter the procedure and the key to be retrieved is the same as the last key, I can skip the get and use the cached data. Other uses are for automatic sequence numbers or level breaks. In any event, a few of my programs were written so that these variables needed to be initialized once at the beginning of the program and then continue until the program ends. For example, I assigned sequence numbers in one program. It was way surprising to me to set on *INLR, and then come back to find the sequence numbers still increasing with each subsequent call to the program. Very counter-intuitive for us RPG dinosaurs. Getting around this is done in either of two ways: a special call to the procedure that initializes the variables (*NOPASS helps here) or by moving the variables out to global storage. But being able to set a flag that says "reinitialize me in *init" would be a real handy workaround. Joe
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.