Filling Gaps in tables

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
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Filling Gaps in tables

Post by dsrules »

Hi,
We are trying to fill in missing rows among three tables.
For Ex: The present scenario

Code: Select all

TABLE A                           TABLE B                         TABLE C
ID,Date,Amt                    ID,Date,Amt                        ID,Date,Amt
10000003,1/31/2004,100.00   10000003 1/31/2004,120.00        10000003,1/31/2004,90.00
10000003,2/28/2004,200.00   10000003,2/28/2004,145.00                                                             
                                                             10000003,3/31/2004,130.00
10000003,4/30/2004,110.00                                    10000003,4/30/2004,140.00
After the ETL run

Code: Select all

TABLE A                           TABLE B                         TABLE C
ID,Date,Amt                    ID,Date,Amt                        ID,Date,Amt
10000003,1/31/2004,100.00   10000003 1/31/2004,120.00        10000003,1/31/2004,90.00
10000003,2/28/2004,200.00   10000003,2/28/2004,145.00        10000003,2/28/2004,90.00
10000003,3/31/2004,200.00   10000003,3/31/2004,145.0         10000003,3/31/2004,130.00
10000003,4/30/2004,110.00   10000003,3/31/2004,145.0         10000003,4/30/2004,140.00
For each matching ID the amount for the missing dates has to be copied from the row above, the dates are copied from the other tables when ever missing. If there is a missing row in all the three tables for a specific month we are not concerned about it.
How do we go about doing this in DataStage.
Thanks !

dsrules
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
pnchowdary
Participant
Posts: 232
Joined: Sat May 07, 2005 2:49 pm
Location: USA

Post by pnchowdary »

Hi dsrules,

Could you please correct the format (allignment of your data and column names) of your example?. Its very unreadable now.
Thanks,
Naveen
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

If you are getting the values from the current row then it should be easy to check for nulls and then fill in the values. If you need values from previous rows then you could do with Stage variables. Do a search. There are lots of posts using stage variables to save previous rows values.
Mamu Kim
dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Post by dsrules »

Thanks Kim. We are using Stage Variables for it !
______________________________________
"Everytime I close the door on reality, it comes in through the windows." - Jennifer Yane
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Please post your solution.
Mamu Kim
Post Reply