![]() |
You express section boundaries with the following construct: <key item> = <key value> |
A key item cannot be a group item or a field item containing a group of Boolean items.
When specifying the section boundaries for a random XE data set, the Enterprise Database Server automatically adds one additional section to store any records whose key values are higher than the boundary for the last section specified (or lower than the boundary for the last section specified if the key is descending).
When specifying the section boundaries for an XE direct data set, the Enterprise Database Server does not add an additional section. The key value specified for the last section indicates the highest value that is intended to be stored in the data set. A limit error can occur at run time if the real key value exceeds this highest value. This is true unless a large enough file size has been specified for the data set using AREAS, AREASIZE, and BLOCKSIZE if AREASIZE is given in blocks. However, the Enterprise Database Server does not enforce this limit.
For direct data sets, the Access can specify a group item. However, the section bounds specification must be specified using the subitems of the group key. It is recommended that the specification for the last section include specifications for all subitems of a group key.
There is always a last section that contains all values outside the last user-specified range.
The following example includes specifications for all subitems of a group key:
D DIRECT DATA SET (G GROUP ( G1 NUMBER(2); G2 NUMBER(4); ); INFO ALPHA(300); )EXTENDED=TRUE; A ACCESS TO D KEY IS G
SECTIONS (G1 = 50; G1 = 75, G2 = 500 );
Ascending Keys
Using ascending keys, the first key value represents the upper boundary for the first section. If the first key value is the lowest value specified, the system assigns records to sections according to the principles listed in the following table.
Principle of Record Assignment |
Section Number |
---|---|
Records having keys less than or equal to the first specified key bounds value. |
1 |
Records having keys higher than the first key bounds value and less than or equal to the next specified higher key bounds value. |
2 .. n |
Records having keys greater than the highest specified upper key bound. This provides for an “and everything else” category without requiring detailed knowledge of the highest possible value for the key item. |
(last n) + 1 |
Note: | The last principle is not used for Accesses to sectioned direct data sets. |
The section key values must be specified in ascending key value order. The following example assumes DS is a random data set and K1 is an integer:
A ACCESS TO DS KEY IS K1 SECTIONS (K1 = 99; % 1st section (#1), <=99 K1 = 199; % 2nd section (#2), 100-199 K1 = 299; % 3rd section (#3), 200-299 K3 = 399; % 4th section (#4), 300-399 );%K1 > 399 go into a 5th section (#5)
Descending Keys
Using descending keys, the first key value represents the lower boundary for the first section. If the first key value is the highest key value specified, the system assigns records to sections according to the principles listed in the following table.
Principle of Record Assignment |
Section Number |
---|---|
Records having keys greater or equal to the first specified key bounds value. |
1 |
Records having keys less than the first key bounds value and greater than or equal to the next specified lower key bounds value. |
2 . . n |
Records having keys less than the lowest specified lower key bound. |
(last n) + 1 |
Note: | The last principle is not used for Accesses to sectioned direct data sets. |
The section key value must be specified in descending key value order. The following example assumes DS is a random data set and K1 is an integer:
A ACCESS TO DS KEY IS K1 SECTIONS (K1 = 400; % 1st section (#1), >=400 K1 = 300; % 2nd section (#2), 300 - 399 K1 = 200; % 3rd section (#3), 200 - 299 K1 = 100; % 4th section (#4), 100 - 199 );%K1< 100 go into a 5th section (#5)
Multiple Key Items
If a set contains multiple keys items, you can specify values for the additional key items. The characteristics of multiple key items are as follows:
-
Not all keys need to be specified within each section range.
-
All keys must be in order (primary key first, then secondary, and so on).
-
Higher order keys must not be skipped.
-
Each section key value must be in order.
-
Descending key item values are complemented so that sorting can be in ascending order.
For example, suppose that DS is a random data set and has Access A with keys K1, K2, K3, and K4. The following two examples are of a key specification for Access A. The first example is valid; the second example is invalid.
Valid Example
A ACCESS (K1,K2,K3,K4) SECTIONS (K1=10, K2=050, K3=300, K4=30; % 1st section K1=10, K2=100, K3=200, K4=100 % 2nd section K1=10, K2=100, K3=100, % K4=anything % 3rd section K1=20, K2=100, K3=100, K4=200; % 4th section K1=30; %K1=21-30, K2, K3, &K4 = anything % 5th section );% K1>30 and K2, K3, & K4 = anything % last section
Invalid Example
A ACCESS (K1,K2,K3,K4) SECTIONS (K2=100, K1=10, K3=100, K4=1000 % Keys out of order K1=100, K3=200, K4=2002 % Key skipped K1=5 % Key value for ascending ) % Key not ascending
Alpha Key Value
![]() |
The characteristics of specifying the alpha key value are as follows:
|
Field Key Value
![]() |
The only field key value allowed is an unsigned integer in the range 0 through the value that can be stored in the field. The maximum number is 99,999,999,999. |
Numeric Key Value
![]() |
When an integer or a number is specified, its value must be within the range of values permitted by the precision and scale factor of the key. A key item with a REAL(I) or REAL (I,J) type cannot have a key value greater than 2**39 – 1.” |
The following table illustrates numeric and real key values.
Key Item |
Key Value |
---|---|
B NUMBER(S5,2) |
–123.45; |
D REAL(S5,2) |
–1.2; |
E NUMBER(S5,2) |
–0.12; |
F REAL(S5,2) |
12; |
G REAL(5) |
12345; |
H REAL(5,5) |
12345; |