Union Function

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
kpsita
Participant
Posts: 99
Joined: Tue Jul 21, 2009 11:43 pm

Union Function

Post by kpsita »

Hi,

I have a requirement where I need to add couple of values to the values I selected from a tables. How do I implement this in datastage.

For example, I do a select field1 from TableA on a DB2 stage. And now I need to add two more values to this selected field1 like AAA and BBB. When I do

select field1 from TableA
union all
values ('AAA')
union all
values('BBB')

The DB2 stage takes for ever to return the value. Is there any other alternate method. Thanks in advance.
KPSITA
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

You can create two rows using Row Generator by setting Number of Records as 2 and define the default values as "AAA" and "BBB".

Use funnel to combine DB2 data and Row Generator data.
You are the creator of your destiny - Swami Vivekananda
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Post by allavivek »

anbu wrote:You can create two rows using Row Generator by setting Number of Records as 2 and define the default values as "AAA" and "BBB".

Use funnel to combine DB2 data and Row Generator data.
I think for using funnel operation the metadata of input links should be same....

correct me if iam wrong...
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Yes metadata should be same in all input links to the Funnel stage.
You are the creator of your destiny - Swami Vivekananda
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

The OP's post and example indicates that the output is required only one column and not multiple columns. So, anbu's solution will work.
Kris

Where's the "Any" key?-Homer Simpson
arun_im4u
Premium Member
Premium Member
Posts: 104
Joined: Mon Nov 08, 2004 8:42 am

Post by arun_im4u »

Yes.

From Anbu's design..

--Define the column name(field 1) in the row generator as the same as what is defined in DB2.
-- Open the properties for that column in the row generator stage. Click on Algorithm. Add values ('AAA'). Add the values again ('BBB').
-- Set the row generator to run only for 2 rows and join with the DB2 output using the funnel stage.
allavivek
Premium Member
Premium Member
Posts: 211
Joined: Sat May 01, 2010 5:07 pm

Post by allavivek »

kris007 wrote:The OP's post and example indicates that the output is required only one column and not multiple columns. So, anbu's solution will work.
Yes ...i over looked it...
kpsita
Participant
Posts: 99
Joined: Tue Jul 21, 2009 11:43 pm

Post by kpsita »

This works perfect.

Thank you all for your help.
KPSITA
Post Reply