![[Toc]](../../toc.gif)
![[Index]](/idx.gif)
Global variables across more than one REXX program
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 "read-only" environment variables (see
Read-only and Write-only environment variables)
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.
---------- * ----------
A way to implement global variables across more than one REXX program
running in different sessions is to use REXX Queues - see Using REXX
queues for global variables for some sample code to use this technique.
Be aware that there is no way to get a list of existing REXX queues.
Therefore you should not loose the name of your global variables if using
this technique. Note also that I don't know how much overhead there is
for a REXX queue.
Source: Harold Putmann (see EMail Addresses) And
---------- * ----------
Another method to implement global variables is described in the section
Using Persistent Variables.
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs