Creating a look-up file
A look-up file is one which contains information to be transferred into the data record at a given point. Each item in the file has a unique key associated with it; this is very often the code representing that information in the data. If brands A, B, C and D are represented by the codes 1 through 4 in the data, the costs for those brands must have the keys 1 through 4 as well. Similarly, if a Ford Escort car is coded 274 in the data, the additional information for a Ford Escort is identified by the key 274 in the look-up file.
Data in the look-up file must be in alphabetical order and must be formatted as follows:
▪The first line must contain exactly two whole numbers anywhere on the line. The first is the key length, the second is the total record length including the key.
▪All other lines must start with the key which may be followed by any other information as necessary.
The look-up for the chocolate survey is named costs and is as follows:
1 4
1 14
2 15
3 21
4 17
The first line shows that the key is 1 character long and that the record length is four characters long (the space in column 2 is part of that information). The other lines refer to the individual chocolate bars. Brand A (coded 1) costs 14 pence, Brand B (coded 2) costs 15 pence, Brand C costs 21 pence, Brand D costs 17 pence.
See also