Example Without the PROCEDURE Instruction
/******************************* REXX ******************************/
/* This exec does not use a PROCEDURE instruction to protect the */
/* variables within its subroutine.
*/
/*******************************************************************/
number1 = 10
CALL subroutine
SAY number1 number2
/* displays 7 5 */
EXIT
subroutine:
number1 = 7
number2 = 5
RETURN
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 subroutine.
Example Using PROCEDURE EXPOSE
/****************************** REXX *******************************/
/* This exec uses a PROCEDURE instruction with the EXPOSE option to*/
/* expose one variable, number1, in its subroutine. The other
*/
/* variable, number2, is set to null and displays its name in
*/
/* uppercase.
*/
/*******************************************************************/
number1 = 10
CALL subroutine
SAY number1 number2
/* displays 7 NUMBER2 */
EXIT
subroutine: PROCEDURE EXPOSE number1
number1 = 7
number2 = 5
RETURN
For more information about the PROCEDURE instruction, see
Passing Information by Using Arguments
A way to pass information to either internal or external subroutines is through
arguments. You can pass up to 20 arguments separated by commas on the CALL
instruction as follows:
CALL subroutine_name argument1, argument2, argument3,......
Using the ARG Instruction:
The subroutine can receive the arguments with the
ARG instruction. Arguments are also separated by commas in the ARG instruction.
ARG arg1, arg2, arg3, .....
The names of the arguments on the CALL and the ARG instructions do not have to
be the same because information is not passed by argument name but by position.
The first argument sent becomes the first argument received and so forth. You can
also set up a template in the CALL instruction, which is then used in the
corresponding ARG instruction. For information about parsing with templates, see
“Parsing Data” on page 87.
Writing a Subroutine;
74
z/OS V1R1.0 TSO/E REXX User’s Guide
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: ......