PS TEXT FORMAT Reference Manual
Introduction to TFORM
3–42 11387 Tandem Computers Incorporated
How to Use the FUNCTION Construct
The FUNCTION construct is similar to the MACRO construct. Both
resemble subroutines; that is, they can accept and process arguments. The
FUNCTION construct, however, defines an expression and returns its
value. In addition, FUNCTION constructs cannot produce any lines of text.
The different commands of the FUNCTION construct are described in the
following paragraphs.
FUNCTION
function-name
BEGIN
This command defines a function with that given name. The
commands that follow, up to and including the associated
ENDFUNCTION command, constitute the body of the macro. You
must enter FUNCTION BEGIN by itself on an input line.
Because the purpose of a function is to return a value to be used in an
expression (rather than produce text), the only commands you can use
in a FUNCTION construct are ASSIGN, ERROR, and COMMENT
commands and those in the IF and LOOP constructs. TFORM returns
an error message if it finds other commands or text lines included
within the construct.
The
function-name
must be different from other names of TFORM-
supplied functions and functions you define. You can abbreviate a
function-name
, but this name must remain unique within its first
three characters. If the
function-name
is not unique, TFORM issues
an error message and ignores the function.