Removing all characters before a certain type of character

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
zendo59
Participant
Posts: 6
Joined: Tue Feb 05, 2008 11:32 pm

Removing all characters before a certain type of character

Post by zendo59 »

In a Transformer stage

I have a field defined as Varchar (50) which contains values like

CBAIB\jon
CBAIB\fred
PBS\jon
XXXX\xxx

I need to strip off the \ and all characters preceding it so the output will look like

jon
fred
jon
xxx

Can someone point me in the right direction?

Thanks in advance.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Is Field() available in PX? If so:

Code: Select all

Field(YourColumn,"\",2)
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, Field() is available in parallel Transformer expressions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, Field() is available in parallel Transformer expressions.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
zendo59
Participant
Posts: 6
Joined: Tue Feb 05, 2008 11:32 pm

Post by zendo59 »

Thanks guys. FIELD worked like a charm!
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I think you want:

Field(YourColumn,"\",2,9999)
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Only if there are multiple delimiters in the string and you want all of the 'fields' after the first one. The assumption here was there were only two fields in the string, i.e. one delimiter.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply