PAUSE
Statement
STOP
Statement
DO
Statement
26
The
program transfers to
the
statement
numbered
n
1
when
the
designated
program switch is on,
or
to
the
statement
numbered
n2
when
it
is
off.
The
PAUSE
statement
is
used
as a convenient means of causing
the
object
pro-
gram to
halt
temporarily. Halting
the
object program
is
sometimes
required
so
that
the
machine operator
may
check
part
of
the
output
to determine
if
one
or
more values
are
within predetermined limits before continuing
with
the
program.
The
PAUSE
statement
is also useful as
an
aid
in
the
initial testing
of
a
new
pro-
gram.
PAUSE
statements, located
at
the
end
of
one
or
more phases
in
a program,
permit you to check
the
accuracy
or
validity of a
part
of a problem
by
checking
the
data
obtained
in
that
part
before altering
the
data
in subsequent operations
in the program.
Example:
PAUSE
]
Format:
I "PAUSE"
The
PAUSE
causes
the
computer to halt. Pressing the
start
switch causes the
program to resume
with
the
statement following
the
PAUSE
statement.
This statement causes the computer to
halt
during
the
processing
of
the object
program, to
return
the
typewriter carriage,
and
to
type
the
word "stop."
In
con-
trast to
the
PAUSE,
this statement
is
used
where
a final, rather
than
a temporary,
stop is required.
Example:
i"STOP"
Format:
STOP
As
discussed earlier,
the
ability of
the
FORTRAN
program to
repeat
the
same
operations
with
different data, called looping,
is
a powerful tool which greatly
reduces programming effort.
There
are
several ways to accomplish looping;
one
way
is to use
an
IF
statement.
For
example, assume
that
a
plant
carries 1,000
parts in inventory. Periodically
it
is
necessary to
compute
stock
on
hand
of each
item
(INV),
by
subtracting stock withdrawals of
that
item
(lOUT)
from a previ-
ous stock on hand.
It
would
be
wasted
effort to write a
program
which would indicate each of
the
1,000 separate subtractions
by
a separate statement.
(It
would also waste
computer storage, since
each
separate instruction to
the
computer
must
be
in
computer storage.)
The
same results could
be
achieved
by
the
following pro-
gram:
STATEMENT
FORTRAN STATEMENT
NUMBER
I
5 6 7
10
IS
20 25
30
35
40 45
50
55
-
-
•
1 J I i
,
,
I
,
I I
•
, ,
5
J=O
I
, , ,
10
JaJ+"
,
25
INv('J)~INV(J)-IOUTLJ)
I I I
15
IF.tI
OOO-JI
)20
,20
10
,
.
20
•
1 i 1 i i i i i J
I
•
, , ,
I
I I
I
I
I
! ,
•
,
_~~~L~_
•
,
I
,
1 1 J J
,
,
,
,
,
,
,
,
I I I