bdfd1m0jDatabase Administration

Mapping the Passenger Name File

Note:
The example in this section is theoretical. It shows an even distribution of LRECs. In practice, an even distribution is unlikely to occur.

Each LREC in the passenger name file contains the fields shown in Table 24. Table 24 also shows the number of bytes in each field.

Table 24. LREC Fields for the Passenger Name File

Field No. of bytes
size 2
key 1
passenger name 25
pointer to passenger file 5
Total 33

From this example, you can see that each LREC in the passenger name file contains 33 bytes.

Each LREC must be stored in a block. In this example, a block size of 4-K is used. A 4-K block can hold 4033 bytes of user data, assuming you use optional block trailers.

The following calculation shows how many LRECs from the passenger name file can be held in a 4-K block:

4033 ÷. 33 = 122 LRECs in
each block

The calculations made in Passenger LRECs showed that the database must be able to accommodate 1.825 million passenger LRECs. Because of this, allow for 1.825 million LRECs in the passenger name file. Each 4-K block can hold 122 LRECs.

The calculation that follows shows how many blocks are needed to accommodate the 1.825 million LRECs. (The calculation assumes an even distribution of LRECs):

1.825 million ÷. 122 = 14959 blocks

Each TPFDF subfile contains one prime block and, if necessary, a number of overflow blocks. You can see that it would not be feasible to allocate all the passenger name LRECs to a single subfile because there would be 14 959 overflow blocks.

For performance reasons, distribute the 1.825 million LRECs over a number of subfiles. Because you are dealing with a passenger name file, distribute the LRECs by passenger name.

Distributing the Passenger Name LRECs

The TPFDF product provides predefined algorithms for distributing LRECs evenly across a range of ordinals. Some of these methods are designed for alphabetic data or alphanumeric data mapping. Others calculate an ordinal number using a hashing technique to distribute the LRECs. The method of distributing the LRECs is specified by an algorithm number in the &SW00RBV symbol of the file DSECT.

In TPFDF macros, you can use the ALG parameter to specify the location of an input string for an algorithm.

The TPFDF product provides the following three algorithms for distributing data by alphabetic characters:

#TPFDB01 distributes data by the first character of the algorithm string. #TPFDB02 uses the first 2 characters, and #TPFDB03 uses the first 3 characters.

Table 25 uses SMITH as the example passenger name. It shows the characters used by each algorithm. The table also shows the number of subfiles created by each algorithm and the number of blocks required in each subfile to hold the passenger name LRECs.

Table 25. Algorithms Using Alphabetic Characters

Algorithm Characters used No. of subfiles resulting No. of blocks required
#TPFDB01 S 26 576
#TPFDB02 SM 676 23
#TPFDB03 SMI 17576 1
Note:
Table 25 assumes a perfect distribution of LRECs over the subfiles. In practice, this is unlikely to occur. For example, names beginning with S are more common than names beginning with X. However, you could improve the distribution by basing the algorithm on a character that is not the first in the name; for example, the second consonant.

If you cannot get a good distribution using any of the predefined TPFDF algorithms, you can create a unique user-defined algorithm in the user exit UWBD. See page *** for more information about creating user-defined algorithms.

In Table 25, you can see that algorithm #TPFDB01 would require chaining for 676 blocks. In a real-time system, this would create a substantial I/O overhead. Algorithm #TPFDB02 requires 23 blocks. It would clearly take less time to read only 23 blocks but the response would still be too slow.

However, with a perfect distribution of LRECs, algorithm #TPFDB03 would require no overflow blocks at all. All the LRECs could be contained in a single block. Even with an actual (real world) distribution, #TPFDB03 would probably produce no more than 5 blocks.

File Structure

The passenger name file has a classic index structure which the TPFDF product can maintain easily. The passenger name is the index key. Each LREC contains a pointer to the passenger detail file. The TPFDF product maintains these indexes for you.

In TPFDF macros, you can use the ALG parameter to specify the location of an input string for an algorithm. In this example, the string passed with the ALG parameter is the passenger name. Algorithm #TPFDB03 uses this to access the subfiles.

The LREC structure for the passenger name file is as follows:

The size and key fields shown in this LREC are for the TPFDF product use.