Modify Stage

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
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Modify Stage

Post by rwierdsm »

I've searched the forum to no avail for a way of assigning an outgoing column to zero in a modify stage.

Our mapping rules have changed and a value that is being fed in from a number of jobs will now need to be zero. Rather than modify the 30+ jobs that feed the job in question, I want to set the column to zero in the receiving program. I naively thought, 'Surely the modify stage can do this simple task'!

If such an assignment is possible in the modify stage, it has certainly defied my best attempts at determining how it would be possible.

What I need to do is:
Incoming value: import_seq -> any numeric value
Outgoing value: import_seq -> 0

Has anyone out there successfully performed such an assignment?

(Maybe my question should be 'Has anyone ever actually gotten this stage to do anything useful, other than change a data type?')

Frustrated in Toronto,

Rob W.
Rob Wierdsma
Toronto, Canada
bartonbishop.com
thompsonp
Premium Member
Premium Member
Posts: 205
Joined: Tue Mar 01, 2005 8:41 am

Post by thompsonp »

You want to transform any input value to the value 0 on output. What's wrong with a transformer?

The modify stage does lots of useful things. I suggest you take a look at the tech tips video that shows how to put the modify stage to good use.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

The modify stage will drop/keep columns and convert datatypes of columns. Its functionality is pretty rudimentary and that's why it is lot more efficient than a transformer. When you want to change a value of a column, even to 0, you'll need to use a transformer.
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post by rwierdsm »

thompsonp,

Thanks for your response.

Of course I can use a transformer.

I have used transformers many times when I thought the function I needed to perform should be easy for a modify to accomplish. However transformers are slow. Modify is fast. The occasions I have used it to change data types I have been pleased with the speed with which it performs. I thought that so simple a function as assigning a constant to a column should be managable by a modify and am very surprised that it won't do it in any obvious (to me!) way.

I'm hoping someone out there will tell me I'm being silly and of course a modify can do that -> here's how! Now I need the 'here's how' part....

Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

There is no Modify function that sets a constant value! You can do a little hack to get what you want. For example lookup_int16_from_string( default_value=0('AAA=0')) might return a 0 all the time. NullToZero(SetNull)) might work if the Modify stage accepts multiple functions. IsNull(SourceColumn) might return 0 (for false).
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The Modify stage has a function called handle_null() for replacing an out of band null (the NULL you're talking about) with a specific value (an in-band null).

It also has a function called make_null() for generating an out of band null.

So perhaps you could try:

Code: Select all

NewCol=handle_null(make_null(OldCol),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.
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post by rwierdsm »

vmcburney wrote: NullToZero(SetNull)) might work if the Modify stage accepts multiple functions.
Thanks for your response Vincent. I tried this particular hack, but no luck!

Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
rwierdsm
Premium Member
Premium Member
Posts: 209
Joined: Fri Jan 09, 2004 1:14 pm
Location: Toronto, Canada
Contact:

Post by rwierdsm »

Hi Ray,

Got
main_program: Error parsing modify adapter: Error in binding: Encountered more than one 'handle_null' or 'make_null'
Expected destination field selector, got: ")";
on that attempt.

I think I'm going to use the transformer. No more time to play!

Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You might try Vincent's suggestion, but note that the default value clause needs to be enclosed in curly braces and it and the "table" in square brackets.

Code: Select all

lookup_int16_from_string[{default_value=0}('AAA=0')](inputcolumn)
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