Parsing Multi-Length Strings

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
bmouton
Participant
Posts: 18
Joined: Thu Nov 06, 2008 8:31 pm

Parsing Multi-Length Strings

Post 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!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Field(InLink.TheString, ".", 1, 1)
If there's no "." the Field() function will return the entire string.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply