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



Up until now, I've been detecting the first call to the procedure by testing the value of the static variable. I did not realise that the storage was being reclaimed by a CLP doing RCLRSC, in my case, at the end of the program. I wrongly thought that the storage would be reclaimed at the end of the program. I can't think of an example where this might cause a problem at the moment, but when I tested and found that static variables are not reinitialised like global variables are, I felt a little alarmed.


-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Dennis Lovelady
Envoyé : mardi 26 janvier 2010 14:28
À : 'RPG programming on the IBM i / System i'
Objet : RE: Correct use of STATIC variables

I think the point of STATIC variables is, you DON'T initialize them
between program calls. At least, not according to this description
from the RPG Reference on static variables. I mean, how do you
initialize something that is not visible outside of its
context, such
as a procedure?

Upon occasion I will have a procedure that needs to know if
it needs to be "reset." Maybe it's accumulating some total
for groups of data or ...

For example, if one parameter is a flag that is passed to
indicate "First call from this entity" (whatever that entity
may be). When the procedure sees that flag is set, it can do
its re-initialization.

Is this what the OP had in mind?

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"If only God would give me some clear sign! Like making a
large deposit in my name at a Swiss bank."
-- Woody Allen



--
This is the RPG programming on the IBM i / System i
(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 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.