Hierarchical forward pointers

With hierarchical forward (HF) pointers, each segment in a database record points to the segment that follows it in the hierarchy.

The following figure shows hierarchical forward pointers:

Figure 1. Hierarchical forward pointers
Segments point to one another in the this order: first COURSE, INSTR, EDUC, EXPR, first LOC, second LOC, first STUDENT, second STUDENT, third STUDENT. First COURSE points to second COURSE too.

When an application program issues a call for a segment, HF pointers are followed until the specified segment is found. In this sense, the use of HF pointers in an HD database is similar to using a sequentially organized database. In both, to reach a dependent segment all segments that hierarchically precede it in the database record must be examined. HF pointers should be used when segments in a database record are typically processed in hierarchical sequence and processing does not require a significant number of delete operations. If there are a lot of delete operations, hierarchical forward and backward pointers (explained next) might be a better choice.

Four bytes are needed in each dependent segment's prefix for the HF pointer. Eight bytes are needed in the root segment. More bytes are needed in the root segment because the root points to both the next root segment and first dependent segment in the database record.

If you are defining your database with DBD generation macro statements, HF pointers are specified by coding PTR=H in the SEGM statement in the DBD.

If you are defining your database by using DDL statements, HF pointers are specified by coding the HIER parameter in a CREATE or ALTER TABLE statement.

Restriction: HALDB databases do not support HF pointers.