Use the VVALUE() function to retrieve and set values for variables that exist in the external REXX subroutines that called the current routine.
The VVALUE() function has this syntax:
value = VVALUE({FETCH|STORE},varname,level,[newvalue])
The VVALUE() function takes these arguments:
Value of the specified variable, if this is a fetch operation. Otherwise null or error text.
Returns the current contents of a variable.
Replaces the variable's contents with the specified value.
Name of the variable to be referenced.
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.
Value to be placed in the specified variable (STORE operation only).
The VVALUE() function produces these return codes:
ARG n MISSING OR INVALID
ARG 3 EXCEEDS NESTING LEVEL
SYSTEM ERROR
STORAGE DEPLETED
UNKNOWN SEVERE ERROR
SYSTEM ERROR, INVALID RETURN
VARIABLE DID NOT EXIST OR IS DROPPED
LAST VARIABLE TRANSFERRED ("N")
TRUNCATION OCCURRED
INVALID VARIABLE NAME
INVALID VALUE SPECIFIED
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
| Copyright © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |