5.1 CALL Statement

The CALL statement executes a subroutine subprogram or other external procedure. It can specify an argument list for the subroutine. The CALL statement takes the following form:

CALL sub [([a] [,[a]]. . .)]
sub
Is the name of a subroutine subprogram or other external procedure, or a dummy argument associated with a subroutine subprogram or other external procedure.
a
Is an actual argument.

Rules and Behavior

If you specify an argument list, the CALL statement associates the values in the list with the dummy arguments in the subroutine. It then transfers control to the first executable statement following the SUBROUTINE or ENTRY statement referenced by the CALL statement.

The arguments in the CALL statement must agree in number, order, and data type with the dummy arguments in the subroutine. They can be variables, arrays, array elements, records, record elements, record arrays, record array elements, substring references, constants, expressions, Hollerith constants, alternate return specifiers, or subprogram names. An unsubscripted array name or record array name in the argument list refers to the entire array.

Compaq Fortran 77 allows direct or indirect recursive calls to subroutines, if you specify the compiler option RECURSIVE.

Examples

The following examples show valid CALL statements. The last CALL statement uses statement label identifiers in its argument list. The asterisks indicate that *10 and *20 are statement label identifiers. Label identifiers that are prefixed by an asterisk (*), or an ampersand (&), are called alternate return specifiers.

CALL CURVE(BASE,3.14159+X,Y,LIMIT,R(LT+2))

CALL PNTOUT(A,N,'ABCD')

CALL EXIT

CALL MULT(A,B,*10,*20,C)

For More Information:


Previous Page Next Page Table of Contents