IBM 1130 User Manual page 186

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

Advertisement

c. Input and output functions that are common
to more than one processing routine are
controlled by the main line routine.
2. Processing routines
a. A separate processing routine is created
for each logical segment of the program.
It
should accomplish one task in its total-
ity.
b. Each processing routine is complete with-
in itself, with its own defined areas, when
such areas are for the exclusive use of
that routine.
No decision made outside
the segment should determine the proc-
essing within a segment, and likewise, no
decision within a segment should determine
the processing outside the segment.
c. Each routine is designed so that it is, in
effect, an out-of-line subroutine. Control
is transferred to the processing routine
from the main line routine, and when
the routine has performed its function, it
sends control back to the main line routine.
Entrance to and exit from the routine
never depends on a particular preceding
or trailing segment.
d. A processing routine may transfer control
to a multiple-use subroutine. When that
routine has performed its function, it
transfers control back to the processing
routine.
e. Input or output functions that affect only
one processing routine may be performed
by that routine. All segments should
contain their own initialization to ensure
noninterference with other segments.
f. A debugging aid that is sometimes useful
is the inclusion of pauses at the exit of
processing routines. During testing, the
pause indicates that a particular proc-
essing routine has been executed. After
the routine is checked out, the pause is
removed. The insertion of GO TOs into
the program at strategic points may also
be used to bypass the testing of particular
routines. Action to be taken regarding
such PAUSEs and GO TOs must be known
and documented before the testing session.
This technique tends to make good use of
test time.
3. Multiple-use subroutines
a.
If
the same sequence of statements is used
by two or more processing routines, these
statements should be established as a
multiple-use out-of-line subroutine.
Section
Subsections
Page
25
30
I
20
02
b. A multiple-use subroutine must be well
documented for the purpose of program
modification. Comments cards should be
used to indicate which processing routines
call upon each multiple-use routine and to
document the linkage established.
Designing a Run
To design a modular program, determine the pro-
gram variables. List the requirements, elements,
and functions of the pr0gram as they come to mind,
giving no attention to logical order.
Once the variables have been set down, reviewed,
and revised, determine the logical order of the proc-
essing routines, and design the main line of your
program. Construct your main line so that the
largest volume of data is processed by the lowest
number of instructions - that is, in the fastest
possible way. A speedy main line contributes
greatly to the throughput capabilities of your pro-
gram.
Once you have established the logic of your main
line, draw the overall, big-picture, system flow-
chart. Give careful attention to this diagram be-
cause it will tend to reveal most errors in logic.
The following components are generally found to
be present in the main line of typical programs:
1.
Beginning of item. Before obtaining a record,
it is often necessary to initialize certain switches,
counters, and areas. Generally, fewer ins tructions
are required to initialize before entering a routine
than after exiting from it, since routines commonly
have several exits.
2. Obtain the item. This segment of the run
retrieves the record, sequence-checks the file, and
updates the input control.
3. Process the item. The processing of the
record is accomplished. The main line transfers
control to the proper processing routines in the
proper sequence.
4. End of item. Generally, there are a few in-
structions to be executed just before disposing of a
record. The instructions associated with the clean-
up work for the present record should not be con-
fused with initialization for the next record.
5. Dispose of the item. This segment of your
run generally puts the record in an output file, up-
dates the output controls, and transfers the program
to the beginning-of-item routine to start the loop
again.
Use the modular technique with a block wherever
it simplifies the logic of the processing routine.
Each routine should be as efficient as possible.

Advertisement

Table of Contents
loading

Table of Contents