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



List,

Apart from having to reclaim an activation group or defining a "mode" procedure parameter, does anybody know a good way to re-initialise a static procedure variable?

My problem is exemplified by the program listed at the foot of this mail:

When this program is run it displays the procedure static variable value five times (incremented once per procedure call). It then displays the globally defined variable value (once).

Subsequent calls to this program continue to increment the procedure static variable, but the global variable is re-initialised (as LR is set on) and begins from the start again. Now I know this behaviour is as expected, and is fully documented in the IBM public library.
But... how do I re-initialise the static procedure variable without having to reclaim a WHOLE activation group? Do I have to make the variable global or is there another way?


If I have to make the variable global - what benefit is there of using static procedure variables? I'm not trying to be churlish - I just can't seem to make sense of it. :-)

Cheers

Larry Ducie

H DFTACTGRP(*NO) ACTGRP('TEST')
**********************************************************************
D int             s             10i 0
D charInt         s             10a
**********************************************************************

D simpleProc      pr
**********************************************************************
/free

 simpleProc();
 simpleProc();
 simpleProc();
 simpleProc();
 simpleProc();
 int += 1;
 charInt = %char(int);
 dsply charInt;
 *inLR = *on;
 return;

/end-free
**********************************************************************
P simpleProc      b
**********************************************************************
D simpleProc      pi

D int             s             10i 0 static
D charInt         s             10a
**********************************************************************
/free

 int += 1;
 charInt = %char(int);
 dsply charInt;
 return;

/end-free
**********************************************************************
P                 E
**********************************************************************



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.