Types of pointers you can specify
In the HD access methods, segments in a database record are kept in hierarchical sequence using direct-address pointers.
Except for a few special cases, each prefix in an HD segment contains one or more pointers. Each pointer is 4 bytes long and consists of the relative byte address of the segment to which it points. Relative, in this case, means relative to the beginning of the data set.
Several different types of direct-address pointers exist, and you will see how each works in the topics that follow in this section. However, there are three basic types:
- Hierarchical pointers, which point from one segment to the next in either forward or forward and backward hierarchical sequence
- Physical child pointers, which point from a parent to each of its first or first and last children, for each child segment type
- Physical twin pointers, which point forward or forward and backward from one segment occurrence of a segment type to the next, under the same parent
When segments in a database record are typically processed in hierarchical sequence, use hierarchical pointers. When segments in a database record are typically processed randomly, use a combination of physical child and physical twin pointers. One thing to keep in mind while reading about pointers is that the different types, subject to some rules, can be mixed within a database record. However, because pointers are specified by segment type, all occurrences of the same segment type have the same type of pointer.
Each type of pointer is examined separately in this topic. In the subtopics in this topic, each type of pointer is illustrated, and the database record on which each illustration is based is shown in the following figure.
