Adding a Column to a Table

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
amit_dwh
Participant
Posts: 22
Joined: Tue Apr 11, 2006 6:04 am

Adding a Column to a Table

Post by amit_dwh »

I have a data file like :

name|age
drew|23
moore|45

I have another query returning a max value of some column,say max_value be column name and its max value be 1000.

Now i want a output file like

name|age|max_value
drew|23|1000
moore|45|1000

How can this be done with best efficient way in Datastage.

Amit
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's easy enough in DataStage - if the target table has the extra column, simply use the new metadata (table definition) an assign the constant 1000 to that column for all rows. Probably easiest is a Column Generator stage with a cycle beginning at 1000 with an increment of 0.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
amit_dwh
Participant
Posts: 22
Joined: Tue Apr 11, 2006 6:04 am

Adding a Column to the Table

Post by amit_dwh »

ray.wurlod wrote:It's easy enough in DataStage - if the target table has the extra column, simply use the new metadata (table definition) an assign the constant 1000 to that column for all rows. Probably easiest is a ...

The constant value of max_value column is determined at the time of job execution and is not pre defined.
So i cant declare tht in meta data definition of the table.
Have to figure out some other way around.

Amit
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Simply replcae the constant with a lookup to get runtime value.
The max value gained from the lookup should be loaded to memory so you should have no problem.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
amit_dwh
Participant
Posts: 22
Joined: Tue Apr 11, 2006 6:04 am

Post by amit_dwh »

roy wrote:Hi,
Simply replcae the constant with a lookup to get runtime value.
The max value gained from the lookup should be loaded to memory so you should have no problem.
IHTH,
If i use lookup then there is no key values on which i can specify the lookup.
So i will get Nulls returned for 1 table in Lookup stage.

Can u explain me the exact flow which ur talking about.

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a job parameter to supply the initial value for the cycle.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply