The ENTRY statement permits a program unit to define multiple procedures, each with a different entry point.
SyntaxENTRY entry-name [( [dummy-arg-list] ) [RESULT (result-name)]]Where:
entry-name is the name of the entry.
dummy-arg-list is a comma-separated list of dummy arguments or * alternate return indicators.
result-name is a variable containing a function result.
An ENTRY statement can appear only in a subroutine or function.
If the ENTRY statement is in a function, an additional function is defined by that subprogram named entry-name.
If result-name is present, the result variable is named result-name.
If result-name is absent, the result variable is named entry-name.
The characteristics of the function result are specified by the result variable.
If the ENTRY statement is contained in a subroutine subprogram, an additional subroutine is defined by that subprogram. The name of the subroutine is entry-name.
The dummy arguments of an ENTRY subprogram are solely defined by the ENTRY statement's argument list.
A dummy argument may not appear in an executable statement before it is introduced in an ENTRY statement.
Any dummy argument not introduced by an ENTRY statement is considered undefined and may not be referenced within the scope of that ENTRY subprogram.
RESULT can be present only if the ENTRY statement is in a function subprogram.
If RESULT is specified, entry-name must not appear in any specification statement in the scoping unit of the function program.
If RESULT is specified, result-name cannot be the same as entry-name.
entry-name may not be a dummy argument, or appear in an EXTERNAL or INTRINSIC statement.
An ENTRY statement must not appear within an executable construct such as DO, IF, CASE, etc.
A dummy argument can be an alternate return indicator only if the ENTRY statement is contained in a subroutine subprogram.
If the subprogram unit containing the ENTRY statement is declared as RECURSIVE, PURE or ELEMENTAL, the subprogram defined by the ENTRY statement also has those attributes.
Exampleprogram main call sub1() call sub1entry() end program main subroutine sub1() write(*,*) 'subroutine call executes this part' entry sub1entry() write(*,*) 'both calls execute this part' end subroutine sub1