Previous Topic: VSAM()

Next Topic: WAIT()

VVALUE()

Use the VVALUE() function to retrieve and set values for variables that exist in the external REXX subroutines that called the current routine.

Syntax

The VVALUE() function has this syntax:

value = VVALUE({FETCH|STORE},varname,level,[newvalue])

Arguments

The VVALUE() function takes these arguments:

value

Value of the specified variable, if this is a fetch operation. Otherwise null or error text.

FETCH

Returns the current contents of a variable.

STORE

Replaces the variable's contents with the specified value.

varname

Name of the variable to be referenced.

level

Subroutine nesting level to be accessed. 0 is the currently executing routine, 1 is the caller of the currently executing routine, 2 is the caller of the caller of the currently executing routine, etc.

newvalue

Value to be placed in the specified variable (STORE operation only).

Usage Notes

Return Codes

The VVALUE() function produces these return codes:

101 - 104 ARG n MISSING OR INVALID

103 ARG 3 EXCEEDS NESTING LEVEL

121 SYSTEM ERROR

122 STORAGE DEPLETED

123 UNKNOWN SEVERE ERROR

124 SYSTEM ERROR, INVALID RETURN

125 VARIABLE DID NOT EXIST OR IS DROPPED

126 LAST VARIABLE TRANSFERRED ("N")

127 TRUNCATION OCCURRED

128 INVALID VARIABLE NAME

129 INVALID VALUE SPECIFIED

130 INVALID FUNCTION CODE (SHVCODE)

Example

/*  This IMOD gets called repeatedly.  It requires extensive
    initialization to derive a value for "num".  Instead of
    performing this initialization each call, the value of "num"
    is stored in the calling IMOD.  */

num = vvalue('fetch','shar_init',1)           /* obtain stored
                                                 number         */
if rc ^= 0 | datatype(num,'w') == 0 then do   /* nothing stored */
   call init     /* invoke 10,000 line internal init subroutine */
   x = vvalue('store','shar_init,1,num)       /* save for next
                                                 time           */
   end