I have a problem/dilemma which we are hoping can be accomodated in DFSORT but havent been able to successfully resolve it yet.
There is already a sort in place to split a file and accumulate a count on the trailers of the 2 outputs so we would like to add this in for tidyness rather than create a new step.
We have an incoming file with an amount and a credit/debit flag i.e.
The code we have tried just gives us operand errors or invalid syntax. At the moment its only been added for SORTOF01. The lines with # are what i've added although i'm not sure if SUM will work but TOTAL/SUBTOTAL etc dont seem to either.
OK, yes, it is not possible to make up your own syntax.
The SUM cannot be part of an IFTHEN.
You later have multiple OVERLAYs on an IFTHEN. You can't do that, but you can specify multiple columns in a single OVERLAY.
You do need to extend the record, with the credit value in one place and zero in another for credits and vice-versa for debits. You should then be able to get the TRAILER1 TOTALing for those two fields.
Since you are only processing 00 and 99 types, there may be benefit in
Get's rid of any other records as early as possible, and allows simplification of your OUTFIL INCLUDE. Won't make much difference to resource use for a COPY operation, but neater to be consistent.