COMTRAN Reconstruction

F28-8043 · June 1960

Page 24

PDF page 30 of 124. Download the scanned PDF

The page as scanned

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

The text read off it

[page 24]

Compound Conditional Expression Interpretation
(MARRIED OR OVER.21) AND HOURLY.RATE IS GREATER THAN 3.50 Either the condition MARRIED or the condition OVER.21 must be met, or both, and, in addition, the condition HOURLY.RATE IS GREATER THAN 3.50 must also be met.
MARRIED AND OVER.21 AND HOURLY.RATE IS GREATER THAN 3.50 All three conditions must be met.
MARRIED OR OVER.21 OR HOURLY.RATE IS GREATER THAN 3.50 The compound condition will be met if any one of the three conditions, or any two, or all three conditions, are met.

Truth Functions

It has been pointed out that conditional expressions may be used in arithmetic expressions in connection with the “truth operator” TR. When the truth operator is used, as explained below, it converts the conditional expression into an arithmetic expression having a value of either 1 or 0. This value can then be used normally in the arithmetic expression.

The conditional expression is placed in parentheses and the operator TR is placed immediately in front of it. The resulting term is called a truth function. The truth operator signals to the system that it must make a test to determine the truth or falsity of the conditional expression. If the condition is found to be true, the truth function as a whole is automatically assigned a value of 1; if the condition is false, the truth function is given a value of 0.

Suppose that a manufacturer agrees to give a discount of five per cent on bills for purchases of more than one thousand dollars. If the amount of the purchase is to be found in a field called ORDER.AMOUNT, the programmer could write such a statement as:

SET DISCOUNT = ORDER.AMOUNT * .05 * TR
    (ORDER.AMOUNT IS GREATER THAN 1000).

The conditional expression ORDER.AMOUNT IS GREATER THAN 1000 will then be examined. If it is found to be true, the whole truth function will be replaced by a value of 1; in this case the discount would be computed as five per cent of the value in the ORDER.AMOUNT field. If the conditional expression is found to be false, the truth function will be given a value of 0, and the net effect would be to cause the discount to be computed as 0.

The truth operator may be used with relational expressions, as in the example given, or with condition-names.

Clauses

The basic components of the Commercial Translator language have now been discussed. The remainder of this chapter will show how these components can be combined to express meanings.

The basic complete unit of meaning in the Commercial Translator language is the sentence. Sentences, however, are composed of one or more shorter units, known as clauses. There are two kinds of clauses: imperative and conditional.