How this Row Splitter works

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
New2DS
Participant
Posts: 33
Joined: Sat Jun 26, 2004 9:58 am

How this Row Splitter works

Post by New2DS »

Hi All,

How does the row splitter stage work and what for is it used. I thought it will split one row into multiple columns but not able to split the rows I guess I am doing something wrong. In the stage input it will ask for the name of the row which we want to split and in the output columns some how if I add an extra column the job is getting aborted.

I have gone through the documention but it is very brief and not able to understand how to use this stage.

Can we split more than one column at a time? How do we define the output columns in the satge.



thanks,
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

Row Splitter works same like the sequential stage expect it reads the data from a link. This is to split a input column into multiple columns. For example if you have a column say reject_column which holds all the information into one single string then this string can be splitted into multiple columns based on the meta data.

I don't think we can split more than one column in a link.

Thanks
Siva
New2DS
Participant
Posts: 33
Joined: Sat Jun 26, 2004 9:58 am

Post by New2DS »

Thanks for the reply.

Still I am not able to split the column through this stage I don't know whats wrong am I doing.


I have the job design like this

Code: Select all

seq-->trn-->rowSplitter-->Seq
       |
       V
      hash
Input Seq is a .CSV file with input columns ( c1 char(12), c2 char(12), c3 char(4)). How can I split the column C1 into three equal columns as R1,R2 and R3 and I need the rest of the columns C2,C3 into the target seq file. What should be my metadata for the output R1,R2 and R3 is it like Char(4) each?

thanks
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Take out the rowsplitter, it's doing nothing for your job. You can do what you want to do in the transformer through standard string handling commands in the derivation columns.

You three output columns will be set to:
input.C1[1, 4]
input.C1[5, 4]
input.C1[9, 4]

This splits C1 into three fields that are sent to the output sequential file.

You current design, a link writing to a row merge writing to a sequential file, is like writing to two sequential files in a row. The row merge changes the metadata description of a row, you read in a record with a small number of fields and you get out of it a large number of fields. Columns that retain the same name on input and output of the stage are not changed, other columns are split according to the field lengths.
rcil
Charter Member
Charter Member
Posts: 70
Joined: Sat Jun 05, 2004 1:37 am

Post by rcil »

Hi All,

Does the row splitter splits the rows into columns based on the delimeter? If not how do we split a single string without any delimiter into two columns using this stage.

I tried like this in the input I have Id char(12) and in the output I defined as two columns with char(6) each but it doesn't work.When I tried using the delimiter it worked

Hope I will get helped in understanding this stage.

thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

No. The row splitter "decatenates" based on the contents of a column. It does have the ability to generate multiple rows.
There is a separate manual (splitter.pdf) that describes this stage type. The Row Splitter stage can only have one output link.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

Let me repeat what I said in the earlier reply. If you are only splitting a small number of columns there is no reason to use the rowsplitter stage, instead you can do this split in a transformer.

To split a field input.custcode char 10 into two fields:

"145634FRED"
input.custcode[1, 6] -> "145634"
input.custcode[7,4] -> "FRED"

Map each of these to an output field in your transformer and you have turned one field into two where the first six characters go down one path and the last four go down the other path.

If you have a delimited string do the following:
"145634,FRED"
FIELD(input.custcode, ',', 1) -> "145634"
FIELD(input.custcode, ',', 2) -> "FRED"

The field command retrieves a string from a delimited text string.

So when should you use the rowsplitter? When you have a large number of fields, say more then 6, and writing a FIELD or character array command for every output field is time consuming and difficult to maintain. You should also find that splitting the field in a transformer is faster then splitting it in the rowsplitter.

I use the rowmerge and rowsplitter stages when I do change data comparisons using the CRC32 function when I need to turn a record with a lot of columns into a single text string or vice versa.
udaysindu
Participant
Posts: 3
Joined: Sat Sep 22, 2007 9:38 pm
Location: hyderabad

hi

Post by udaysindu »

u can use the Pivot stage for columns into rows.
..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

hi

Post by chulett »

U can? Does he know that?

ps. Your time would be better spent in threads that aren't three years old. :roll:
-craig

"You can never have too many knives" -- Logan Nine Fingers
baglasumit21
Participant
Posts: 132
Joined: Wed Mar 01, 2006 11:12 pm
Location: Pune

Post by baglasumit21 »

New2DS wrote:Thanks for the reply.

Still I am not able to split the column through this stage I don't know whats wrong am I doing.


I have the job design like this

Code: Select all

seq-->trn-->rowSplitter-->Seq
       |
       V
      hash
Input Seq is a .CSV file with input columns ( c1 char(12), c2 char(12), c3 char(4)). How can I split the column C1 into three equal columns as R1,R2 and R3 and I need the rest of the columns C2,C3 into the target seq file. What should be my metadata for the output R1,R2 and R3 is it like Char(4) each?

thanks
As per my knowledge, the column to be splited should be the last column. So if you want to split the column C1 you need to rearange the cloumns as ( c2 char(12), c3 char(4),c1 char(12)). Try doing it this way
SMB
Raghavendra
Participant
Posts: 147
Joined: Sat Apr 30, 2005 1:23 am
Location: Bangalore,India

Post by Raghavendra »

You are replying to a post posted on Jul 30, 2004 .
Raghavendra
Dare to dream and care to achieve ...
Post Reply