![]() |
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.
There is always a last section that contains all values outside the last user-specified range.
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 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 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: | Section number n + 1 is not used for Accesses to sectioned direct data sets. |
The section key values must be specified in ascending key value order. For example, assuming K1 is an integer:
S SET OF DS KEY IS K1 SECTIONS (K1 = 10; % 1st section (#1), <=10 K1 = 20; % 2nd section (#2), 11-20 K1 = 30; % 3rd section (#3), 21-30 K1 = 40; % 4th section (#4), 31-40 );%K1 > 40 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: | Section number n + 1 is not used for Accesses to sectioned direct data sets. |
![]() |
The section key values must be specified in descending key value order. For example, assuming K1 is an integer: |
S SET OF DS KEY IS K1 DESCENDING SECTIONS ( K1 = 40; % 1st section (#1), >=40 K1 = 30; % 2nd section (#2), 30-39 K1 = 20; % 3rd section (#3), 20-29 K1 = 10; % 4th section (#4), 10-19 );%K1 < 10 go into a 5th section (#5)
Multiple Key Items
If a set contains multiple key items, you can specify key 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 set S has keys K1, K2, K3, and K4. Following are two examples of a key specification for set S. The first example is valid; the second example is invalid.
Valid Example
S SET OF DS KEY IS (K1, K2, K3 DESCENDING, K4) DUPLICATES SECTIONS (K1 = 10, K2 = 050, K3 = 3000, K4 = 300; %1st section K1 = 10, K2 = 100, K3 = 2000, K4 = 1000; %2nd section K1 = 10, K2 = 100, K3 = 1000; %K4 = anything %3rd section K1 = 20, K2 = 100, K3 = 1000, K4 = 2000; %4th section K1 = 30; % K1=21-30, K2, K3, & K4 = anything %5th section );% K1>30 and K2,K3 & K4 = anything %last section
Invalid Example
S SET OF DS KEY IS (K1, K2, K3, K4) DUPLICATES SECTIONS (K2 = 100, K1 = 10, K3 = 1000, K4 = 10000;%Keys out of order K1 = 100, K3 = 2000, K4 = 2002; %Key skipped K1 = 5 %Key value for ); %ascending key not %ascending