field function

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
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

field function

Post by subrat »

Can anyone give me the correct Field function syntax please?

e.g
my req is to extrac "ASIA EUROPE" from a string. I am using below code

Lnk[Index(SurrFileslnk.COL1, "ASIA EUROPE", 1),256], " ", 1, 1)

but seems someting wrong with above

Please suggest
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Biggest problem I see is there's no Field() function in your code. :wink:

To use Field to extract "X Y" from a space delimited string, you'll need to pull two fields, not one... and you would need to know what field number to start with, not the position of the sub-string in the string. Perhaps you should just substring it out?
Last edited by chulett on Thu Mar 31, 2011 2:54 pm, edited 1 time in total.
-craig

"You can never have too many knives" -- Logan Nine Fingers
subrat
Premium Member
Premium Member
Posts: 77
Joined: Tue Dec 11, 2007 5:54 am
Location: UK

Post by subrat »

chulett wrote:Biggest problem I see is there's no Field() function in your code. :wink:

To use Field to extract "X Y" from a space delimited string, you'll need to pull two fields, not one... and ...
Sorry missed the Field ;-)

Field(Lnk[Index(SurrFileslnk.COL1, "ASIA EUROPE", 1),256], " ", 1, 1)

Mate, i just noticed my membership expired.. can you please put your comment once again so i can see.. Hope i will get membership renewal soon.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You don't need Field() at all. Once Index() has reported the location of the start of "ASIA EUROPE" extract an 11-character substring beginning at that position, provided that that position is not zero. Otherwise return "".
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