## 8.11.2 ENTRY Statements in Subroutine Subprograms

If the ENTRY statement is contained in a subroutine subprogram, it defines an additional subroutine. The name of the subroutine is the name specified in the ENTRY statement.

If RECURSIVE is specified on the SUBROUTINE statement, the interface of the subroutine defined by the ENTRY statement is explicit within the subroutine subprogram.

Examples

The following example shows a main program calling a subroutine containing an ENTRY statement:

    PROGRAM TEST
      ...
      CALL SUBA(A, B, C)       ! A, B, and C are actual arguments
      ...                      !    passed to entry point SUBA
    END
    SUBROUTINE SUB(X, Y, Z)
      ...
      ENTRY SUBA(Q, R, S)      ! Q, R, and S are dummy arguments
      ...                      ! Execution starts with this statement
    END SUBROUTINE

The following example shows an ENTRY statement specifying alternate returns:

    CALL SUBC(M, N, *100, *200, P)
    ...
    SUBROUTINE SUB(K, *, *)
      ...
      ENTRY SUBC(J, K, *, *, X)
      ...
      RETURN 1
      RETURN 2
    END

Note that the CALL statement for entry point SUBC includes actual alternate return arguments. The RETURN 1 statement transfers control to statement label 100 and the RETURN 2 statement transfers control to statement label 200 in the calling program.

For More Information:

For details on implementation of argument association in ENTRY statements, see your user manual or programmer's guide.

Previous Page Next Page Table of Contents