### 6.2.4.2 ENTRY Statements in Subroutine Subprograms

To refer to an entry point name in a subroutine, you should issue a CALL statement that includes the entry point name defined in the ENTRY statement. In the following example, the call is to an entry point (SUBA) within the subroutine (SUB). Execution begins with the first statement following ENTRY SUBA (Q,R,S), using the actual arguments (A,B,C) passed in the CALL statement.

Main Program | Subroutine
--- | ---
`CALL SUBA(A,B,C)` | `SUBROUTINE SUB(X,Y,Z)`
`. . .` | `. . .`
| `ENTRY SUBA(Q,R,S)`

Alternate returns can be specified in ENTRY statements, for example:

    SUBROUTINE SUB(K,*,*)

    ENTRY SUBC(J,K,*,*,X)

     . . .

    RETURN 1

    RETURN 2

    END

If you issue a call to entry point SUBC, you must include actual alternate return arguments, such as:

    CALL SUBC(M,N,*100,*200,P)

In this case, 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.

Previous Page Next Page Table of Contents