Question: Are local variables in a proc persistent?

Hi,

I want to write a proc to calculate exponential averages. Each call will add one data point to the averge. To do that, I need to store the previous average. I can do that by handing the previous average back to the proc at the next call, but I'd rather store it in the proc. Is there a way to guarantee that a variable---once set---remains alive keeping the last value upon entering the proc again? Note that I need the variable to be local to each instance of the proc since I will have several of these running in parallel (I intend to create these procs using the module factory scheme outlined in the programming guide). So I cannot store the previous average in a global variable since that would not be unique to a given instance.

Any ideas out there?

TIA,

Mac Dude

 

Please Wait...