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
lfong
Premium Member
Posts: 42 Joined: Fri Sep 09, 2005 7:48 am
Post
by lfong » Mon Mar 12, 2007 1:07 pm
I am trying to trim all trailing characters after a '(' eg. abcdef (xxxx) would become abcdef
The trim function will not work because the trailing or leading function will only remove the '('.
What would be the best way to do this?
Thanks
DSguru2B
Charter Member
Posts: 6854 Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX
Post
by DSguru2B » Mon Mar 12, 2007 1:10 pm
Forget the trim function. Use the Field() function to extract everything before "(".
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
kumar_s
Charter Member
Posts: 5245 Joined: Thu Jun 16, 2005 11:00 pm
Post
by kumar_s » Mon Mar 12, 2007 9:38 pm
Trim can eliminate whitespace or tabs or spaces or any given character not any character that are available. DSguru2B suggestion should be more simple to your requirement.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
DSguru2B
Charter Member
Posts: 6854 Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX
Post
by DSguru2B » Tue Mar 13, 2007 6:44 am
Simple ,yes ; efficient, I dont know about that. I belive, using INDEX() to get the position of "(" and use it in substring ([1,x]) where x will be the position returned by INDEX().
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Tue Mar 13, 2007 6:49 am
Which is exactly how Field() works.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Posts: 6854 Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX
Post
by DSguru2B » Tue Mar 13, 2007 7:00 am
ray.wurlod wrote: Which is exactly how Field() works.
Hmm, did'nt know that. But makes sense. So it is safe to say that Field() is equivalent to INDEX() with substring, in efficiency?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Tue Mar 13, 2007 5:55 pm
Probably. Write it yourself in C, just to prove the point.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSguru2B
Charter Member
Posts: 6854 Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX
Post
by DSguru2B » Tue Mar 13, 2007 6:02 pm
ray.wurlod wrote: Probably. Write it yourself in C, just to prove the point.
Nah. Even if there is a difference, it must be negligible.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.