function(
option
)
v
Another function
function(function(arguments))
v
Combination of argument types
function('With a literal string', 55, option)
When the function returns a value, and all functions must return values, the value
replaces the function call. In the following example, the value returned is added to 7
and the sum is displayed.
SAY 7 + function(arguments)
A function call generally appears in an expression. Therefore a function call, like an
expression, does not usually appear in an instruction by itself.
Example of a Function
Calculations represented by functions often require many instructions. For instance,
the simple calculation for finding the highest number in a group of three numbers,
might be written as follows:
Finding a Maximum Number
/***************************** REXX ********************************/
/* This exec receives three numbers from a user and analyzes which */
/* number is the greatest.
*/
/*******************************************************************/
PARSE ARG number1, number2, number3 .
IFnumber1 > number2 THEN
IFnumber1 > number3 THEN
greatest = number1
ELSE
greatest = number3
ELSE
IFnumber2 > number3 THEN
greatest = number2
ELSE
greatest = number3
RETURN greatest
Rather than writing multiple instructions every time you want to find the maximum of
a group of three numbers, you can use a built-in function that does the calculation
for you and returns the maximum number. The function is called MAX and is used
as follows:
MAX(number1,number2,number3,...)
To find the maximum of 45, -2, number, 199, and put the maximum into the symbol
biggest
, write the following instruction:
biggest = MAX(45,-2,number,199)
What is a Function?
62
z/OS V1R1.0 TSO/E REXX User’s Guide
Содержание TSO/E REXX
Страница 1: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 2: ......
Страница 3: ...z OS TSO E REXX User s Guide SA22 7791 00 ...
Страница 10: ...viii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 12: ...x z OS V1R1 0 TSO E REXX User s Guide ...
Страница 14: ...xii z OS V1R1 0 TSO E REXX User s Guide ...
Страница 18: ...xvi z OS V1R1 0 TSO E REXX User s Guide ...
Страница 20: ...2 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 58: ...Tracing Expressions with the TRACE Instruction 40 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 78: ...60 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 86: ...Built In Functions 68 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 128: ...Issuing Other Types of Commands from an Exec 110 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 136: ...Debugging Execs 118 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 170: ...Protecting Elements in the Data Stack 152 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 201: ...Part 3 Appendixes Copyright IBM Corp 1988 2001 183 ...
Страница 202: ...184 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 222: ...Using Variables 204 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 226: ...208 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 238: ...220 z OS V1R1 0 TSO E REXX User s Guide ...
Страница 241: ......