Intel fortran-80 Laptop User Manual


 
Functions
And
Subroutines
5-6
The
subroutine
is
called by
the
CALL
statement.
PROGRAM
CALL
..
SUBROUTINE
.~RETURN
CA.~END
END
Subroutines,
being external
procedures,
can be defined
outside
the
program.
By
the
time a
program
containing
a
CALL
to
the
subroutine
is
executed, however, the
subroutine
must be
part
of
the
calling
program,
either by
SUBROUTINE
sub-
program
definition
or
by being linked
to
the
program.
External
procedure
linkage
is
described in the
FORTRAN
compiler
operator's
manual.
5.2.3 SUBROUTINE Statement
The
SUBROUTINE
statement
is
used only as the first
statement
of
a
SUBROUTINE
subprogram.
Its
format
is
SU
BROUTI N E
sub[([dum[,dum
] ... ])]
where
sub
is
the symbolic
name
of
the
subroutine.
dum
is
a
dummy
argument
and
is
either a variable,
array,
or
dummy
procedure
name.
If
no
dummy
arguments
are
specified, either
of
the
forms
'SUBROUTINE
sub'
or
'SUBROUTINE
subO'
is
acceptable.
The
symbolic
name
of
the
subroutine
is
a global
name
and
must
not
be the
same
as
any
other
name
in the
program
unit.
The
symbolic
name
of
a
dummy
argument
is
local to the
program
unit
and
cannot
be
used in
an
EQUIVALENCE,
SAVE,
INTRINSIC,
DATA,
or
COMMON
state-
ment,
except as a
common
block
name.
An
example
is
shown following
the
RETURN
statement.
5.2.4 RETU
RN
Statement
The
RETURN
statement
returns
control
to
the
calling
program
unit. It
may
appear
only in a
FUNCTION
or
SUBROUTINE
subprogram.
These
subprograms
may
have
one
or
more
RETURN
statements,
or
they
may
have
none
at all.
The
END
statement
terminating
such a
program
unit has the
same
effect as a
RETURN.
The
format
of
the
RETURN
statement
is
simply
RETURN
FORTRAN-SO