HP 3000 Manuals

CALL Statement (Executable) [ HP FORTRAN 77/iX Reference ] MPE/iX 5.0 Documentation


HP FORTRAN 77/iX Reference

CALL Statement (Executable) 

The CALL statement transfers control to a subroutine.

	       Click here to view figure.
            

-----------------------------------------------------------------------------------------------
|                   |                                    |                                    |
|       Item        |        Description/Default         |            Restrictions            |
|                   |                                    |                                    |
-----------------------------------------------------------------------------------------------
|                   |                                    |                                    |
| *                 | Alternate return.                  | None.                              |
| &                 |                                    |                                    |
|                   |                                    |                                    |
-----------------------------------------------------------------------------------------------
|                   |                                    |                                    |
| label             | Statement label of an executable   | Must be in the same program unit   |
|                   | statement.                         | as the CALL statement.             |
|                   |                                    |                                    |
-----------------------------------------------------------------------------------------------

Semantics 

When a CALL statement is executed, any expressions in the actual argument
list are evaluated and control passes to the subroutine.  For a normal
return from the subroutine, execution continues with the statement
following the CALL statement.  When an alternate return is taken,
execution continues with the statement label in the actual argument list
that corresponds to the return number specified in the subroutine's
RETURN statement.

The use of & as an alternate return is an extension to the ANSI 77
standards. 

                 Examples                                      Notes 

---------------------------------------------------------------------------------------

CALL print_forms(top,lh,rh)                 Calls the subroutine print_forms.  Passes
                                            three arguments.

CALL exit                                   Calls the subroutine exit.  Passes no
                                            arguments.

CALL test_data (m,n,val,*10)                Calls the subroutine test_data.  Passes
:                                           three arguments.  *10 means that the return
10 total = val + 6.34                       point is the statement labeled 10 if the
:                                           subroutine executes the alternate return
END                                         RETURN 1.
SUBROUTINE test_data (j,k,w,*)
:
RETURN 1
:
END

As an extension to the FORTRAN 77 standard, a call can be made with
arguments missing.  The compiler passes a zero by value for any missing
arguments.  For example, the statement:

     CALL fun (a,,b,,)

is equivalent to:

     CALL fun (a,0,b,0)

with the zero being passed by value.



MPE/iX 5.0 Documentation