Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Passing Information by Using Variables z/OS TSO/E REXX User's Guide SA32-0982-00 |
|
When an exec and its internal function share the same variables, the value of a variable is what was last assigned, regardless of whether the assignment was in the main part of the exec or in the function. In the following example, the value of answer is assigned in the function and displayed in the main part of the exec. The variables number1, number2, and answer are shared. In addition, the value of answer replaces the function call because answer follows the RETURN instruction. Example of Passing Information in a Variable
Using the same variables in an exec and its internal function can sometimes create problems. In the following example, the main part of the exec and the function use the same control variable, "i", for their DO loops. As a result, the DO loop repeats only once in the main exec because the function returns to the main exec with i = 6. Example of a Problem Caused by Passing Information in a Variable
To avoid this kind of problem in an internal function, you can
use:
|
Copyright IBM Corporation 1990, 2014
|