how to split data from one field in to two fields

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
ashok
Participant
Posts: 43
Joined: Tue Jun 22, 2004 3:04 pm

how to split data from one field in to two fields

Post 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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post 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.
Mamu Kim
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post 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:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply