COMTRAN Reconstruction

F28-8043 · June 1960

Page 6

PDF page 12 of 124. Download the scanned PDF

The page as scanned

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

The text read off it

[page 6]

Example 3

To introduce a few more features of the Commercial Translator we use a common payroll example:

Coding-form facsimile for Example 3, showing a payroll IF...AND...THEN...OTHERWISE procedure statement Coding-form facsimile: Example 3 procedure statement (page 6).

SERIAL   PROCEDURE NAME          TEXT
 01                                IF HOURLY AND HOURS.WORKED IS LESS
 02                                THAN 40 THEN GO TO GROSS.PAY
 03                                OTHERWISE GO TO NET.PAY.
 04      GROSS.PAY.                [rest of line: wavy omission rule — routine body not shown]
         ⋮  (lines 05-18 omitted from the facsimile, marked with a wavy omission rule)
 19      NET.PAY.                  [rest of line: wavy omission rule — routine body not shown]

The conditional clause in this example is different from what we have seen previously. The first part of the clause consists just of the word HOURLY, which is called a condition-name. HOURLY is one of the possible values which can be assumed by the implied data-name PAYROLL.TYPE, the other values being EXEMPT, SALARIED and TEMPORARY. Since there are only a few of these conditions, it is convenient for the programmer to use his normal terminology. The actual machine instructions are set up to work with a coded representation of these values, e.g., the numbers 1, 2, 3, and 4. Obviously, some way must be provided to correlate the condition-names with the corresponding values. Establishing this correspondence is one of the functions of the data description. Shown below is the appropriate part of the data description required for this example.

Coding-form facsimile of the data description for PAYROLL.TYPE and its condition-names EXEMPT, SALARIED, HOURLY, TEMPORARY Coding-form facsimile: data description for Example 3 (page 6).

SERIAL   DATA NAME          LEVEL   TYPE    DESCRIPTION
 01      PAYROLL.TYPE         03                9
 02      EXEMPT                04    COND      '1'
 03      SALARIED              04    COND      '2'
 04      HOURLY                04    COND      '3'
 05      TEMPORARY             04    COND      '4'

PAYROLL.TYPE is defined as a level 03 entry which indicates its relative importance with respect to other elements of data. The 9 specifies that the data is numeric, and the fact that there is only one 9 means that the field consists of one digit. EXEMPT, SALARIED, HOURLY and TEMPORARY are named as the four conditions by listing them with COND in the Type columns, and the code number used for each is given in quote marks. Thus, in this example, the value of PAYROLL.TYPE is 3 whenever HOURLY is meant.

The second part of the conditional clause is:

HOURS.WORKED IS LESS THAN 40

In this case the value of the data-name HOURS.WORKED is compared with the number 40; 40 is not to be interpreted as a data-name, but literally as the value 40 itself. We speak of 40 as being a numeric literal.

The second part of the conditional clause is joined to the first part by the fixed word AND which specifies that both the first part and the second part of the clause must be satisfied before carrying out the operations that follow THEN. This is shown