0.9b (c) 1995 Peter Childs
It is not possible to have global variables across more than one REXX program in Classic REXX, without the support of external modules that provide this capability. (In Object-Oriented REXX, however, such global variables are possible; see New features in Object REXX that are useful Classic REXX programs). To get around this limitation, a lot of DLLs for Classic REXX have been written which contain functions to share global variables between REXX programs.
You may, for example, use the function RxPassByName from the DLL RXU to share variables between two or more CMDs:
"One thing I'd want to emphasize in the description of RxPassByName() is that it not only allows one Rexx program to call another, but most importantly it allows two Rexx command files (.CMD) to share their variable pools in a manner similar to the way the "EXPOSE" instruction lets different procedures in a single .CMD file share their variables."
Dave Boll, Author of RXU (see EMail Addresses)
---------- * ----------
Another way to implement global variables across more than one REXX program running in the same session is to use Environment Variables.
In this case, I suggest you use names with an imbedded equal sign, for example =MYREXXVAR.
The advantage of this method is that the CMD.EXE can only read (but not change) environment variables that contain equal signs in the name. It is not possible to modify or delete those variables from the command line or from within a plain batch program.
Note: Be aware that there seems to be a restriction for the maximum length of the contents of an environment variable! If you have environment variables with more than 1024 characters you'll get SYS3175 in CMD.EXE - sooner or later.
(see also Using Persistent Variables)
Inf-HTML End Run - Successful