Simple defining allows you to refer to an element, array, or structure variable by another name.
The defined and base variables can comprise any data type, but they must match, as described earlier. The ALIGNED and UNALIGNED attributes must match for each element in the defined variable and the corresponding element in the base variable.
The defined variable can have the dimension attribute.
In simple defining of an array:
In simple defining of a string, the length of the defined string must be less than or equal to the length of the base string.
In simple defining of an area, the size of the defined area must be equal to the size of the base area.
A base variable can be, or can contain, a varying string, provided that the corresponding part of the defined variable is a varying string of the same maximum length.
Examples:
DCL A(10,10,10),
X1(2,2,2) DEF A,
X2(10,10) DEF A(*,*,5),
X3 DEF A(L,M,N);
X1 is a three-dimensional array that consists of the first two elements of each row, column and plane of A. X2 is a two-dimensional array that consists of the fifth plane of A. X3 is an element that consists of the element identified by the subscript expressions L, M, and N.
DCL B CHAR(10),
Y CHAR(5) DEF B;
Y is a character string that consists of the first 5 characters of B.
DCL C AREA(500),
Z AREA(500) DEF C;
Z is an area defined on C.
DCL 1 D UNALIGNED,
2 E,
2 F,
3 G CHAR(10) VAR,
3 H,
1 S UNALIGNED DEF D,
2 T,
2 U,
3 V CHAR(10) VAR,
3 W;
S is a structure defined on D. For simple defining, the organization of the two structures must be identical. A reference to T is a reference to E, V to G, and so on.