Physical twin forward and backward pointers

With physical twin forward and backward (PTF and PTB) pointers, each segment occurrence of a given segment type under the same parent points both forward to the next segment occurrence and backward to the previous segment occurrence.

PTF and PTB pointers must be used together, since you cannot use PTB pointers alone. The following figure illustrates how PTF and PTB pointers work.

Figure 1. Physical twin forward and backward pointers
COURSE segments point to each other. LOC segments point to each other. First STUDENT and second STUDENT point to each other. Second STUDENT and third STUDENT point to each other.

Note that PTF and PTB pointers can be specified for root segments. When this is done, the root segment points to both the next and the previous root segment in the database. As with PTF pointers, PTF and PTB pointers leave the hierarchy only partly connected. No pointers exist to connect parent and child segments. Physical child pointers (explained previously) can be used to form this connection.

PTF and PTB pointers (as opposed to just PTF pointers) should be used on the root segment of a HIDAM or a PHIDAM database when you need fast sequential processing of database records. By using PTB pointers in root segments, an application program can sequentially process database records without IMS having to refer to the HIDAM or PHIDAM index. For HIDAM databases, PTB pointers improve performance when deleting a segment in a twin chain accessed by a virtually paired logical relationship. Such twin-chain access occurs when a delete from the logical access path causes DASD space to be released.

Eight bytes are needed for the PTF and PTB pointers in each segment occurrence of a given segment type.

If you are defining your database with DBD generation macro statements, PTF and PTB pointers are specified by coding PTR=TB in the SEGM statement in the DBD.

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