Hi All,
I have a typical requirement as shown below.But I am wondering if this can be achieved through icetool.
Input File
-----------
GRP
KEY Date CD Amount
--------------------------------------
AAAAA 2009-04-09 103 10
AAAAA 2009-04-09 104 20
AAAAA 2009-04-09 105 50
AAAAA 2009-02-06 104 40
AAAAA 2009-02-06 104 20
AAAAA 2009-02-06 105 90
AAAAA 2008-10-27 104 20
AAAAA 2008-10-27 105 70
AAAAA 2008-10-27 107 80
In the Input
1-5 : Key (5 bytes)
7-16: Date (10 bytes)
18-20: Grp CD (3 Bytes)
22-23: Amount (2 bytes)
In the output there should be one record for each date.
For a particular date, the summation of CD 103,104 should go to 1st Bucket in Output
For a particular date, the summation of CD 105,106 should go to 2nd Bucket in Output
For a particular date, the summation of CD 107,108 should go to 2nd Bucket in Output
Desired Output file
------------------------------------------------------------
Key Date 1st-Bucket 2nd-Bucket 3rdBucket
(1-5) (7-16) (18-19) (21-22) (23-24)
AAAAA 2009-04-09 30 50 0
AAAAA 2009-02-06 60 90 0
AAAAA 2008-10-27 20 70 80
I could proceed only upto the summation on CD Key/Date/CD combination.IFTHEN/SPLICE might
SORT Fileds=(1,5,CH,A,7,10,CH,D,18,3,CH,A)
SUM FIELDS=(22,2,CH)
Should I now split this file in six different subfiles based on the CD and then use them in splice?
But I believe you might have better ideas to acheive this.