FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-35
ENTRY Statement
°
In a function subprogram, an entry point name must not appear in any
statement other than a type declaration statement preceding the ENTRY
statement for that name.
°
A dummy argument name must not appear in any statement in a subprogram
other than a type declaration statement prior to its first appearance as a
dummy argument in a SUBROUTINE, FUNCTION, or ENTRY statement.
°
A dummy argument must not be used in an executable statement if the
subprogram is entered via an entry point for which the dummy argument is not
in the argument list of the ENTRY point invoked by the subprogram’s caller.
Example
If the function below is called by the statement
plus = ADD(amt)
FORTRAN ignores the ENTRY statement and executes statements 1, 3, and 4. If the
program is called by the statement
more = ADD1(num, mice)
FORTRAN executes statements 2, 3, and 4.
FUNCTION add(a)
1 b = a**2
GO TO 3
ENTRY add1(a,b)
2 c = b
3 add = a + c
4 RETURN
END
Within a function subprogram all variables whose names are also the names of entries
are associated with each other and with the variable whose name is also the name of
the function subprogram. Therefore, in the preceding example, when ADD becomes
defined, ADD1 also becomes defined.