Page 1 of 1

Duplication of records using Datastage

Posted: Sun Jun 05, 2011 10:21 pm
by adi_2_chaos
Hi All,

I'm stuck with a scenario wherein I need to provide duplicates of a recod on conditional basis. E.g. In the transformer stage I may check for the type, and let's say if I get the condition type='A', then I need 3 duplicates of the current record. That is, if the input row is:

1,A,20455,"Fault Description"

Then since I find type='A', then I would want exactly three output rows for the same. i.e.,

1,A,20455,"Fault Description"
1,A,20455,"Fault Description"
1,A,20455,"Fault Description"


Is this possible using datastage?

Thanks & Regards,
Sriram Garikapati

Posted: Sun Jun 05, 2011 11:05 pm
by ray.wurlod
Yes. Do the test in stage variables. Have three outputs from the Transformer stage, each constrained by the same expression. Use a Funnel stage downstream to bring them together if that's required.

Posted: Mon Jun 06, 2011 6:19 am
by suresh_dsx
Hi Sriram,

If you are reading from a sequential file. Read as a complete row into a single column.
in the transformer stage,

Code: Select all

StrVar1      Inputlnk.column:-
StgVar2      str(Inputlnk.column,3)
After transformer stage convert row into column based on the delimter "-" then use column import stage to split the columns and finally load in to target.

Thanks,
Suresh

Posted: Mon Jun 06, 2011 9:33 pm
by jwiles
If you're coding this in IS 8.5, the transformer loop functionality will handle this quite easily.

Regards,

Posted: Tue Jun 07, 2011 2:58 am
by udayk_2007
you can use a filter to check for the condition and put a copy stage with 3 output links to make 3 copies of the filtered record. Then output of copy stage can be collected together using a funnel stage.

Regards
Ulhas