Defining highkeys
This topic provides more detailed information about specifying HIGHKEYs for HDAM, HIDAM, HISAM/SHISAM, and index partitions. The information includes several examples for defining HIGHKEYs.
HDAM Databases
HIGHKEYs can optionally be used to define a two-stage randomizing process for HDAM databases, without using a two-stage randomizer or partition selection routine. The HIGHKEY determines which partition to use before calling the randomizer for the partition.
A DEDB randomizer or partition selection routine cannot be used with HIGHKEYs.
The HIGHKEYs are available to application programs.
HIDAM Databases
You must specify a HIGHKEY for all HIDAM partitions except the last. HIGHKEYs specified for the last partition are unnecessary and ignored.
When you specify a HIGHKEY for a HIDAM database, the following rules apply:
- HIGHKEYs can be shorter than the root key, but must not be longer
- HIGHKEYs must always end in at least one hex 'FF'
- For non-character keys, you can specify the HIGHKEY in hexadecimal. When you specify the HIGHKEY in hexadecimal, the following rules apply:
- All hex characters must be uppercase and begin with an uppercase X in single quotes ('X'). The format is: X'0123456789ABCDEFF'
- Hex keys must end in at least hex 'FF' and must be the same length as the root key. DBDGEN does not know whether to pad hexadecimal HIGHKEY on the left or right. Because it takes two hex digits for each character, the hexadecimal HIGHKEY length must be twice as long as the root key.
You commonly use hex HIGHKEYs if you packed decimal root keys. For example, a 9999 HIGHKEY is X'000999FF' for a 4-byte, packed-decimal root key. Note that this example uses leading zeroes and ends in hex 'FF' as required. The HIGHKEY can also be X'000FFFFFF'.
For hexadecimal HIGHKEYs, be sure the hex HIGHKEY is not a valid key used by the application. For example; a full-word, integer HIGHKEY is not valid because valid integers like 255 can end in hex 'FF'.
Application programs cannot retrieve or insert the HIGHKEY if it is:
- Shorter than the root key (DBDGEN pads the key with hex ‘FF’s.)
- The same length as the root key (DBDGEN replaces the last character with hex ‘FF’.)
HISAM/SHISAM Databases
Specify HIGHKEYs for HISAM/SHISAM databases as follows:
- For HISAM root only databases without an ESDS overflow, partition into multiple KSDS data sets using the HIGHKEY.
- For SHISAM databases (VSAM KSDS data sets without IMS prefixes), use the KSDS key to partition into multiple partitions just as you partition indexes.
Application programs will be able to use these HIGHKEYs.
Indexes
You use the HIGHKEY and the INDEX key to partition primary and secondary indexes into multiple KSDS data sets.
Apply the same syntax rules for HIDAM HIGHKEYs to INDEX HIGHKEYs.
- For HIDAM primary indexes, the INDEX key and HIDAM root key are the same.
The number of partitions in the primary index can be different than the data. It is recommended however, that the HIDAM index and data have the same number of partitions and use the same HIGHKEY, so each HIDAM partition has its own index.
- For secondary indexes, the INDEX key is the secondary index key.
The index target can be partitioned or nonpartitioned. If the target is partitioned, it can have a different number of partitions than the secondary index. In fact, most databases have multiple secondary indexes. Each index can have a different number of partitions, or only some of the indexes can be partitioned.
With partitioned indexes, the HIGHKEY is not inserted in the index so you can use the same value for the HIGHKEY as that used by the application. For compatibility with HIDAM HIGHKEYs, the HIGHKEY still must end in X’FF’.
HIGHKEY Examples
The following examples show different ways to define a HIGHKEY.
Example 1: Key is an alphabetic character starting with lowercase and/or uppercase characters. Define lowercase HIGHKEYs first, then define the uppercase keys. You do not have to define a HIGHKEY for the last partition.
PARTDD1=PARTDD1,HIGHKEY=m
PARTDD1=PARTDD2,HIGHKEY=z
PARTDD1=PARTDD3,HIGHKEY=M
PARTDD1=PARTDD4
Example 2: If the character keys are only numbers between 0 and 9,999,999, only numeric ranges are needed. The HIGHKEY is not required on the last partition. You specify the HIGHKEY to document using numeric keys only. You can omit the nines because Dl/1 pads with hex 'FF's. Leading zeroes are required for any HIGHKEY less than 1,000,000.
PARTDD1=PARTDD1,HIGHKEY=2499999
PARTDD1=PARTDD2,HIGHKEY=4999999
PARTDD1=PARTDD3,HIGHKEY=7499999
PARTDD1=PARTDD4,HIGHKEY=9999999
Example 3: If the same numeric keys were packed decimal, they must be defined as hexadecimal because there are two decimal digits per byte with packed decimal. The last two digits must be hex 'FF' to prevent them from being a valid packed decimal number. The HIGHKEY is not required on the last partition.
PARTDD1=PARTDD1,HIGHKEY=X’249999FF’
PARTDD1=PARTDD2,HIGHKEY=X’499999FF’
PARTDD1=PARTDD3,HIGHKEY=X’74999FF’
PARTDD1=PARTDD4
You can specify any hexadecimal HIGHKEY as long as you specify the entire HIGHKEY, and it ends in at least one X'FF'. You must be sure the hexadecimal HIGHKEY is not a valid HIDAM key, however. Hexadecimal characters must be 0-9 and A-F (uppercase).