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.
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
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
Code:
INCLUDE COND=(1,2,SS,EQ,C'01,99')
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.
I've been doing a bit more and some digging as well and i think i've come up with something that should give us what we want... but it still doesnt work.