0% found this document useful (0 votes)
21 views14 pages

IMS Pointers

Uploaded by

m7411961181
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views14 pages

IMS Pointers

Uploaded by

m7411961181
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

IMS Pointers.

Pointers in HD databases
Before looking in detail at how HD databases are stored and processed, you
need to become familiar with the pointers that are used in HD databases.

 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.

 Hierarchical forward pointers

With hierarchical forward (HF) pointers, each segment in a database record


points to the segment that follows it in the hierarchy.

 Hierarchical forward and backward pointers

With hierarchical forward and backward pointers (HF and HB), each segment
in a database record points to both the segment that follows and the one
that precedes it in the hierarchy (except dependent segments do not point
back to root segments).

 Physical child first pointers

With physical child first (PCF) pointers, each parent segment in a database
record points to the first occurrence of each of its immediately dependent
child segment types.

 Physical child first and last pointers

With physical child first and last pointers (PCF and PCL), each parent
segment in a database record points to both the first and last occurrence of
its immediately dependent child segment types.

 Physical twin forward pointers

With physical twin forward (PTF) pointers, each segment occurrence of a


given segment type under the same parent points forward to the next
segment occurrence.

 Physical twin forward and backward pointers

Page 1
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.

 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.

 Sequence of pointers in a segment's prefix

When a segment contains more than one type of pointer, pointers are put in
the segment's prefix in a specific sequence.

Parent topic: HDAM, PHDAM, HIDAM, and PHIDAM databases

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

Page 2
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.

Figure 1. Example database record for illustrating pointers

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

Page 3
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.

HF pointers are specified by coding PTR=H in the SEGM statement in the


DBD.

Restriction

HALDB databases do not support HF pointers.

Hierarchical forward and backward pointers


With hierarchical forward and backward pointers (HF and HB), each segment
in a database record points to both the segment that follows and the one

Page 4
that precedes it in the hierarchy (except dependent segments do not point
back to root segments).

HF and HB pointers must be used together, since you cannot use HB pointers
alone. The following figure shows how HF and HB pointers work.

Figure 1. Hierarchical forward and backward pointers

HF pointers work in the same way as the HF pointers that are described in
Hierarchical forward pointers.

HB pointers point from a segment to one immediately preceding it in the


hierarchy. In most cases, HB pointers are not required for delete processing.
IMS™ saves the location of the previous segment retrieved on the chain and
uses this information for delete processing. The backward pointers are useful
for delete processing if the previous segment on the chain has not been
accessed. This happens when the segment to be deleted is entered by a
logical relationship.

The backward pointers are useful only when all of the following are true:

 Direct pointers from logical relationships or secondary indexes point to


the segment being deleted or one of its dependent segments.
 These pointers are used to access the segment.
 The segment is deleted.

Eight bytes are needed in each dependent segment's prefix to contain HF


and HB pointers. Twelve bytes are needed in the root segment. More bytes
are needed in the root segment because the root points:

Page 5
 Forward to a dependent segment
 Forward to the next root segment in the database
 Backward to the preceding root segment in the database

HF and HB pointers are specified by coding PTR=HB in the SEGM statement


in the DBD.

Restriction
HALDB databases do not support HF and HB pointers.

Physical child first pointers


With physical child first (PCF) pointers, each parent segment in a database
record points to the first occurrence of each of its immediately dependent
child segment types.

The following figure shows PCF pointers:

Figure 1. Physical child first pointers

With PCF pointers, the hierarchy is only partly connected. No pointers exist
to connect occurrences of the same segment type under a parent. Physical
twin pointers can be used to form this connection. Use PCF pointers when
segments in a database record are typically processed randomly and either
sequence fields are defined for the segment type, or if not defined, the insert
rule is FIRST or HERE. If sequence fields are not defined and new segments
are inserted at the end of existing segment occurrences, the combination of
PCF and physical child last (PCL) pointers (explained next) can be a better
choice.

Page 6
Four bytes are needed in each parent segment for each PCF pointer.

PCF pointers are specified by coding PARENT=((name,SNGL)) in the SEGM


statement in the DBD. This is the SEGM statement for the child being pointed
to, not the SEGM statement for the parent. Note, however, that the pointer is
stored in the parent segment.

Physical child first and last pointers


With physical child first and last pointers (PCF and PCL), each parent
segment in a database record points to both the first and last occurrence of
its immediately dependent child segment types.

PCF and PCL pointers must be used together, since you cannot use PCL
pointers alone. The following figure shows PCF and PCL pointers:

Figure 1. Physical child first and last pointers

Note that if only one physical child of a particular parent segment exists, the
PCF and PCL pointers both point to the same segment. As with PCF pointers,
PCF and PCL pointers leave the hierarchy only partly connected, and no
pointers exist to connect occurrences of the same segment type under a
parent. Physical twin pointers can be used to form this connection.

PCF and PCL pointers (as opposed to just PCF pointers) are typically used
when:

 No sequence field is defined for the segment type.


 New segment occurrences of a segment type are inserted at the end of
all existing segment occurrences.

Page 7
On insert operations, if the ISRT rule of LAST has been specified, segments
are inserted at the end of all existing segment occurrences for that segment
type. When PCL pointers are used, fast access to the place where the
segment will be inserted is possible. This is because there is no need to
search forward through all segment occurrences stored before the last
occurrence. PCL pointers also give application programs fast retrieval of the
last segment in a chain of segment occurrences. Application programs can
issue calls to retrieve the last segment by using an unqualified SSA with the
command code L. When a PCL pointer is followed to get the last segment
occurrence, any further movement in the database is forward.

A PCL pointer does not enable you to search from the last to the first
occurrence of a series of dependent child segment occurrences.

Four bytes are needed in each parent segment for each PCF and PCL pointer.
PCF and PCL pointers are specified by coding the PARENT= operand in the
SEGM statement in the DBD as PARENT=((name,DBLE)). This is the SEGM
statement for the child being pointed to, not the SEGM statement for the
parent. Note, however, that the pointers are stored in the parent segment.

A parent segment can have SNGL specified on one immediately dependent


child segment type and DBLE specified on another.

The figure following the DBD statement below shows the result of specifying
PCF and PCL pointers in the DBD statement.

DBD
SEGM A
SEGM B PARENT=((name.SNGL)) (specifies PCF pointer only)
SEGM C PARENT=((name.DBLE)) (specifies PCF and PCL pointers)

Copy

Figure 2. Specifying PCF and PCL pointers

Physical twin forward pointers

Page 8
With physical twin forward (PTF) pointers, each segment occurrence of a
given segment type under the same parent points forward to the next
segment occurrence.

Note that, except in PHIDAM databases, PTF pointers can be specified for
root segments. When this is done in an HDAM or PHDAM database, the root
segment points to the next root in the database chained off the same root
anchor points (RAP). If no more root segments are chained from this RAP, the
PTF pointer is zero.

When PTF pointers are specified for root segments in a HIDAM database, the
root segment does not point to the next root in the database.

If you specify PTF pointers on a root segment in a HIDAM database, the


HIDAM index must be used for all sequential processing of root segments.
Using only PTF pointers increases access time. You can eliminate this
overhead by specifying PTF and physical twin backward (PTB) pointers.

You cannot use PTF pointers for root segments in a PHIDAM database.
PHIDAM databases only support PTF pointers for dependent segments.

With PTF pointers, the hierarchy is only partly connected. No pointers exist to
connect parent and child segments. Physical child pointers can be used to
form this connection. PTF pointers should be used when segments in a
database record are typically processed randomly, and you do not need
sequential processing of database records.

Four bytes are needed for the PTF pointer in each segment occurrence of a
given segment type.

PTF pointers are specified by coding PTR=T in the SEGM statement in the
DBD. This is the SEGM statement for the segment containing the pointer.

The following figure show PTF pointers:

Figure 1. Physical twin forward pointers

Page 9
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

Page 10
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.

PTF and PTB pointers are specified by coding PTR=TB in the SEGM statement
in the DBD.

Mixing pointers

Page 11
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.

Page 12
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.

Figure 1. Mixing pointers

Page 13
Notes for Figure
1. These pointers are generated when you specify PTR=H on
the root segment.
2. If you specify PTR=H, usage is hierarchical (H); otherwise
usage is twin (T).
3. These pointers are generated when you specify PTR=T on
segment type C and PARENT=SNGL on segment type D
4. These pointers are generated when you specify PTR=T on
segment type C and PARENT=DBLE on segment type E
5. These pointers are generated when you specify PTR=T on
this segment type

Page 14

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy