REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Using Persistent Variables


Persistent variables are variables, that don't lose their values between 
two runs of a program. 
There is no native support for persistent variables in REXX. Therefore you 
must implement the save and load process of those variables in your 
program yourself. 
You can use a data file or an INI file (but not OS2.INI!) for this 
purpose. 
Another place to save persistent variables is in the Extended Attributes 
of your REXX program. The adavantage of this method is, that you can move 
or copy the REXX program and the persistent variables will always be 
there. I've found this very clever hint in a message from Erik Schneller 
(see EMail Addresses). 
Note that you should use the defined format for Extended Attributes also 
for your new Extended Attributes - see Extended Attribute Data Types - and 
you shouldn't use one of the predefined Extended Attributes - see Extended 
Attributes used by the WPS. 
One disadvantage of this method is, that you'll lose the persistent 
variables if you use a DOS/Windows program to process the file. Note 
further that the maximum size of all Extended Attributes is limited to 64 
K and that your new Extented Attributes may prevent the REXX interpreter 
from saving the token image of your REXX program in the EAs (see Creating 
a token image) 
(see Sample for persistent variables for a working example using Extended 
Attributes for persistent variables)   

Inf-HTML End Run - Successful