Row splitting

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
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Row splitting

Post by snassimr »

Hi !

I have long string I need to split it with defined delimitor
and output multiple rows to seq file.

How to do it ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Snassimr,

there are several very different ways to do this that depend upon your data. Does the string already contain the delimiters or do you want to break it up into chunks of length n; is the string of fixed length?

Have you looked into using the row splitter stage and why do you feel you can't use it?
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

Row splitter do from row several columns but its one rrecord . I need the string parse for many records with one column and the value is separated with '\\\'
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Could you give us a sample input row and output row?
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

input

Value1\\\Value2\\\Value3\\\Value4

Output requered :

Value1
Value2
Value3
Value4

As 4 rows with one column each
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Write a Transform with a derivation "EReplace(In.Column,'\\\',CHAR(010))" to replace all occurrences of '\\\' with a single LF. Write this to a sequential file or pipe with no formatting - no quotes or separators and use the UNIX style line termination. Then read the file and it will be in the format you desire.
srinagesh
Participant
Posts: 125
Joined: Mon Jul 25, 2005 7:03 am

Post by srinagesh »

or.. if you dont want to do so many steps... use Rowsplitter and then pivot it

Hope it helps

Nagesh
Post Reply