Page 1 of 1

Parsing Multi-Length Strings

Posted: Fri Dec 05, 2008 8:51 pm
by bmouton
I have a programming problem that I can't figure out how to do in DS Server ...

I have a column that can contain the following example set of values:
WRX-0001
WRX-0001.r1
WRX-0001.r2
RERWEEW-0001
RERWEEW-0001.r1
RERWEEW-0001.r2

I am trying to figure out how to read in a string, parse it as array, store the character within the array until I get to the '.r', then throw the rest of the string away.

In short, if you take the list of values above, I want to end up with this set:
WRX-0001
WRX-0001
WRX-0001
RERWEEW-0001
RERWEEW-0001
RERWEEW-0001

Any ideas on how to do this in Datastage Server? I could write a C program, read one character at a time, then when I get to two characters in the array that = .r, stop and write the value, then process the next record ...

Help!

Posted: Fri Dec 05, 2008 10:31 pm
by ray.wurlod

Code: Select all

Field(InLink.TheString, ".", 1, 1)
If there's no "." the Field() function will return the entire string.