Chapter 5. Using Functions; What Is A Function - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

Chapter 5. Using Functions

What is a Function? . . . . . . . . . . . . . . . . . . . . . . . 61

Built-In Functions . . . . . . . . . . . . . . . . . . . . . . . . 63
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
v User-written functions — These functions are written by an individual user or
v Function packages — These are groups of functions and subroutines written by
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
v Constant
v Symbol
v Literal string
v Option recognized by the function
© Copyright IBM Corp. 1988, 2001
Example of a Function . . . . . . . . . . . . . . . . . . . . . 62
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
about built-in functions appears later in this chapter.
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.
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.
function( )
function(55)
function(symbol_name)
function('With a literal string')
61

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents