String search

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
lmandhadi
Participant
Posts: 1
Joined: Tue Apr 21, 2009 7:37 pm

String search

Post by lmandhadi »

I have column history. I need to find out a particuler charcter in a column value, if the value is present then i will pass preior value of the charcter else i need to pass last charcter.

Example: Values are presented like
HIST_ID HISTORY
1 'AAAAAAAAAD'
2 'ABCBHBAAAA'
Search value is 'H'

If 'H' is present in a field i need to pass preior value i.e 'B'. If 'H' is not present in the field i need to pass right most value 'D'.

regards
mandhadi
Thanks,
Mandhadi
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Try index()
efxuser
Premium Member
Premium Member
Posts: 50
Joined: Tue Jun 24, 2008 9:00 am

Post by efxuser »

I tried with index but its working only for 2 condition.
I mean if the value having 'H' then its working other wise job getting abort.
EFX
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The function Index(In.HIST_ID HISTORY ,"H",1) will return a 0 if there is no "H" in the string or the starting position if it exists. No errors are returned.
Post Reply