The REDUCE option specifies that the compiler is permitted to reduce an assignment of a null string to a structure into fewer, simpler operations - even if that means padding bytes might be overwritten.
The REDUCE option will cause fewer lines of code to be generated for an assignment of a null string to a structure, and that will usually mean your compilation will be quicker and your code will run much faster. However, padding bytes may be zeroed out.
For instance, in the following structure, there is one byte of padding between field11 and field12:
dcl 1 sample ext, 5 field10 bin fixed(31), 5 field11 dec fixed(13), 5 field12 bin fixed(31), 5 field13 bin fixed(31), 5 field14 bit(32), 5 field15 bin fixed(31), 5 field16 bit(32), 5 field17 bin fixed(31);
Now consider the assignment sample = '';
Under the NOREDUCE option, it will cause eight assignments to be generated, but the padding byte will be unchanged.
However, under REDUCE, the assignment would be reduced to three operations.
With NOREDUCE, you get code that looks like:
00004C 5810 3056 00015 | L r1,=A(@CONSTANT_AREA)(,r3,86) 000050 58E0 305A 00015 | L r14,=A(SAMPLE)(,r3,90) 000054 4100 0000 00015 | LA r0,0 000058 D206 E004 1000 00015 | MVC FIELD11(7,r14,4),+CONSTANT_AREA(r1,0) 00005E 5000 E000 00015 | ST r0,<s9:d0:l4>(,r14,0) 000062 5000 E00C 00015 | ST r0,<s9:d12:l4>(,r14,12) 000066 5000 E010 00015 | ST r0,<s9:d16:l4>(,r14,16) 00006A 5000 E014 00015 | ST r0,<s9:d20:l4>(,r14,20) 000072 5000 E018 00015 | ST r0,<s9:d24:l4>(,r14,24) 000076 5000 E01C 00015 | ST r0,<s9:d28:l4>(,r14,28) 00007A 5000 E020 00015 | ST r0,<s9:d32:l4>(,r14,32)
But with REDUCE, you get code like:
00004C 5810 3042 00015 | L r1,=A(SAMPLE)(,r3,66) 000050 58E0 3046 00000 | L r14,=A(@CONSTANT_AREA)(,r3,70) 000054 D703 1000 1000 00015 | XC _shadow1(4,r1,0),_shadow1(r1,0) 00005A D206 1004 E000 00015 | MVC _shadow1(7,r1,4),+CONSTANT_AREA(r14,0) 000060 D717 100C 100C 00015 | XC _shadow1(24,r1,12),_shadow1(r1,12)
Consequently, for best performance use the REDUCE compiler option.