EasyManuals Logo
Home>IBM>Computer Hardware>TSO/E REXX

IBM TSO/E REXX User Manual

IBM TSO/E REXX
242 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #92 background imageLoading...
Page #92 background image
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 z/OS TSO/E REXX
Reference.
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 Users Guide

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM TSO/E REXX and is the answer not in the manual?

IBM TSO/E REXX Specifications

General IconGeneral
BrandIBM
ModelTSO/E REXX
CategoryComputer Hardware
LanguageEnglish

Related product manuals