Modify Stage
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 209
- Joined: Fri Jan 09, 2004 1:14 pm
- Location: Toronto, Canada
- Contact:
Modify Stage
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.
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
Toronto, Canada
bartonbishop.com
-
- Premium Member
- Posts: 209
- Joined: Fri Jan 09, 2004 1:14 pm
- Location: Toronto, Canada
- Contact:
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
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
Toronto, Canada
bartonbishop.com
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
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).
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Premium Member
- Posts: 209
- Joined: Fri Jan 09, 2004 1:14 pm
- Location: Toronto, Canada
- Contact:
Hi Ray,
Got
I think I'm going to use the transformer. No more time to play!
Rob
Got
on that attempt.main_program: Error parsing modify adapter: Error in binding: Encountered more than one 'handle_null' or 'make_null'
Expected destination field selector, got: ")";
I think I'm going to use the transformer. No more time to play!
Rob
Rob Wierdsma
Toronto, Canada
bartonbishop.com
Toronto, Canada
bartonbishop.com
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.