Page 1 of 1

How to removw the duplicate words in thecolumn

Posted: Tue Dec 18, 2007 8:43 am
by uppalapati2003
i have one string like "ram sita ravan ram lakshman"
i need to get out put "ram sita ravan lakshman"
please help me in this

Posted: Tue Dec 18, 2007 8:50 am
by ArndW
There is no single function in DataStage that will do this for you. It isn't a complex thing to do in either a Server BASIC program or a C++ routine, though. I would assume that the space character is the token delimiter and then write a loop to check each token with all following ones to check for and remove duplicates. By the time you reach the last token you will have removed all the duplicate.

Posted: Tue Dec 18, 2007 3:38 pm
by ray.wurlod
What output is needed where there are case differences, such as "Ram sita ravan ram lakshman"? What output is needed where there are embedded substrings, such as "ram sita ravan ram lakshram"?

I agree that this falls into the do-it-yourself category but, before you do, tighten your specification as much as possible.

I suggest that this is easier done in DataStage BASIC than in C++, using dynamic arrays and the Locate statement. Of course, that suggestion is moderated by one's expertise with the two programming languages.