Product Site

5.4.16.15. variables

Returns a directory object containing all of the variables in the current execution context. The directory keys will be the variable names and the mapped values are the values of the variables. The directory will only contain simple variables and stem variables, but no compound variables. Compound variable values may be accessed by using the stem objects that are returned for the stem variable names.

See also Rexx Utility function SysDumpVariables.

Example 5.280. RexxContext class — variables method
b.1 = a
c. = .stem~new
c.[] = 1
c.["one"] = 11
dir = .Directory~new
dir["item"] = "index"
array = .Array~of("a", "e", "i")

say "SysDumpVariables:"
call SysDumpVariables
drop result

say ".context~variables:"
variables = .context~variables
do name over variables
  say "Name="name"," "Value='"variables[name]"'"
  if name~right(1) = ".", variables[name]~isA(.Stem) then
    do tail over variables[name]
      say "Name="name||tail"," "Value='"variables[name][tail]"'"
    end
end

will output
SysDumpVariables:
Name=C.one, Value='11'
Name=DIR, Value='a Directory'
Name=B.1, Value='2'
Name=ARRAY, Value='an Array'
Name=A, Value='2'
.context~variables:
Name=ARRAY, Value='an Array'
Name=B., Value='B.'
Name=B.1, Value='2'
Name=A, Value='2'
Name=DIR, Value='a Directory'
Name=C., Value='1'
Name=C.one, Value='11'