Dictionary/3000 Reference Manual (32244-90001)

270 Chapter7
The Dictionary DICTCDE Utility
Examples of Generated Code
Explicit REDEFINES
Overlapping child elements can also be generated by DICTCDE as explicit REDEFINES
as long as the record layout for the parent element was defined in the Dictionary using the
dummy element $REDEFINES. All child elements added to the parent element's list of
relationships before $REDEFINES make up the first record layout. When $REDEFINES
is related to the parent element, it implies that those child elements added to the parent's
list of relationships after the $REDEFINES dummy, constitute an alternate record layout.
Note that when $REDEFINES is related to the parent element in DICTDBM, an alias
must be defined for $REDEFINES so that DICTCDE can use the alias as the COBOL
identifier for $REDEFINES. $REDEFINES can be related to the file only once. DICTCDE
keeps track of the storage space of the first record layout and correctly lays out the
subsequent elements after the $REDEFINES into alternate records, thus each alternate
record format does not exceed the storage space of the first record. For example, the
element ELEM10 has the child elements ELEM2, ELEM3, ELEM7, $REDEFINES and
ELEM8 (in that order). The parent element ELEM10 is defined in the Dictionary as:
ELEMENT = ELEM10
ELEMENT-TYPE = X
ELEMENT-SIZE = 28
ELEMENT-LENGTH = 28
Suppose the child elements are defined in the Dictionary as:
CHILD-ELEMENTS = ELEM2 ELEM3 ELEM7 $REDEFINES ELEM8
ELEMENT-TYPE = X I X X
ELEMENT-SIZE = 12 5 28 10
ELEMENT-LENGTH = 12 4 28 10
ELEMENT-BYTE POSITION = 1 13 1 1
ELEMENT-ALIAS = REDEFINE-REC
Note that if any of the above elements were not related to the parent element in the correct
order, you could change the order with the REORDER command provided by DICTDBM.
The code for the element ELEM10 would be generated as follows:
000100
000200 01 ELEM10.
000300 05 ELEM2 PIC X(12).
000400 05 ELEM3 PIC S9(5) COMP.
000500 05 FILLER PIC X(12).
000600 01 FILLER REDEFINES ELEM10.
000700 05 ELEM7 PIC X(28).
000800 01 REDEFINE-REC REDEFINES ELEM10.
000900 05 ELEM8 PIC X(10).
001000 05 FILLER PIC X(18).