IBM 1130 User Manual page 566

Computing system
Hide thumbs Also See for 1130:
Table of Contents

Advertisement

Reducing Program Size
Use the DATA Statement
The DATA statement is a recent addition to 1130
FORTRAN, having been incorporated into Version 2
of the 1130 Monitor System.
Basically, it is used
to create constants at the time the program is com-
piled, rather than each time the program is exe-
cuted. It saves some time, but this should not be
enough to notice in the overall run time of most
programs.
Much more important, the DATA state-
ment saves core storage.
It is a nonexecutable statement, like the TYPE,
DIMENSION, EQUIVALENCE, etc., statements,
and requires no core storage. It provides only a
starting value for variables.
For exact rules con-
cerning the use of the DAT A statement, see the 1130
FORTRAN manual; in this section you will see some
examples of its use.
Case 1: Initialize Tables at the Beginning of
a Program
Almost every program begins with statements
such as
DO 16 J = 1,50
TOT(J) = 0.0
16 SUBT(J) = 0.0
This coding, which requires about 27 words of
storage, can be replaced with
DATA TOT/50*0. 0/, SUBT/50*0.0/
which requires no storage.
Let us stress three facts at this point:
1. You still require two 50-position arrays.
The DATA statement merely takes care of initial-
izing their values.
2. If you say TOT (1) =
1.
5 later in the program,
this will be done, and TOT (1) will no longer be O. O.
3. If you want to clear out these tables again
during the execution of the program, you must use
the conventional DO loop.
You cannot GO TO or
reexecute the DATA statement, since it is a non-
executable statement and, in fact, no longer exists
once the program is loaded.
Section
Subsections
Page
70
50
I
10
Case 2: Initialize Indicators, etc.
The program PAY04, listed in Subsection
70.50.30, contains the following FORTRAN
statements:
T
=
O.
IERR = 0
ICOL = 1
INI
=
1
XOT:::: O.
XBN = O.
XSP = O.
XREG = O.
IPAGE = 0
LINE = 50
01
which require 40 words of object coding.
They may
be replaced by
DATA T/O./, IERR/O/, ICOL/l/, etc., etc.
Case 3: Setting a Variable to Different Values
Again inspecting the same program, PAY04, we
find
GO TO (76,77,78,79,80,81), NOPLT
76ILST=250
GO TO 83
77ILST=90
GO TO 83
78ILST=200
GO TO 83
79ILST=50
GO TO 83
80ILST=150
GO TO 83
81ILST=30
83 continue
which requires 44 words of object coding. It may be
replaced by a combination of
DIMENSION IFACT (6)
DATA IFACT/250, 90, 200, 50, 150, 30/
and the statement (using eight words)
ILST = IFACT(NOPLT)
PlaCing the six constants in the IFACT array adds
no core requirements, since they were in core
before, as INTEGER CONSTANTS (see listing at
end of compilation).

Advertisement

Table of Contents
loading

Table of Contents