I'm getting different output for these two sort cards, can someone tell me why?
1.
INCLUDE COND=((1,3,CH,NE,C'ABC',AND,5,3,CH,NE,C'PQR'),OR,
(1,3,CH,NE,C'CAB'),OR,
(1,3,CH,NE,C'CBA'),OR,
(1,3,CH,NE,C'ABC',AND,5,3,CH,NE,C'PQR'))
SORT FIELDS=COPY
2.
OMIT COND=((1,3,CH,EQ,C'ABC',AND,5,3,CH,EQ,C'PQR'),OR,
(1,3,CH,EQ,C'CAB'),OR,
(1,3,CH,EQ,C'CBA'),OR,
(1,3,CH,EQ,C'ABC',AND,5,3,CH,EQ,C'PQR'))
SORT FIELDS=COPY
This is basically, INCLUDE when NOT-EQUAL and OMIT when EQUAL.
The problem is you have not reversed the and's and or's. This means they are very different sort tests so will give different answers
If you look at the first Test, in particular:
Is always true,
While the following is false when chars 1,3 is anything but CAB or CBA:
with boolean logic, the rules are
So when changing from omit to include, you must reverse the And & or's
becomes: