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.
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.