FORTRAN 77 Language Reference


Arguments are separated by commas.

The FORTRAN 77 Standard requires that actual arguments in a CALL statement must agree in order, number, and type with the corresponding formal arguments of the referenced subroutine. The compiler checks this only when the -XlistE option is on.

Recursion is allowed. A subprogram can call itself directly, or indirectly by calling another subprogram that in turns calls this subroutine. Such recursion is nonstandard. @

An actual argument, ar, must be one of the following:

The simplest expressions, and most frequently used, include such constructs as:

If a subroutine has no arguments, then a CALL statement that references that subroutine must not have any actual arguments. A pair of empty matching parentheses can follow the subroutine name.

Execution of the CALL statement proceeds as follows:

  1. All expressions (arguments) are evaluated.

  2. All actual arguments are associated with the corresponding formal arguments, and the body of the subroutine is executed.

  3. Normally, the control is transferred back to the statement following the CALL statement upon executing a RETURN statement or an END statement in the subroutine. If an alternate return in the form of RETURN n is executed, then control is transferred to the statement specified by the n alternate return specifier in the CALL statement.

    Note -

    A CALL to a subprogram defined as a FUNCTION rather than as a SUBROUTINE will cause unexpected results and is not recommended. The compiler does not automatically detect such inappropriate CALLs and no warning is issued unless the -Xlist option is specified.