Getting Started with TRANSACT (32247-90007)
100 Chapter6
Data Structures
Another COBOL example is the following:
Figure 6-9. COBOL Redefinition of Data Storage
This same example in Transact is handled as follows:
Figure 6-10. Transact Redefinition of Data Storage
In Transact, these items are referred to as parent and child items. A child item as in lines
2 to 4 is equated to a byte offset of the parent item. If no offset is specified, it defaults to the
start of the parent item. Although our program may make a reference to yy, this child item
is never used in the LIST. Space must be reserved for the parent item which is date.
Lists or arrays are another common data structure. In COBOL, the following is a segment
of a program containing both a one and two dimensional array.
1 01 record-data.
2 02 dte pic 9(6).
3 02 date-redef redefines dte.
4 04 yy pic 99.
5 04 mm pic 99.
6 04 dd pic 99.
1 define(item) date 9(6):
2 yy 9(2)=date:
3 mm 9(2)=date(3):
4 dd 9(2)=date(5);
5 list date;