REDUCE

The REDUCE option specifies that the compiler is permitted to reduce an assignment of a null string to a structure into simpler operations - even if that means padding bytes might be overwritten.

The REDUCE option also allows the compiler to reduce the assignment of matching structures into a simple aggregate move - even if the structures contain POINTER fields.

Read syntax diagramSkip visual syntax diagram
   .-REDUCE---.   
>>-+-NOREDUCE-+------------------------------------------------><

The NOREDUCE option specifies that the compiler must decompose an assignment of a null string to a structure into a series of assignments of the null string to the base members of the structure.

Under the NOREDUCE option, BY NAME assignments that can be reduced to aggregate moves are not reduced if the elements that would be moved together have the AREA or VARYING(Z) attributes.

The REDUCE option causes fewer lines of code to be generated for an assignment of a null string to a structure, and that usually means your compilation is quicker and your code runs much faster. However, padding bytes might be zeroed out.

For instance, in the following structure, there is one byte of padding between field12 and field13.
  dcl
   1 sample ext,
     5  field10          bin fixed(31),
     5  field11          bin fixed(15),
     5  field12          bit(8),
     5  field13          bin fixed(31);

Now consider the assignment sample = ’’;.

Under the NOREDUCE option, it will cause four assignments to be generated, and the padding byte will be unchanged.

However, under REDUCE, the assignment will be reduced to one operation, but the padding byte will be zeroed out.

The NOREDUCE option makes the compiler act more like the OS PL/I and the PL/I for MVS™ compilers. These compilers would reduce an assignment of matching structures into a simple aggregate move unless the structures contain POINTER fields. The NOREDUCE option will make this compiler act the same way.