Page 1 of 1

How I can create a total&count using DFSORT?

PostPosted: Wed Oct 15, 2014 2:29 pm
by Claudg
I need to create just one report where the total amount and count should be divide in CRE and DEB. The amount to sum is the position. Could you please help to sortout it? thanks.

The input file is:
0123456789012345678901234
01071020140000000003700DR
01071020140000000005000DR
01071020140000000002000CR
01071020140000000005000DR
01071020140000000001700CR
The report that we need to have is:
REPRT01 INCOMING PAYMENTS
0015 2014/10/06-12:34 SPP01 PAYMENTS INCOMING FILE - 01

RECORD COUNT OF RECORDS - 3 2
TOTAL AMOUNT OF RECORDS - 137,00 - 37,00

Detail position 01,02
Position amount 10,13
CR/DR position 23,02

Thanks fro your help

Re: How I can create a total&count using DFSORT?

PostPosted: Wed Oct 15, 2014 3:07 pm
by BillyBoyo
You'll need OUTFIL's reporting functions or to use ICETOOL's DISPLAY operator.

OUTFIL has TOT/TOTAL and COUNT. Should give you what you want.

Re: How I can create a total&count using DFSORT?

PostPosted: Wed Oct 15, 2014 4:02 pm
by Claudg
Hi BillyBoyo, thanks for your reply.
I've been used the code below, but my problem is how I know to sum CRE or DEB? The amount is the same position and then I'm not able to get the proper report.
Could please give some code examples in order to help me? Thanks
INCLUDE COND=(001,002,CH,EQ,C'01')       -----> DETAIL RECORDS ONLY
OPTION COPY                                                       
OUTFIL FNAMES=SORTOUT,REMOVECC,NODETAIL,                           
  HEADER1=(C'REPRT01',                                           
           55X,C'INCOMING PAYMENTS FILE 01',                     
           38X,                                                   
           C'DATE - ',                                             
           C'2014/10/06'), 
 TRAILER1=(5/,C'RECORD COUNT OF DPM DIRECT DEBIT COLLECTIONS   ',
           C'IN SPLITTER         - ',                             
           8X,                                                     
           COUNT=(M10,LENGTH=10),59X,                             
           3/,                                                     
        3/,C'TOTAL AMOUNT OF DPM DIRECT DEBIT COLLECTIONS   ',     
           C'IN SPLITTER         - ',                             
           TOTAL=(119,013,ZD,M19,LENGTH=18),59X)


Code'd

Re: How I can create a total&count using DFSORT?

PostPosted: Wed Oct 15, 2014 5:57 pm
by BillyBoyo
You'll need to use IFTHEN=(WHEN=(logical-expression) to identify those which are "negative" from the text and use +0,SUB on the actual value to make it negative for those, then the TOTAL will work.

Re: How I can create a total&count using DFSORT?

PostPosted: Wed Oct 15, 2014 7:15 pm
by Claudg
Hi BilyBoyo,

is there any chance to sent me code? Thanks.
this is because I don't have enough knowledge about dfsort and special with IFTHEN=(WHEN=(logical-expression).
I mean where in the current code I have to put this instruction?
Thanks once more time