The text read off it
[page 74]
TABLES
A valuable function of the REDEF code is to make it possible to set up tables in storage and to define the methods of locating individual items in the tables. The following example shows a method of doing this:
Suppose the programmer wishes to place in memory the table described in Chapter 2 (see page 29), which shows passenger transportation rates to each of 30 different cities. Each line in this table lists a city, a one-way rate, a round trip rate, and an excursion rate. If it were printed in a book of rate schedules, it would probably contain four columns, headed "City," "One-Way," "Round Trip," and "Excursion." A portion of this table might have the following form:
| City | One-Way | Round Trip | Excursion |
|---|---|---|---|
| ... | ... | ... | ... |
| Los Angeles | 153.42 | 285.16 | 212.87 |
| Miami | 78.60 | 141.63 | 118.92 |
| ... | ... | ... | ... |
To place such a table into a Commercial Translator program, the programmer must first analyze it to determine the maximum size of each kind of item. He may find, for example, that 14 character spaces will be required for the longest name in the "City" list, and that each of the rate listings can be accommodated if space for five digits is reserved for each rate value.
The actual data may then be entered by copying all of the individual items in sequence , reading across each line and allowing blank spaces (or zeros) as filler in those items that occupy less than the allowed space. Thus the initial data entry might read, in part:
Data description coding form — RATE.TABLE constant entries (page 74).
SERIAL DATA NAME LEVEL DESCRIPTION
RATE.TABLE 01
02 'LOS ANGELES 15342 28516 21287'
02 'MIAMI 07860 14163 11892'
The entries at the 02 level, which could extend over as many lines as necessary to accommodate all of the data, specify a series of constants. These are enclosed in quotation marks in accordance with the rules for writing constants. Note that decimal points are not normally required in constants of this kind, since the location of the decimal point will be specified in a later entry.
The result of this entry is twofold: Space is reserved in memory for the entire table, and the individual items are stored in a sequence which permits them to be located after the table has been more fully described. At this point, however, no means of identifying any single item of data has yet been established. This must be accomplished by superimposing the format and structure of the table on the data already placed in storage. It is done by redefining the format of the data, using a series of entries such as the following: