Page 1 of 1

calculating sub totals

Posted: Wed Jun 01, 2011 7:22 am
by jastichoudaryuu
Hi,
iam new to datastage and am in learning stage. please let me know how to break coloumns to get subtotals in other row.

sample ip

id|colA|colB
1|x|z
2|y|t
1|a|b
3|c|d

desired output

1|x|z
1|a|b
1|2|
2|y|t
2|1|
3|c|d
3|1|


iam just practicing this scenario, after making derivation am getting like below output

id|colA|colB
1|a|b|
1|x|z**BREAK**1|2
2|y|t**BREAK**2|1
3|c|d**BREAK**3|1

now how to break columns to get subtotals

i used unix command in sequential stage filter option its not working properly.
and how can it take new row(sub total value) without assigning.
please let me guide.
Thanks in advance :?

Posted: Thu Jun 02, 2011 12:36 pm
by kommven
Try this

Use a "Copy" to split records, Link One goes to "Funnel". Link Two goes to "Aggregator" and same "Funnel."

and then output from "Funnel" to "Sequential File"

Make sure that all meta-data is fed correctly in Funnel.
Hope this helps.