getting positon of value

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
ssharmila
Participant
Posts: 17
Joined: Wed Jun 18, 2008 3:38 am

getting positon of value

Post by ssharmila »

can anyone tell me how to get positon of value in a list??

ex, A is an input having value like (1,2,3,4), i want to get the position of 2 in it...how can i implement this? Thanks in advance
sharmila
Sreenivasulu
Premium Member
Premium Member
Posts: 892
Joined: Thu Oct 16, 2003 5:18 am

Post by Sreenivasulu »

Pl Search the documentation or search the forum before posting

Regards
Sreeni
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

If you have a string with the value of "1,2,3,4,5" then the function "FIELD(In.String,',',2) will return the 2nd field as delimited by commas.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Index() will return the position of a substring within a string, but it sounds like you want to Locate() an array element instead. Check the documentation for the difference.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Craig - I recall that the function LOCATE() doesn't work in server transforms, just the "LOCATE x IN y SETTING z" syntax.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Correct, you'd need to write a custom routine to leverage that. Plus convert all those commas to Field Marks or Value Marks or some kind of dang marks first. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ssharmila
Participant
Posts: 17
Joined: Wed Jun 18, 2008 3:38 am

Post by ssharmila »

chulett wrote:Correct, you'd need to write a custom routine to leverage that. Plus convert all those commas to Field Marks or Value Marks or some kind of dang marks first. :wink: ...
Thank you all...I will try to write routine for that
sharmila
Post Reply