bdfp1m0g | Programming Concepts and Reference |
Suppose you want to store a large quantity of data about customers by using different LREC types for different parts of the data.
For example, suppose the information is to be stored in a file using three different types of LRECs:
You need some method of indicating that all the LRECs for a particular customer are related. You can implement this requirement in a variety of ways. A simple method is to repeat the name field (as a fixed-length field) in each LREC, but this can waste a lot of space. A better way is to use the unique keys.
You can use unique keys to indicate that LRECs are related. To do this, define a unique key field in each LREC and call the DBUKY macro or dfuky function to provide you with a unique key to insert in this field in each LREC.
The process is as follows:
The result is shown in Figure 3. One 4-byte unique key field exists in each LREC. This example shows the unique keys in the same relative position in each LREC, but this is not necessary.