Mixing pointers
Because pointers are specified by segment type, the various types of pointers can be mixed within a database record. However, only hierarchical or physical, but not both, can be specified for a given segment type.
The types of pointers that can be specified for a segment type are:
- HF
- Hierarchical forward
- HF and HB
- Hierarchical forward and backward
- PCF
- Physical child first
- PCF and PCL
- Physical child first and last
- PTF
- Physical twin forward
- PTF and PTB
- Physical twin forward and backward
The figure below shows a database record in which pointers have been mixed. Note that, in some cases, for example, dependent segment B, many pointers exist even though only one type of pointer is or can be specified. Also note that if a segment is the last segment in a chain, its last pointer field is set to zero (the case for segment E1, for instance). One exception is noted in the rules for mixing pointers. The figure has a legend that explains what specification in the PTR= or PARENT= operand causes a particular pointer to be generated.
The rules for mixing pointers are:
- If PTR=H is specified for a segment, no PCF pointers can exist from that segment to its children. For a segment to have PCF pointers to its children, you must specify PTR=T or TB for the segment.
- If PTR=H or PTR=HB is specified for the root segment, the first child will determine if an H or HB pointer is used. All other children must be of the same type.
- If PTR=H is specified for a segment other than the root, PTR=TB
and PTR=HB cannot be specified for any of its children. If PTR=HB
is specified for a segment other than the root, PTR=T and PTR=H cannot
be specified for any of its children.
That is, the child of a segment that uses hierarchical pointers must contain the same number of pointers (twin or hierarchical) as the parent segment.
- If PTR=T or TB is specified for a segment whose immediate parent used PTR=H or PTR=HB, the last segment in the chain of twins does not contain a zero. Instead, it points to the first occurrence of the segment type to its right on the same level in the hierarchy of the database record. This is true even if no twin chain yet exists, just a single segment for which PTR=T or TB is specified (dependent segment B and E2 in the figure illustrate this rule).
- If PTR=H or HB is specified for a segment whose immediate parent used PTR=T or TB, the last segment in the chain of twins contains a zero (dependent segment C2 in the figure illustrates this rule).
The following figure shows an example of mixing pointers in a database record.

- These pointers are generated when you specify PTR=H on the root segment.
- If you specify PTR=H, usage is hierarchical (H); otherwise usage is twin (T).
- These pointers are generated when you specify PTR=T on segment type C and PARENT=SNGL on segment type D
- These pointers are generated when you specify PTR=T on segment type C and PARENT=DBLE on segment type E
- These pointers are generated when you specify PTR=T on this segment type