COMTRAN Reconstruction

F28-8043 · June 1960

Page 8

PDF page 14 of 124. Download the scanned PDF

The page as scanned

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

The text read off it

[page 8]

A conditional clause starts with IF and contains one or more conditional expressions; the actions to be taken if the conditional clause is true are described by one or more commands introduced by THEN. If the conditional clause is false, the commands following THEN are ignored and instead the commands introduced by OTHERWISE are executed. Conditional clauses are dependent clauses and must always be followed by at least one command.

Still another concept of the language is that of processor commands. So far, we have been discussing program commands, that is, commands which state the data processing steps to be carried out by the object program. The processor commands, on the other hand, tell the processor how to organize the object program rather than what the object program is to do. One kind of processor command, BEGIN SECTION, simply tells the processor that the following sentences are to be referred to collectively by the designated name; it does not directly cause machine instructions to be created in the object program.

The reader may wish to consider the examples which follow in the light of these general observations about the elements and structure of the language.

Example 4

The fourth example is based on a part of an inventory control calculation. Suppose that we already have in storage in the data processing system a complete inventory record for one part number, and that there is also in storage a transaction record for that part number. Assume that there are just four types of transactions: withdrawals, receipts, returns and stock recounts. The part of the job that we wish to consider is how to take action appropriate to the type of transaction. The program shown below is a little longer than the ones we have seen before, but most of the ideas in it are already familiar.

Coding-form facsimile for Example 4, showing an inventory transaction-routing procedure with a NOTE and an assigned GO TO Coding-form facsimile: Example 4 procedure statement (page 8).

SERIAL   PROCEDURE NAME          TEXT
 01                                NOTE INVENTORY RECORD MAINTENANCE.
 02                                GO TO (WITHDRAWAL.ROUTINE, RECEIPT.ROUTINE,
 03                                RETURN.PROCESS, RECOUNT.PROCEDURE) ON
 04                                TYPE.OF.TRANSACTION.
 05      WITHDRAWAL.ROUTINE.       SET QUANTITY.ON.HAND =
 06                                QUANTITY.ON.HAND - TRANSACTION.QUANTITY.
 07                                DO REORDER.CALCULATION. GO TO NEXT.ITEM.

The first line of this program brings into play a processor command:

NOTE INVENTORY RECORD MAINTENANCE.

NOTE indicates that what appears in the rest of the sentence is information for the reader of the program; it is not for the Commercial Translator processor, which ignores it. The programmer is permitted and encouraged to use notes freely, in order to make the program more intelligible to the reader.

The GO TO shown on line 02 is a more powerful form of this command than we have seen before:

GO TO (WITHDRAWAL.ROUTINE, RECEIPT.ROUTINE,
       RETURN.PROCESS, RECOUNT.PROCEDURE)
       ON TYPE.OF.TRANSACTION.

This is called an assigned GO TO. For any one transaction, only one of the four procedures named in the parentheses will be performed; the one selected will depend on the current value of TYPE.OF.TRANSACTION. Suppose the value of TYPE.OF.