Types of access Schema DDL
90 U929-J-Z125-9-76
Example 2
This example shows how a user can program a user-specific hash routine.
The program replaces the first two operations of the UDS/SQL standard hash r outine
by a division/remainder algorithm. The entire key value is conside red a positive binary
number which is divided by the number of available CALC pages.
The algorithm is the same as a normal-type div ision, the only difference being that three
digits are brought down. An example of this type of operation follows (for the sake of
simplicity, in decimal numbers):
1234567890 : 13
117
6
6456
8
8789
1
10
The resulting remainder is the relative page number. It is always smaller than the
number of CALC pages, i.e. after returning to the standard hash routine, the p age
number remains unchanged. The DBH accepts the binary value stored in Regi ster 1 as
the final result.
This hash routine gives the same results as the standard ha sh routine if the key value
is not longer than four bytes.
Viewed logically, the hash routine BYTEHASH generates a CALC page number from a
CALC key in 2 steps:
1. The order of the bytes within the CALC key is reversed.
2. The entire byte string that results is treated as a positive integer and divided by the
number of CALC pages. The remainder of the division is then the CALC page
number.