XL Fortran for AIX 8.1

Language Reference



A function subprogram or subroutine subprogram has a primary entry point that is established through the SUBROUTINE or FUNCTION statement. The ENTRY statement establishes an alternate entry point for an external subprogram or a module subprogram.


        '-dummy_argument_list-'     '-RESULT--(--result_name--)-'

is the name of an entry point in a function subprogram or subroutine subprogram


The ENTRY statement cannot appear in a main program, block data program unit, internal subprogram, IF construct, DO construct, CASE construct, derived-type definition, or interface block.

+-------------------------------IBM Extension--------------------------------+

The ENTRY statement cannot appear in a CRITICAL, MASTER, PARALLEL, PARALLEL SECTIONS, SECTIONS, or SINGLE construct.

+----------------------------End of IBM Extension----------------------------+

An ENTRY statement can appear anywhere after the FUNCTION or SUBROUTINE statement (and after any USE statements) of an external or module subprogram, except in a statement block within a control construct, in a derived-type definition, or in an interface block. ENTRY statements are nonexecutable and do not affect control sequencing during the execution of a subprogram.

The result variable is result_name, if specified; otherwise, it is entry_name. If the characteristics of the ENTRY statement's result variable are the same as those of the FUNCTION statement's result variable, the result variables identify the same variable, even though they can have different names. Otherwise, they are storage-associated and must be all nonpointer scalars of intrinsic (noncharacter) type. result_name can be the same as the result variable name specified for the FUNCTION statement or another ENTRY statement.

The result variable cannot be specified in a COMMON, DATA, integer POINTER, or EQUIVALENCE statement, nor can it have the PARAMETER, INTENT, OPTIONAL, SAVE, or VOLATILE attributes. The STATIC and AUTOMATIC attributes can be specified only if the result variable is not an array or a pointer and is not of character or derived type.

If the RESULT keyword is specified, the ENTRY statement must be within a function subprogram, entry_name must not appear in any specification statement in the scope of the function subprogram, and result_name cannot be the same as entry_name.

A result variable cannot be initialized in a type declaration statement.

The entry name in an external subprogram is a global entity; an entry name in a module subprogram is not a global entity. An interface for an entry can appear in an interface block only when the entry name is used as the procedure name in an interface body.

In a function subprogram, entry_name identifies an external or module function that can be referenced as a function from the calling procedure. In a subroutine subprogram, entry_name identifies a subroutine and can be referenced as a subroutine from the calling procedure. When the reference is made, execution begins with the first executable statement following the ENTRY statement.

The result variable must be defined prior to exiting from the function, when the function is invoked through that entry.

A name in the dummy_argument_list must not appear in the following places:

The order, number, type, and kind type parameters of the dummy arguments can differ from those of the FUNCTION or SUBROUTINE statement, or other ENTRY statements.

If a dummy argument is used in a specification expression to specify an array bound or character length of an object, you can only specify the object in a statement that is executed during a procedure reference if the dummy argument is present and appears in the dummy argument list of the procedure name referenced.


An ENTRY statement can reference itself directly only if the subprogram statement specifies RECURSIVE and the ENTRY statement specifies RESULT. The entry procedure then has an explicit interface within the subprogram. The RESULT clause is not required for an entry to reference itself indirectly.

+---------------------------------Fortran 95---------------------------------+

Elemental subprograms can have ENTRY statements, but the ENTRY statement cannot have the ELEMENTAL prefix. The procedure defined by the ENTRY statement is elemental if the ELEMENTAL prefix is specified in the SUBROUTINE or FUNCTION statement.

+-----------------------------End of Fortran 95------------------------------+

If entry_name is of type character, its length cannot be an asterisk if the function is recursive.

+-------------------------------IBM Extension--------------------------------+

You can also call external procedures recursively when you specify the -qrecur compiler option, although XL Fortran disregards this option if a procedure specifies either the RECURSIVE or RESULT keyword.

+----------------------------End of IBM Extension----------------------------+


ENTRY ENT () RESULT (RES) ! The result variable name can be ! the same as for the function

Related Information

[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]