how to get substring from string

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
ketanshah123
Participant
Posts: 88
Joined: Wed Apr 05, 2006 1:04 am

how to get substring from string

Post by ketanshah123 »

hi
how to get the substring from string in DS PX?
there is substrings function in server jobs,is there any such function in parallel job?
JoshGeorge
Participant
Posts: 612
Joined: Thu May 03, 2007 4:59 am
Location: Melbourne

Post by JoshGeorge »

InputString[StartPosition,NumberOfChar]
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Maveric
Participant
Posts: 388
Joined: Tue Mar 13, 2007 1:28 am

Post by Maveric »

Yes. FieldName[3,5]. ie from 3rd field take 5 characters. for an input "Anexample" will return "examp"
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In other words, the exact same function. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
bkumar103
Participant
Posts: 214
Joined: Wed Jul 25, 2007 2:29 am
Location: Chennai

Post by bkumar103 »

There is no direct function available in the parallel jobs. You have to make use of Right and left function. Like for example for the string "Hello" if we want to get the substring "ell" then left(right("Hello",4),3) and like this.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Despite bkumar103's confident assertion there IS a direct operation available in parallel jobs. In the Transformer stage use the square bracket notation mentioned by earlier posters. In the Modify stage use the substring() function, noting that character position is a zero-based number - that is, the first character in the string is position 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.
Post Reply