FORTRAN 77 Language Reference

Examples

Example 1: Multiple entry points in a subroutine


       SUBROUTINE FIN( A, B, C ) 
       INTEGER A, B 
       CHARACTER C*4 
       ... 
       RETURN 

       ENTRY HLEP( A, B, C ) 
       ... 
       RETURN 

       ENTRY MOOZ 
       ... 
       RETURN 
       END 

:

In the above example, the subroutine FIN has two alternate entries: the entry HLEP has an argument list; the entry MOOZ has no argument list.

Example 2: In the calling routine, you can call the above subroutine and entries as follows:


       INTEGER A, B 
       CHARACTER C*4 
       ... 
       CALL FIN( A, B, C ) 
       ... 
       CALL MOOZ 
       ... 
       CALL HLEP( A, B, C ) 
       ... 

In the above example, the order of the call statements need not match the order of the entry statements.

Example 3: Multiple entry points in a function:


       REAL FUNCTION F2 ( X ) 
       F2 = 2.0 * X 
       RETURN 

       ENTRY F3 ( X ) 
       F3 = 3.0 * X 
       RETURN 

       ENTRY FHALF ( X ) 
       FHALF = X / 2.0 
       RETURN 
       END