COMTRAN Reconstruction

F28-8043 · June 1960

Page 49

PDF page 55 of 124. Download the scanned PDF

The page as scanned

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

The text read off it

[page 49]

index rather than on the truth or falsity of conditional expressions. The setting of the index may have occurred in one of two ways:

  1. Through bringing the index into storage as a constant or file variable.
  2. As a result of computation involving the index.

The general form of the command is:

GO TO ( procedure.1, procedure.2, ... procedure.n ) ON index.name

A transfer of control will be made according to the value of the index at the time the GO TO is executed. If the value of the index is 1, control will pass to the first sentence or section of procedure named in the command; if 2, the second item named; and so on.

The functioning of the assigned GO TO command assumes that the value of the index will always be an integer in the range 1 to n. If the index has any other value, no transfer will occur; instead, control will pass to the next clause or sentence in sequence.

To illustrate, suppose that in a payroll job several different methods are used to compute gross pay depending on the employee's classification. The programmer might use an assigned GO TO command to effect a transfer to the appropriate routine, as follows:

GO TO (PIECE.WORK, INCENTIVE, HOURLY.RATE, SALARY) ON
     PAY.TYPE.

The index PAY.TYPE in this case would be a field in each employee record which would contain a 1, 2, 3, or 4 depending on the employee's classification.

Note that the parentheses shown in both the general form and the example are a fixed part of the command and must always be included.

The DO Command

The DO command provides a means of departing from the normal sequence of program steps in order to execute some procedure, i.e., some other portion of program, and then return to the original sequence. In other words, the DO is used to execute subroutines which, in the Commercial Translator system, are either named sentences or sections.

The DO command may take one of several forms. In the simplest form of the command the procedure is executed once each time the DO is encountered. Expanded forms of the command permit repetitive execution, or "looping," of the subroutine and control of subscripts. Data substitution, which is an optional feature, is also provided.

The simpler forms of the DO command are:

DO procedure.name
DO procedure.name EXACTLY n TIMES

where "procedure.name" represents the name of a sentence or section. (If a procedure consists of more than one sentence, it must be defined as a section in order to be named. The processor commands BEGIN SECTION and END are used to define