Slank
Field
Specification
Multiple
Use
of
Single
Specifications
cards
or
tape
records.
For
example, suppose
that
a series of calculations
is
to
be
performed
upon
each customer record
card
in a file.
To
identify
the
results of
each
computation
with
the
appropriate
customer name,
the
following
READ
state-
ment
would
be
used:
READ
6,
A,
B,
C
The
data
fields in the
input
card
are
punched
A,
B,
customer name,
and
C,
in
sequence.
The
FORMAT
statement therefore
would
be:
6
FORMAT
(IHO, FS.2, FS.2,
14HbCUSTOMERbNAME,
FS.2)
When
the
first customer
card
is
read
into
the
object program,
the
customer's
name
(assume
it
is Anderson) replaces
the
words "customer name" in storage.
The
computations for
the
first customer
card
would
be
printed
with
the
PRINT
statement
PRINT
6,
A,
B,
C
and
the
printed
line would
be
124.16 19.14
ANDERSON
2461.2.5
Information
handled
with
a
wH
specification is
not
given a variable
name
and
cannot
be
referred to or
manipulated
in
storage
in
any way.
The
maximum
number
of alphameric characters
that
can
be
specified
is
49.
Skipping fields in
input
data
was shown in an earlier example. Blank characters
may
be
provided in
an
output
record
with
the
same specification,
wX.
The
FORMAT
statement
6
FORMAT
(lOX F10.3, E14.S)
would
provide
10
blank
spaces before
the
first value is printed.
It
should
be
remembered
that
if
the
same
FORMAT
statement
is
used
for
both
input
and
output,
the
"skipped"
data
from
the
input
record will
be
punched
or
printed
in
the
output
record. A comma is
not
required
after
the
blank
field specification.
The
maximum blank field specification is 49,
but
two specifications
may
be
written
in
succession to provide more
than
49
blank
positions.
It
was
stated
earlier,
that
each
variable listed
in
an
input
or
output
statement
must
have
a corresponding specification
provided
in
a
FORMAT
statement. How-
ever,
one
specification could
be
used
for one or more variables
in
an
input
list,
if
all
items
in
the
list
required
the
same
specification.
For
example, a
READ
statement containing six variables, all requiring
the
same format specification, could use
the
FORMAT
statement
1
FORMAT
(ES.2)
The
object program processes all
input
and
output
(r/o)
statements
by
(1)
scanning
the
r/o
statement to get
the
name
of
the
variable,
and
(2)
scanning
the
FORMAT
statement to
get
the
specification for
the
variable.
It
repeats this
process
until
all variables have
been
processed.
When
the
program
has
reached
the
last specification in
the
FORMAT
statement,
and
there
are
variables
in
the
r/o
statement
that
have
not
yet
been
processed,
the
program
returns to
the
last
open
parenthesis
in
the
FORMAT
statement
and
continues to scan
the
next specification
in
sequence
from left to right.
The
program
will use
the
FORMAT
specifications
Writing
the
1620
FORTRAN
Program
41