TurboIMAGE/XL Database Management System Reference Manual MPE/iX V6.5 (30391-90011)

484 Chapter10
Internal Structures and Techniques
Internal Techniques
Control Block Sizes
It is not necessary to predict the exact length of the control blocks used by
TurboIMAGE/XL to manage user accesses to databases. However, the exact length of the
DBU and the exact current length of the DBG are returned in the status array by DBOPEN.
These lengths can be truncated to 32767 if the control block is greater than 32767.
Internal Techniques
Although it is not necessary to know the following techniques to use TurboIMAGE/XL, an
understanding of them can help you design a more efficient database.
Primary Address Calculation
TurboIMAGE/XL employs two distinct methods of calculating primary addresses in
master data sets. The intent of the first method is to spread master entries as uniformly as
possible throughout the record space of the data file. This method is referred to as
"hashing" and applies only to master data sets with key items of type U, X, Z, or P. In this
case, the entire key item value regardless of its length is folded into a positive 32-bit value.
This value is reduced modulo the hashing capacity and then incremented by one to form a
primary address. The hashing capacity is the maximum capacity for a set not enabled for
dynamic expansion, or initial capacity for a set enabled for dynamic expansion of a new
database, or the original capacity (excluding expansions) for a set enabled for dynamic
expansion of an existing database.
NOTE
Because values are folded from right to left, applications should place values
in a type U, X, Z, or P field as follows:
Values that change should be placed first in the field.
Values that are static should be placed last in the field.
The intent of the second method is to permit you to control the primary address
assignment. This method applies only to master data sets with key items of type I, J, K, R,
or E. In this case, the right-most block of 32 bits of the key value is treated as a double
integer. (If its sign bit is not zero, it is set to zero. If the key item is only 16 bits long, a
32-bit value is created by prefacing these 16 bits with 16 zero bits.)
This 32-bit integer is decremented by 1 and reduced modulo the data set hashing capacity
after which 1 is added to the result to form the primary address. If the application provides
key values whose right-most 32 bits take on values between 1 and N (where N is no
greater than the data set hashing capacity), the corresponding entries will be assigned
primary addresses 1 through N which is identical to the Direct Access Method (DAM). In
this event, there are no secondaries and performance is outstanding. However, if the
application has no control of the key value assignment and/or if N exceeds the hashing
capacity, secondaries will occur; this, along with the clustering typical of this method, may