When you get an error, it is good to show the sysout from the step which shows the error, including the full message and its code, which I assume is WER247A.
Showing the JCL has added nothing.
If you are correct in your belief about the 590, then the step works, worked when you ran it and will always work in the future.
To be fair, you did wonder where your mistake was. "I'm right, is this a compiler bug"-type-of-thing we see too often, and often switch off and reply when seeing that type of phrase.
So, you're wrong, the computer is right, and you want to know how.
This is a bit tortuous:
OUTFIL FILES=03,SAVE,IFTHEN=(WHEN=(79,3,CH,EQ,C'INV'),
BUILD=(1,183,
608,12,
759,7,
184,388),HIT=NEXT),
IFTHEN=(WHEN=(79,3,CH,NE,C'INV'),
BUILD=(1,590))
When an IFTHEN=(WHEN=(logicalexpression) is true for a record, IFTHEN processing stops for that record. To modify that behaviour, you use HIT=NEXT.
However, you don't want to modify that behaviour, because you have mutually-exclusive conditions.
Then, if the first IFTHEN is satisfied, the second will never be tested. And if the first is not satisfied, you know that the second is certainly true.
OUTFIL FILES=03,SAVE,IFTHEN=(WHEN=(79,3,CH,EQ,C'INV'),
BUILD=(1,183,
608,12,
759,7,
184,388)),
IFTHEN=(WHEN=NONE,
BUILD=(1,590))
Consider IFTHEN=(WHEN=(logigcalexpression)... to be like a COBOL EVALUATE (if you know COBOL) and WHEN=NONE is the catch-all at the end if none of the tests are true. Where there is a single test, it is (also) like an IF/ELSE.
However, you don't need that second BUILD, because position 1,590 already contains the data of position 1,590. Because you have used an IFTHEN you can use IFOUTLEN to set the record-length for the output records (IFOUTLEN represents the output record-length after IFTHEN processing).
OUTFIL FILES=03,
SAVE,
IFOUTLEN=590,
IFTHEN=(WHEN=(79,3,CH,EQ,C'INV'),
BUILD=(1,183,
608,12,
759,7,
184,388))
Now your problem has gone away.
What was your problem? Your input, the REFORMAT record, was not 590. SORT is interested in rapid processing. It does not attempt to fully understand the IFTHEN-flow as a whole, it relies on the human coder to do that. Because of your code, SORT could not determine the IF/ELSE-EVALUATE/OTHER nature (it would take too long), and believed it would be possible that the original REFORMAT record could also reach the end of the OUTFIL.
Now, with the IFTHEN changes (I can't check specifically, I don't have SyncSORT) or with the IFOUTLEN for sure, you are not going to get that problem.
And, it is best not to code the DCB info for output datasets from SORT. SORT will provide what you have coded in the Control Cards. If you code it in the JCL as well, then you have two places to have it correct, and two places to maintain it.