Rational Developer for System z

Aggregation

This topic shows examples of a translated relationship with an aggregation.
A COBOL pointer is added to the COBOL group that is the source of an aggregation link. The name of the pointer is the name of the target class. Figure 1 shows a model with the COBOL pointer.
Figure 1. A model with the COBOL pointer
This figure shows a COBOL program named SERVICE with the data objects PARENT, CHILD, GRANDCHILD, and CONTAINMENT and a pointer to Ref.

An aggregation is established between two classes, as shown in Figure 2.

Figure 2. An aggregation between two classes
01 GRANDCHILD .
   05 PARENT .
      10 ATTR1 PIC X(32).
      10 ATTR2 PIC X(32).
   05 CHILD .
      10 ATTR5 PIC X(32).
      10 ATTR6 PIC X(32).
      10 CONTAINMENT .
         15 ATTRIBUTE1 PIC X(32).
         15 REF  USAGE POINTER.
   05 GRANDCHILD .
      10 ATTR7 PIC X(32).
Association
Association (between Containment and Ref classes)

In Figure 3, we have replaced the aggregation relationship between Containment and Ref by an association relationship. The result is the same.

Figure 3. Aggregation as parent-child
01 GRANDCHILD .
   05 PARENT .
      10 ATTR1 PIC X(32).
      10 ATTR2 PIC X(32).
   05 CHILD .
      10 ATTR5 PIC X(32).
      10 ATTR6 PIC X(32).
      10 CONTAINMENT .
         15 ATTRIBUTE1 PIC X(32).
         15 REF  USAGE POINTER.
   05 GRANDCHILD .
      10 ATTR7 PIC X(32).
Figure 4. An association between two classes
This figure shows a COBOL program named SERVICE with the data objects PARENT, CHILD, GRANDCHILD, and CONTAINMENT and an association between CONTAINMENT and Ref.

Feedback