Data Definition Language (DDL) Reference Manual

Definition Attributes
Data Definition Language (DDL) Reference Manual529431-004
6-33
C
C
For C, the DDL compiler generates source code that combines the items of a
REDEFINES clause to a union. The C structure containing such a union has one more
item level than the corresponding DDL structure containing the REDEFINES clause.
This situation causes the DDL compiler to issue a warning message unless you include
the NOWARN command. The name of the union has the form
u_first_member_name. If the union name generated by the DDL compiler is the
same as any of its siblings defined in the same group, the DDL compiler issues an
error message and does not generate output.
COBOL
In COBOL, a redefining structure must not be smaller than the structure it redefines.
When REDEFINES and OCCURS clauses are at the same level, then FILLER emitted
results in an incompatible structure when compared with C, pTAL, or TAL output. To
avoid this, split REDEFINES and OCCURS to separate groups. Whenever possible,
the DDL compiler pads the smaller structure with FILLER fields to make it the same
size as the structure it redefines.
Example 6-24. REDEFINES Clause With C Output
DDL Input
DEF a.
02 b PIC 9(4)
02 c PIC 9(6).
02 d PIC 9(6) REDEFINES c.
END
DDL Output (C Code)
#pragma fieldalign shared2__a
typedef struct__a
{
char b[4];
union
{
char c[6];
char d[6];
} u_c;
} a_def;