declare 1 A,
2 C,
3 E(3) union,
5 E1,
5 E2,
3 F;
declare 1 B(10) union,
2 C, 3 G, 3 H,
2 D;
begin;
declare 1 C like B;
declare 1 D(2),
5 BB like A.C;
end;
Declarations C and D have the results shown in the following example.
dcl
1 C, /* DIM and UNION not copied. */
2 C, 3 G, 3 H,
2 D;
dcl 1 D(2),
5 BB,
6 E(3) union, /* DIM(3) and UNION copied. */
7 E1, /* Note adjusted level-numbers. */
7 E2,
6 F;
The following example is invalid because C.E has the LIKE attribute.
declare 1 A like C,
1 B,
2 C,
3 D,
3 E like X,
2 F,
1 X,
2 Y,
2 Z;
The following example is invalid because the LIKE attribute of A specifies a substructure, G.C, of a structure, G, declared with the LIKE attribute.
declare 1 A like G.C,
1 B,
2 C,
3 D,
3 E,
2 F,
1 G like B;
The following example is invalid because the LIKE attribute of A specifies a structure, C, within a structure, B, that contains a substructure, F, having the LIKE attribute.
declare 1 A like C,
1 B,
2 C,
3 D,
3 E,
2 F like X,
1 X,
2 Y,
2 Z;