process db2 tables many-to-many relationship

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
DStageNewbie
Participant
Posts: 11
Joined: Wed Aug 12, 2009 6:05 am
Location: Kansas City

process db2 tables many-to-many relationship

Post by DStageNewbie »

We have a driver table (db2) containing an old part nbr and a new part nbr (a cross-reference). On this table, the old part nbr is not unique, so we could have two rows on the table with the same old part nbr, but two different new part nbrs. On a second table, we want to match on the old part nbr and build a new row transforming the old part nbr with the new part nbr. So when we are done, we will have rows with the old nbr and new rows with the new part nbr. How do we process this many-to-many relationship? Is there any good documentation out there that would help us understand how to process this situation? I am a rookie, so please be specific. thanks!
Bob
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Start by thinking about how you'd do it in SQL. A UNION, maybe? Then, essentially, replicate that methodology in DataStage. Probably the easiest is to have DataStage execute the SQL you got in the first step to perform the extraction.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DStageNewbie
Participant
Posts: 11
Joined: Wed Aug 12, 2009 6:05 am
Location: Kansas City

Post by DStageNewbie »

ray.wurlod wrote:Start by thinking about how you'd do it in SQL. A UNION, maybe? Then, essentially, replicate that methodology in DataStage. Probably the easiest is to have DataStage execute the SQL you got in the fi ...
I started out that route, but then realized that the two tables are on different platforms/servers and I could not figure out away to join them in one stage. Is that possible?
Bob
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

One of the tables will be your input stream, the other a reference lookup. If you need multiple rows from the lookup, you'll need to use ODBC or UV rather than the Hashed File stage for the reference lookup.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply