FUNCTION Statement (Nonexecutable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation
HP FORTRAN 77/iX Reference
FUNCTION Statement (Nonexecutable)
The FUNCTION statement identifies a program unit as a function
subprogram.
Semantics
For more information on types, refer to the discussions of each type
elsewhere in this chapter. If the type is not specified, the name is
typed the same way as the variables.
The formal arguments in a FUNCTION statement can be used as:
* Variables.
* Array names.
* Subprogram names.
* Record names.
The formal arguments should be of the same type as the actual arguments
that are passed to the function from the calling program unit. When
passing records as arguments to a function, all fields must be the same
type, order, and dimension as the declared formal arguments.
If a formal argument of type character has a length of (*) declared, the
formal argument assumes the length of the associated actual argument
for each reference of the function. If the function is of type
CHARACTER*(*), it assumes the length declared for it by the calling
program. (The length may be subsequently redefined within the calling
program.)
Examples Notes
---------------------------------------------------------------------------------------
FUNCTION comp() Defines a function comp with no arguments.
INTEGER FUNCTION timex(a,b,k) Defines an integer function timex with
three arguments.
CHARACTER*6 FUNCTION namex(q) Defines a character function namex six
characters long, with one argument.
MPE/iX 5.0 Documentation