3.2.58. VALUE(symbol[,[value],[pool]])

This function expects as first parameter string symbol, which
names an existing variable. The result returned from the function
is the value of that variable. If symbol does not name an existing
variable, the default value is returned, and the NOVALUE condition
is not raised. If symbol is not a valid symbol name, and this
function is used to access an normal REXX variable, an error
occurs. Be aware of the “double-expansion” effect, and quote the
first parameter if necessary.

If the optional second parameter is specified, the variable will
be set to that value, after the old value has been extracted.

The optional parameter pool might be specified to select a
particular pool of variables to search for symbol. The contents
and format of pool is implementation dependent. The default is to
search in the variables at the current procedural level in REXX.
Which pools that are available is implementation dependent, but
typically one can set variables in application programs or in the
operating system.

Note that if VALUE() is used to access variable in pools outside
the REXX interpreter, the requirements to format (a valid symbol)
will not in general hold. There may be other requirements instead,
depending on the implementation and the system. Depending on the
validity of the name, the value, or whether the variable can be
set or read, the VALUE() function can give error messages when
accessing variables in pools other than the normal. Consult the
implementation and system specific documentation for more
information.

If it is used to access compound variables inside the interpreter
the tail part of this function can take any expression, even
expression that are not normally legal in REXX scripts source
code.

By using this function, it is possible to perform an extra level
of interpretation of a variable.

VALUE(‘FOO’)                  –>   ‘bar’
VALUE(‘FOO’, ‘new’)           –>   ‘bar’
VALUE(‘FOO’)                  –>   ‘new’
VALUE(‘USER’, ‘root’, ‘SYSTEM’)    –>   ‘guest’  /* If SYSTEM
exists */
VALUE(‘USER’,, ‘SYSTEM’)      –>   ‘root’



PREV NEXT