string extract

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
Sgiri1
Participant
Posts: 43
Joined: Sat Nov 08, 2008 10:58 pm
Location: Tambaram

string extract

Post by Sgiri1 »

hi i have a string like

87658799_qw456huji78_AT_TIME1

i should extract the first '_' delimited field from the string i.e. 87658799
how could this be done through a transformer. can some1 provide the exact function. and also the first '_' string may have any length. nothing can be considered as a constant here.
mahadev.v
Participant
Posts: 111
Joined: Tue May 06, 2008 5:29 am
Location: Bangalore

Post by mahadev.v »

You can use a field function. Field(InputCol,"_",1).
"given enough eyeballs, all bugs are shallow" - Eric S. Raymond
ShaneMuir
Premium Member
Premium Member
Posts: 508
Joined: Tue Jun 15, 2004 5:00 am
Location: London

Post by ShaneMuir »

Or the shorthand version:

Code: Select all

InLink.InputCol['_',1,1]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

... which compiles to precisely the same code as the equivalent Field() function.
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