COMTRAN Reconstruction

F28-8043 · June 1960

Page 48

PDF page 54 of 124. Download the scanned PDF

The page as scanned

The scan of PDF page 54 of F28-8043
Select the scan to open it at full size.

The text read off it

[page 48]

Control Commands

The control commands enable the programmer to state the logical flow of a program. During the execution of the object program the procedure is normally executed in the order in which it appears in the source program. The control commands are used primarily to specify a departure from this sequence in order to execute some other portion of the program. The verbs that form the basis of the Commercial Translator control commands are GO TO, DO, and STOP.

The GO TO Command

The GO TO command is used to specify transfer-type operations. It has three forms:

UNCONDITIONAL

The unconditional GO TO is written:

GO TO procedure.name

It provides a transfer of control, or branching, to the item of procedure named in the command. The "procedure.name" may be the name of either a sentence or a section in the procedural part of the source program.

Some examples are:

GO TO MAIN.ROUTINE.
GO TO CALC.ORDER.POINT.
CONDITIONAL

The conditional GO TO command is essentially a multiple branch or switching point; from this point, control may pass to one of several places in the program. As the name implies, the transfer of control depends on the truth or falsity of one or more conditional expressions. The general form of the command is:

GO TO procedure.name.1 WHEN conditional expression 1,
     procedure.name.2 WHEN conditional expression 2, ...
     procedure.name.n WHEN conditional expression n

When the conditional GO TO is executed at object time, each conditional expression is evaluated in turn until one is found to be true. Thereupon, control is transferred to the "procedure.name" associated with that conditional expression. Any remaining conditional expressions are left unevaluated. If none of the conditional expressions in the command is found to be true, control passes to the next clause or sentence in sequence.

The following is a typical use of the conditional GO TO:

GO TO ERROR.RTN WHEN DETAIL IS LESS THAN MASTER,
     PROCESSING WHEN DETAIL IS EQUAL TO MASTER,
     NO.ACTIVITY WHEN DETAIL IS GREATER THAN MASTER.
ASSIGNED

The assigned GO TO command also serves as a multiple branch point in a program. In this case, however, the transfer of control depends upon the prior setting of an