Example - Translating Unnamed Declarations

The following example shows how the Header-to-copy utility translates unnamed declarations in C source code to their equivalent COBOL copyfile form.

C source:

  typedef struct {
     int type;
     union {
        char b[20];
        short s[10];
        long l[5];
     } data;
  } XClientMessageEvent;

COBOL output:

 01  XClientMessageEvent is typedef.
     02  type                   usage int.
     02  filler          pic x(2).
     02  data.
         03  data.
             04  1b      pic x(20).
         03  filler redefines data.
             04  s occurs 10    usage short.
         03  filler redefines data.
             04  l occurs 5     usage long.