Consider the assignment P->Z = Q->Z; where Z is CHAR(6) BASED.
Under OPT(0), the old compiler would assign the source first to a 6-byte temporary and then assign the temporary to the target.
However under OPT(2), the old compiler would perform the assignment with one MVC.
These different implementations lead to different results if the source and target overlap.
The new compiler controls this behavior via the OVERLAP suboption of the DEFAULT compiler option:
For example, for the assignment SUBSTR(A,4,6) = SUBSTR(A,3,6);, if A = 'abcdefghijklm', then
Consequently, for the most compatibility with the least work, you might want to specify the compiler option DFT(OVERLAP).
But specifying this option will also force the compiler to generate slower code in situations where you know the source and target do not overlap and it will also cause the compiler to forego some other optimizations. You would be much better off if you changed your code to avoid source and target overlap and then use DFT(NOOVERLAP).
For instance, the assignment:
SUBSTR(A,4,6) = SUBSTR(A,3,6);
could be replaced by the assignments:
temp_Char6 = SUBSTR(A,3,6); SUBSTR(A,4,6) = temp_Char6;