Chapter 5. Using Functions
What is a Function? . . . . . . . . . . . . . . . . . . . . . . . 61
Example of a Function . . . . . . . . . . . . . . . . . . . . . 62
Built-In Functions . . . . . . . . . . . . . . . . . . . . . . . . 63
Arithmetic Functions . . . . . . . . . . . . . . . . . . . . . . 63
Comparison Functions . . . . . . . . . . . . . . . . . . . . . 63
Conversion Functions
. . . . . . . . . . . . . . . . . . . . . 64
Formatting Functions. . . . . . . . . . . . . . . . . . . . . . 64
String Manipulating Functions
. . . . . . . . . . . . . . . . . . 64
Miscellaneous Functions . . . . . . . . . . . . . . . . . . . . 65
Testing Input with Built-In Functions . . . . . . . . . . . . . . . . 66
Exercise - Writing an Exec with Built-In Functions . . . . . . . . . . 66
This chapter defines what a function is and describes how to use the built-in
functions.
What is a Function?
Afunction is a sequence of instructions that can receive data, process that data, and
return a value. In REXX, there are several kinds of functions:
v
Built-in functions — These functions are built into the language processor. More
about built-in functions appears later in this chapter.
v
User-written functions — These functions are written by an individual user or
supplied by an installation and can be internal or external. An
internal function
is
part of the current exec that starts at a label. An
external function
is a
self-contained program or exec outside of the calling exec. More information
about user-written functions appears in “Writing a Function” on page 77.
v
Function packages — These are groups of functions and subroutines written by
an individual user or supplied by an installation. They are link-edited into load
modules and categorized as user, local, and system. TSO/E external functions
are provided in a system function package. More information about TSO/E
external functions appears in “TSO/E External Functions” on page 119.
Regardless of the kind of function, all functions return a value to the exec that
issued the function call. To call a function, type the function name directly followed
by one or more arguments within parentheses.
There can be no space between
the function name and the left parenthesis.
function(arguments)
A function call can contain up to 20 arguments separated by commas. Each
argument can be one or more of the following.
v
Blank
function( )
v
Constant
function(55)
v
Symbol
function(symbol_name)
v
Literal string
function('With a literal string')
v
Option recognized by the function
© Copyright IBM Corp. 1988, 2001
61
Содержание 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: ......