Previous Topic: Defining a Logical DatabaseNext Topic: Sample Logical Database


Intersection and Concatenated Segments

Pointer and Target Segments

As mentioned above, logical databases are defined by referencing segments already defined in one or more physical DBDs. In particular, logical databases rely on the logical relationships defined in the physical DBDs. Logical relationships allow you to link a segment (logical child) in one physical DBD with a segment (logical parent) in another (or the same) physical DBD. In such a relationship, the logical child segment is referred to as the pointer segment, and the logical parent is referred to as the target segment.

Intersection and Concatenated Segments

In practice, the link between pointer and target segments is established via a pointer field in the pointer (logical child) segment. If the pointer segment contains data fields in addition to the pointer field, such fields are said to carry intersection data and the segment itself is referred to as an intersection segment. The intersection data is unique to the relationship between a pointer segment occurrence and its associated target segment occurrence. An application can retrieve and modify the data portions of the pointer and target segments separately, or it can retrieve and modify the pointer and target segments as one concatenated segment.

Defining a Concatenated Segment

The definition of individual pointer (logical child) and target (logical parent) segments occurs at the physical DBD level. The definition of concatenated segments occurs at the logical DBD level and is specified via the SOURCE parameter in the SEGM statement. The SOURCE parameter determines the contents of a concatenated segment, which can be:

The Destination Parent

The destination parent can be either the physical or logical parent of the pointer (logical child) segment. The choice depends on the direction in which you want the access to proceed: from logical parent to physical parent via the logical child, or from physical parent to logical parent via the logical child.

Syntax

The SOURCE parameter in the logical DBD SEGM statement takes the following form:

Parameters

psegname

Identifies the name of the pointer (logical child) segment as defined in the physical DBD dbname1. This segment can be either a virtual logical child or a real logical child. (See "Bidirectional Virtual Relationship" and "Bidirectional Physical Relationship" earlier in this section.)

KEY/DATA

KEY/DATA specifies whether an application will have access to only the key (sequence field) of the named segment, or will have access to the segment's data portion as well as the key. KEY is the default.

dsegname

Dsegname is the name of the destination parent as defined in the physical DBD dbname2. The destination parent can be either the physical or logical parent for the pointer (logical child) segment named in psegname.