Page 1 of 1

how to split data from one field in to two fields

Posted: Fri Oct 15, 2004 7:28 pm
by ashok
Hi,
need help regarding spliting data from one field, and send it to two fields,

example:
ID | FIELD1 | FIELD2
MRPG2001 | |

RESULT:
ID | FIELD1 | FIELD2
MRPG2001 | MRP | G2001

Posted: Fri Oct 15, 2004 8:18 pm
by kduke
The field() function can split it based on any one character separator.

field(Col1, '|', 2)

Will give you the second field using '|' as a separator.

Posted: Sun Oct 17, 2004 4:19 am
by vmcburney
Have a look at the server job developers guide in your DataStage documentation. There is a section there on string functions. There are many ways to split up a string, the LEFT and RIGHT functions can split your string if you are always taking 3 and 5 characters.

Posted: Sun Oct 17, 2004 8:15 am
by chulett
That and as another example, the ever popular substring operator - the square brackets.

For example:

MRPG2001[1,3] = MRP
MRPG2001[4,5] = G2001

Best to read up as Vince suggested, so that you know about all of the Weapons of Mass Deconstruction at your disposal. :wink: