The following two examples show the differing results when a function uses the
PROCEDURE instruction and when it doesn’t.
Example Using the PROCEDURE Instruction
/****************************** REXX *******************************/
/* This exec uses a PROCEDURE instruction to protect the variables */
/* within its function.
*/
/*******************************************************************/
number1 = 10
SAY pass() number2
/* Displays 7 NUMBER2 */
EXIT
pass: PROCEDURE
number1 = 7
number2 = 5
RETURN number1
Example Without the PROCEDURE Instruction
/******************************** REXX *****************************/
/* This exec does not use a PROCEDURE instruction to protect the
*/
/* variables within its function.
*/
/*******************************************************************/
number1 = 10
SAY pass() number2
/* displays 7 5 */
EXIT
pass:
number1 = 7
number2 = 5
RETURN number1
Exposing Variables with PROCEDURE EXPOSE:
To protect all but specific
variables, use the EXPOSE option with the PROCEDURE instruction, followed by
the variables that are to remain exposed to the function.
Example Using PROCEDURE EXPOSE
/****************************** REXX *******************************/
/* This exec uses a PROCEDURE instruction with the EXPOSE option to*/
/* expose one variable, number1, in its function.
*/
/*******************************************************************/
number1 = 10
SAY pass() number1
/* displays 5 7 */
EXIT
pass: PROCEDURE EXPOSE number1
number1 = 7
number2 = 5
RETURN number2
For more information about the PROCEDURE instruction, see
Passing Information by Using Arguments
A way to pass information to either internal or external functions is through
arguments. You can pass up to 20 arguments separated by commas in a function
call.
Writing a Function
Chapter 6. Writing Subroutines and Functions
81
Summary of Contents for TSO/E REXX
Page 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 2: ......
Page 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Page 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Page 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Page 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Page 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Page 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Page 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Page 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Page 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Page 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Page 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Page 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Page 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Page 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Page 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Page 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Page 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Page 241: ......