Duplication of records using Datastage

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
adi_2_chaos
Participant
Posts: 96
Joined: Fri Apr 17, 2009 5:58 am
Location: Delhi

Duplication of records using Datastage

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
suresh_dsx
Participant
Posts: 160
Joined: Tue May 02, 2006 7:49 am

Post 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
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

If you're coding this in IS 8.5, the transformer loop functionality will handle this quite easily.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
udayk_2007
Participant
Posts: 72
Joined: Wed Dec 12, 2007 2:29 am

Post 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
Post Reply