Previous Topic: System Variables

Next Topic: Global Variables

User Variables

Any number of user variables (within storage limitations) can be defined to contain information required during the processing phase of a procedure. Explicit definition of user variables is not required. The first time a user variable is referenced it is automatically defined. User variables are automatically deleted when a procedure terminates.

User variables can be passed across nested procedure levels if the &CONTROL SHRVARS operand is in force when the nested procedure is invoked, otherwise they are unique within the current nesting level. If a user variable is required in a nested level and &CONTROL SHRVARS is not in effect, its value must be passed explicitly as a parameter on the EXEC command when the nested level is invoked. An &RETURN statement can then be used to return specified variables to a higher nesting level, thus facilitating the development of modular functions.