HP 3000 Manuals

DEF FN [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

DEF FN 

The DEF FN statement defines the beginning of a multi-line function.  It
is not executable.

Syntax 

Numeric function: 

DEF [type] FNidentifier [(f_param[,f_param]...)]

String function: 

DEF FNidentifier$ [(f_param[,f_param]...)]

Parameters 

type             Numeric type (for example, INTEGER, SHORT REAL). If type 
                 is specified, the numeric function returns a numeric
                 value of that type.  If type is not specified, the
                 numeric value returned has the default numeric type.  A
                 string function returns a string value.

FNidentifier,    Function name.  A blank is not allowed between FN and
FNidentifier$    the identifier.  For example, if the identifier is Add,
                 the function name is FNAdd or FNAdd$.

f_param          A formal parameter.  Formal parameters for multi-line
                 functions are specified like as they are for
                 subprograms.  The SUBPROGRAM statement explains the
                 specification.

Example 

     DEF INTEGER FNAdd (INTEGER A,B(*), REAL C,D(*), E$(*,*,*),F$,G)
     DEF FNSearch$(E$(*,*,*),F$, G, #20)

Each of the above statements defines the beginning of a multi-line
function.  FNAdd is a numeric (type INTEGER) function, and FNSearch is a
string function.

Each has the following formal parameters:

Parameter        Type 

A                Scalar integer variable
B                Integer array variable
C                Scalar real variable
D                Real array variable
E$               String array variable
F$               Scalar string variable
G                Scalar variable with the default numeric type
#20              File designator

If a program has more than one multi-line function with the same name,
the name refers to the first function with that name; that is, the one
that has the lowest-numbered DEF FN statement.  The others cannot be
called.

If a program unit has a single-line function with the same name as a
multi-line function, that program unit can only call the single-line
function.  Other program units can still call the multi-line function.



MPE/iX 5.0 Documentation