row merger

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
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

row merger

Post by just4u_sharath »

i have data IN A SEQUENTIAL FILE LIKE
1|2|3
4|5|6
7|8|9
Now i want to convert this data to 123456789 in a single row.
My job is sequentilal file----->row merger----->sequential file
When i run the job by selecting MULTIPLE LINES my ouput file looks like
1|2|3
4|5|6
7|8|9 (when i checke in output sequential file)
But the output link frin rowmerger gives a count of 1, but still i am able to see 3 rows in output. What is this behaviour. And also if i wnat to concatenate only two columns in each row, how can i do this. What kind of derivaations can i use in Derivation field of Row Merger
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

Re: row merger

Post by just4u_sharath »

just4u_sharath wrote:i have data IN A SEQUENTIAL FILE LIKE
1|2|3
4|5|6
7|8|9
Now i want to convert this data to 123456789 in a single row.
My job is sequentilal file----->row merger----->sequential file
When i run the job by selecting MULTIPLE LINES my ouput file looks like
1|2|3
4|5|6
7|8|9 (when i checke in output sequential file)
But the output link frin rowmerger gives a count of 1, but still i am able to see 3 rows in output. What is this behaviour. And also if i wnat to concatenate only two columns in each row, how can i do this. What kind of derivaations can i use in Derivation field of Row Merger
I got rid of delimiters.
Nou my output data looks like 1|2|34|5|67|8|9. How can i get rid of these pipe delimiters in output
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

What do you want to replace them with? Use a Convert() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ganesh.soundar
Participant
Posts: 9
Joined: Tue Jan 08, 2008 7:21 am
Location: Chennai

Post by ganesh.soundar »

ray.wurlod wrote:What do you want to replace them with? Use a Convert() function. ...
Use the below code to remove the pipeline symbol

Convert('|','',<FieldName>)
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

hello just4u_sharath


i am facing the same problem, i am seeing 3 rows in output, but i want them to be in single rows like 123456789 for input

1;2;3
4;5;6
7;8;9

i see
1;2;3
4;5;6
7;8;9 in output.

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

Post by ray.wurlod »

Use a stage variable to accumulate via concatenation and constrain the transformer stage to emit output only every third row.

Code: Select all

Mod(@INROWNUM,3)=0
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Post by sachin1 »

Hello Ray is it not possible with row merger stage.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Neither is Convert(). I thought you may be considering other stage types. Can you post how you are attempting to merge the rows with the Row Merger stage?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DS_FocusGroup
Premium Member
Premium Member
Posts: 197
Joined: Sun Jul 15, 2007 11:45 pm
Location: Prague

Post by DS_FocusGroup »

if i concatinate all three input columns in a StageVar= col1:col2:col3
and then put this constraint in the transformer Mod(@INROWNUM,3)=0, it will just give me every third row and in this care 789 ? but we need 123456789 ? no ? what if we have more than three rows ? say a thousand ?
savis
Premium Member
Premium Member
Posts: 27
Joined: Tue Apr 15, 2008 11:06 pm

Post by savis »

Hi,

I used the following design:
seq file ---- transformer-----seq file

My input was like

1|2|3
4|5|6
7|8|9
11|12|13
14|15|16
17|18|19

In the first seq file,

I didn't not specify any end delimiter or field delimiter.

In Transformer,

I used two stage variables for doing this task.

Ist stage variable:(stagevar)

If Mod(@INROWNUM,3) =1 Then DSLink2.INPUT Else If Mod(@INROWNUM,3) =2 Then StageVar:DSLink2.INPUT Else StageVar:DSLink2.INPUT

2nd stage variable:(stagevar1)

Convert("|","", StageVar)

OUTPUT:

123456789
111213141516171819

Hope this helps...

Thanks,
savis
Post Reply