COMTRAN Reconstruction

F28-8043 · June 1960

Page 30

PDF page 36 of 124. Download the scanned PDF

The page as scanned

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

The text read off it

[page 30]

Subscripts

These code numbers would then be used in the input records in lieu of the actual names. Naturally, they would have to be placed in a field reserved for them, so that they could be properly identified. Suppose that in this case the field were called DESTINATION. If the programmer then wrote a procedure statement containing the data-name DESTINATION, the system would look at that field to see what number it contained. This number could then be used as a means of referring to the table.

Numbers or names used to locate items in a list or a table are known as subscripts. In order to use them, the programmer must place them within parentheses following the data-name showing the kind of data being sought. Thus, since the table of this example contains a data sequence called RATE, the instruction MOVE RATE (DESTINATION) TO LIST.A would cause the system to obtain the number in the DESTINATION field, use this number to locate the corresponding line of the table, and move the entire contents of the line to the area called LIST.A. In this case, the data moved would include all items contained on that line, including CITY, ONE.WAY, ROUND.TRIP, and EXCURSION.

Often, however, only one of these items would be required. As will be seen in Chapter 4, the data description entries used to place the table in storage permit the programmer to locate individual items on each line. If these entries have been properly made, the programmer can write such a statement as MOVE ONE.WAY (DESTINATION) TO BILL.AMOUNT, and the system would then locate the line having the number indicated in the DESTINATION field, single out the particular part of the line called ONE.WAY, and move that one item to the area called BILL.AMOUNT.

It is conceivable that the programmer might wish to specify that the system obtain a rate for a particular city, rather than the rate for whatever city happened to be indicated in the DESTINATION field. Once again, correspondence between the name and the number would have to be established. This could be achieved by writing a data description entry in which the name of the city was specified as the name of a literal number. Thus, MIAMI might be specified as the name of the constant value ‘17’. Then, if the programmer wrote MOVE RATE (MIAMI) TO LIST.A or MOVE ONE.WAY (MIAMI) TO BILL.AMOUNT, the system would recognize that the name MIAMI was equivalent to the number 17 and would use that number as a means of referring to the table.

It has been shown how a single subscript may be used to identify an item in a table. Actually, as many as three subscripts may be used within the same pair of parentheses. To take a simple example, suppose that the contents of a book had been stored within the system and that the programmer wished to make reference to a particular word in a particular line on a particular page of the book. Suppose, further, that the data-names WORD, LINE, and PAGE had been properly entered in the data description in such a way that entries called WORD were subordinate to entries called LINE, which, in turn, were subordinate to entries called PAGE. (As Chapter 4 explains, level numbers are used for this purpose.)

To specify the 4th word in line 10 of page 150, the programmer could then write either PAGE (150) LINE (10) WORD (4) or PAGE LINE WORD (150, 10, 4). These two expressions are equivalent. In the first case, each data-name is subscripted individually. In the second case, it is the name WORD which is subscripted, but this name has been compounded by the use of the names of two higher levels, PAGE and LINE, to make it unique. If the name WORD had been unique in the program—i.e., had not been used outside of this particular sequence—the desired item could be indicated simply as WORD (150, 10, 4).

When more than one subscript is included within the same pair of parentheses, they must be separated by single commas. The number of subscripts used must cor-