VALUE

Read syntax diagramSkip visual syntax diagram
>>-VALUE--(--name--+----------------------------------+--)-----><
                   '-,--+----------+--+-------------+-'      
                        '-newvalue-'  '-,--selector-'        

returns the value of the symbol that name (often constructed dynamically) represents and optionally assigns it a new value. By default, VALUE refers to the current REXX-variables environment, however, if you want to specify selector the value must be RLS. If the selector of RLS is specified, then the variable operated on is a REXX List System (RLS) variable, rather than a REXX variable. If you use the function to refer to REXX variables, then name must be a valid REXX symbol. (You can confirm this by using the SYMBOL function.) Lowercase characters in name are translated to uppercase. Substitution in a compound name (see section Compound Symbols) occurs if possible.

If you specify newvalue, then the named variable is assigned this new value. This does not affect the result returned; that is, the function returns the value of name as it was before the new assignment.

Here are some examples:
/* After: Drop A3; A33=7; K=3; fred='K'; list.5='Hi' */
VALUE('a'k)     ->  'A3' /* looks up A3     */
VALUE('a'k||k)  ->  '7'  /* looks up A33    */
VALUE('fred')   ->  'K'  /* looks up FRED   */
VALUE(fred)     ->  '3'  /* looks up K      */
VALUE(fred,5)   ->  '3'  /* looks up K and  */
                         /* then sets K=5   */
VALUE(fred)     ->  '5'  /* looks up K      */
VALUE('LIST.'k) ->  'Hi' /* looks up LIST.5 */

The following example returns the VALUE of the REXX variable FRED that has been stored in an RLS variable.

/* REXX EXEC - ASSIGN FIND VALUE OF FRED  */
FRED = 7
'RLS VARPUT FRED \USERS\userid\'
X = VALUE(FRED,,RLS)
SAY X
/* X now = 7                              */
Note:
  1. If the VALUE function refers to an uninitialized REXX variable then the default value of the variable is always returned; the NOVALUE condition is not raised. A reference to RLS variables never raises NOVALUE.
  2. If you specify the name as a single literal string and omit newvalue and selector, the symbol is a constant and so the string between the quotation marks can usually replace the whole function call. (For example, fred=VALUE('k'); is identical with the assignment fred=k;, unless the NOVALUE condition is being trapped. See Conditions and Condition Traps.) trapped.)

Reference Reference

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/value.html