 |
» |
|
|
 |
Invokes a subroutine. SyntaxCALL subr-name[([ subr-act-arg-spec-list ])] |
- subr-name
is the name of the subroutine being invoked. - actual-argument-list
is a comma-separated list of entities of the form: [keyword
=]actual-argument - actual-argument
is one of the following: - keyword
is one of the dummy argument names of the subroutine
being invoked. If any keyword is specified,
the subroutine interface must be explicit.
DescriptionA CALL
statement is used to invoke (call) a subroutine, and to specify
actual arguments, if any. Execution of the subroutine begins with
the first executable statement. The following sequence of events
occurs when a CALL
statement executes: Actual arguments that are expressions are evaluated. The actual arguments are associated with the corresponding
dummy arguments. Control transfers to the subroutine being called,
and the subroutine executes. Control returns from the subroutine, normally to
the statement following the CALL
statement, or to a statement label indicated by an alternate return
argument—*label
or &label.
(The &label form is provided as a compatibility extension
and can be used in fixed source form only.)
A subroutine can call itself, directly or indirectly; in this
case the keyword RECURSIVE
must be specified in the SUBROUTINE
statement of the subroutine definition. The %VAL
and %REF built-in
functions are provided as HP extensions. They can be used to change
argument-passing conventions calling a routine written in another
language. The only subroutine invocation other than by the CALL
statement in Fortran 90 is through "defined assignment",
where a defined type assignment operator that has been defined by
means of a subroutine is used. Examples! Interface for subroutine draw INTERFACE SUBROUTINE draw (x_start, y_start, x_end, y_end, form, scale) REAL x_start, y_start, x_end, y_end CHARACTER (LEN = 6), OPTIONAL :: form REAL, OPTIONAL :: scale END SUBROUTINE draw END INTERFACE ! References to draw ! arguments given by position; optional argument scale omitted CALL draw (5., -4., 2., .6, "DASHED") ! arguments given by keyword; optional argument form omitted CALL draw (scale=.4, x_end=0., y_end=0., x_start=.5, y_start=.3) |
Related statementsINTERFACE
and SUBROUTINE Related conceptsFor related information, see the following:
|