index 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
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

index function

Post by seanc217 »

I know in other non-datastage functions, if you want to search backwards you would specify a negative number. Is this possible with this function?

TIA
nick.bond
Charter Member
Charter Member
Posts: 230
Joined: Thu Jan 15, 2004 12:00 pm
Location: London

Post by nick.bond »

Not as far as I know but if you test it and find it does it would be interesting to know.

I would approach this by using the Count function to find out how many of the strings there are. If you want the last one use.

Code: Select all

Index (string, substring, Count (string, substring))
Regards,

Nick.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No, the arguments to Index() must be a string, another string and a positive integer. The third argument is an occurrence. You are searching for a substring within a string. The first occurrence of the substring, the second occurrence of the string, and so on. Searching for the -3rd occurrence does not make sense.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
seanc217
Premium Member
Premium Member
Posts: 188
Joined: Thu Sep 15, 2005 9:22 am

Post by seanc217 »

OK thanks, I think what I'll count the number of occrurances as suggested.
Post Reply