Summing 2 fields of same record into 1
Posted: Tue Mar 22, 2011 12:27 am
Hello - I am trying to perform a sort/sum. For all records that match the sort-key, I want to sum the 2 amount fields into one. Here's an example of what my input file looks like:
1,5 = account(a5) - this is the sort key
6,5 = amount 1(n3.2)
11,5 = amount 2(n3.2)
The output should look like this:
Thanks for your help!
=COLS> ----+----1----+----2----+----3----+----4-
000001 111115559265667
000002 111116214218451
000003 222229871521492
000004 222224542121599
000001 111115559265667
000002 111116214218451
000003 222229871521492
000004 222224542121599
1,5 = account(a5) - this is the sort key
6,5 = amount 1(n3.2)
11,5 = amount 2(n3.2)
The output should look like this:
=COLS> ----+----1----+----2----+----3----+----4-
000001 11111201852
000002 22222187227
000001 11111201852
000002 22222187227
Thanks for your help!