View previous topic :: View next topic
Author
Message
julienloc New User Joined: 17 Aug 2007Posts: 29 Location: Brussels
Hi all,
I'm stuck on a problem. I think DFSORT/ICETOOL can solve it but I don't know how. Hope you can help.
Here what I try to do:
Layout of the example file:
In:
Code:
-keyA- -Qty-- --keyB-- --Coeff--
CCCC 20,02
AAAA 22,04 XXXX 3
BBBB 30,00
BBBB 20,00
EEEE 10,00
AAAA 07,10 XXXX 3
I would like as output to sum the Qty per KeyA and merge those with same key. But, when a record has KeyB associated, KeyA should be replaced by keyB (a conversion key), and the Qty transformed (multiplied) by the associated Coeff.
So, for the above input, the output should be:
Code:
--key- --Qty--
CCCC 20,02
XXXX 87,42
BBBB 50,00
EEEE 10,00
Thank you very much!
Julien.
Back to top
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
Here's a DFSORT job that will do what I think you want.
Code:
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
CCCC 20,02
AAAA 22,04 XXXX 3
BBBB 30,00
BBBB 20,00
EEEE 10,00
AAAA 07,10 XXXX 3
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=(16,4,CH,NE,C' '),
OVERLAY=(1:16,4,8:8,5,UFF,MUL,30,2,ZD,EDIT=(TT,TT)))
SORT FIELDS=(1,4,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,4,
TRAILER3=(1,4,8:TOT=(8,6,UFF,EDIT=(TT,TT))))
/*
Code:
BBBB 50,00
CCCC 20,02
EEEE 10,00
XXXX 87,42
If you want the output records in their original input order, let me know and I'll show you how to do that.
Back to top
julienloc New User Joined: 17 Aug 2007Posts: 29 Location: Brussels
That's exactly what I want to do.
Didn't know this would be so simple.
Thank you very much.
Julien
Back to top
Please enable JavaScript!