Using Tree Tables
Understanding the structure of the various tree tables that PS/nVision uses and how they interact is helpful. The main tables used in this example are PSTREEDEFN, PSTREELEAF, PSTREESELCTL, and PSTREESELECTnn.
This example shows the tree tables that are used by PS/nVision.

The following sections provide details about each of these tables.
PSTREEDEFN (Tree Definition) table is the system table that defines an effective-dated version of a tree.
The following table lists the field names, types, lengths, formats, and long names of the PSTREEDEFN table.
Field Name |
Type |
Length |
Format |
Long Name |
---|---|---|---|---|
SETID |
Char |
5 |
Upper |
setID |
SETCNTRLVALUE |
Char |
5 |
Upper |
Set control value. Alternative to setID |
TREE_NAME |
Char |
18 |
Upper |
Tree name |
EFFDT |
Date |
10 |
N/A |
Effective date |
EFF_STATUS |
Char |
1 |
Upper |
Status as of effective date |
VERSION |
Nbr |
10 |
Raw B |
Version |
TREE_STRCT_ID |
Char |
18 |
Upper |
Tree structure ID |
DESCR |
Char |
30 |
Mixed |
Description |
ALL_VALUES |
Char |
1 |
Upper |
All values |
USE_LEVELS |
Char |
1 |
Upper |
Use levels |
VALID_TREE |
Char |
1 |
Upper |
Valid tree |
LEVEL_COUNT |
Nbr |
3 |
N/A |
Level count |
NODE_COUNT |
Nbr |
5 |
Raw B |
Node count |
LEAF_COUNT |
Nbr |
5 |
Raw B |
Leaf count |
TREE_HAS_RANGES |
Char |
1 |
Upper |
Tree has ranges |
DUPLICATE_LEAF |
Char |
1 |
Upper |
Allow duplicate leaf |
TREE_CATEGORY |
Char |
18 |
Upper |
Category |
TREE_ACC_METHOD |
Char |
1 |
Upper |
Tree access method |
TREE_ACC_SELECTOR |
Char |
1 |
Upper |
Tree access selector |
TREE_ACC_SEL_OPT |
Char |
1 |
Upper |
Tree access selector option |
PSTREELEAF (Tree Leaf) table is the user table that defines the data value ranges, which are the leaves of a tree. For each leaf node (nodes without children), one or more ranges define the detail values that correspond to that node.
The following table lists the field names, types, lengths, formats, and long names of the PSTREELEAF table.
Field Name |
Type |
Length |
Format |
Long Name |
---|---|---|---|---|
SETID |
Char |
5 |
Upper |
SetID |
SETCNTRLVALUE |
Char |
5 |
Upper |
Set control value |
TREE_NAME |
Char |
18 |
Upper |
Tree name |
EFFDT |
Date |
10 |
N/A |
Effective date |
TREE_BRANCH |
Char |
20 |
Upper |
Tree branch name |
TREE_NODE_NUM |
Nbr |
10 |
Raw B |
Tree node number |
RANGE_FROM |
Char |
30 |
Upper |
Range from |
RANGE_TO |
Char |
30 |
Upper |
Range to |
DYNAMIC_RANGE |
Char |
1 |
Upper |
Dynamic range |
OLD_TREE_NODE_NUM |
Char |
1 |
Upper |
Old tree node |
PSTREESELCTL (Tree Selection Control) table is the system table that controls and manages static selectors (see PSTREESELECTnn). Each row in this table corresponds to a row in PSTREEDEFN and to a group of rows (with the same SELECTOR_NUM) in PSTREESELECTnn.
Note: PSTREESELCTL table is only used for static selectors.
The following table lists the field names, types, lengths, formats, and long names of the PSTREESELCTL table.
Field Name |
Type |
Length |
Format |
Long Name |
---|---|---|---|---|
SETID |
Char |
5 |
Upper |
SetID |
SETCNTRLVALUE |
Char |
5 |
Upper |
Set control value |
TREE_NAME |
Char |
18 |
Upper |
Tree name |
EFFDT |
Date |
10 |
N/A |
Effective date |
VERSION |
Nbr |
10 |
Raw B |
Version |
SELECTOR_NUM |
Nbr |
10 |
Raw B |
Selector number |
SELECTOR_DT |
Date |
10 |
N/A |
Selector date |
TREE_ACC_SEL_OPT |
Char |
1 |
Upper |
Tree access selector option |
LENGTH |
Nbr |
5 |
Raw B |
Length |
PSTREESELECTnn (Tree Select Work-Size nn) are the system tables that define selectors used by PS/nVision to speed tree-based data selection. A selector table is defined for every possible detail field length (nn = 01-30); thus this description applies to tables named PSTREESELECT01, PSTREESELECT02, and so on, through PSTREESELECT30.
The following table lists the field names, types, lengths, formats, and long names of the PSTREESELECTnn table.
Field Name |
Type |
Length |
Format |
Long Name |
---|---|---|---|---|
SELECTOR_NUM |
Nbr |
10 |
Raw B |
Selector number |
TREE_NODE_NUM |
Nbr |
10 |
Raw B |
Tree node number |
RANGE_FROM_nn |
Char |
n |
Upper |
Range from |
RANGE_TO_nn |
Char |
n |
Upper |
Range to |
PS/nVision uses the PSTREESELNUM (Tree Selector Number) table to assign a unique SELECTOR_NUM value to each tree selector as it is built.
Note: The PSTREESELNUM table has only one row.
The following table lists the field name, type, length, format, and long name of the PSTREESELNUM table.
Field Name |
Type |
Length |
Format |
Long Name |
---|---|---|---|---|
SELECTOR_NUM |
Nbr |
10 |
Raw B |
Selector number |