Simple query

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
arnie_nits
Participant
Posts: 101
Joined: Mon Aug 13, 2007 2:32 am

Simple query

Post by arnie_nits »

hi,

I have a varchar field of lenght 11 and I need to find the characters from 6th to 9th position, in transformer stage.Plz help.

Regards
Arnab.
us1aslam1us
Charter Member
Charter Member
Posts: 822
Joined: Sat Sep 17, 2005 5:25 pm
Location: USA

Post by us1aslam1us »

check string() and substring() functions.simple case will be string[6,4].
I haven't failed, I've found 10,000 ways that don't work.
Thomas Alva Edison(1847-1931)
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

In the Modify Stage you use the substring function, in the Transformer stage you treat the field as an array and simply used inputfieldname[6,4] as shown by Arnab. You can also check the length of the field first if it's not always 11 characters.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

In the Modify stage, however, counting is zero-based, so you will need to retrieve four characters beginning from position 5.
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