Handling New Line within a column while reading

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
jerome_rajan
Premium Member
Premium Member
Posts: 376
Joined: Sat Jan 07, 2012 12:25 pm
Location: Piscataway

Handling New Line within a column while reading

Post by jerome_rajan »

Hi All,

My source is a .csv file in the following format

"col1","col2","col3","col4"
"1","2","3\n2","4"
"2","2","3\n2","4"

As you can see, col3 has a new line withiin it. When I try reading this file using sequential file stage, it isn't able to read the entire line since it finds a new line before the actual end of the record.

Can someone please help me with this issue?

Thanks in advance
Jerome
Data Integration Consultant at AWS
Connect With Me On LinkedIn

Life is really simple, but we insist on making it complicated.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a server Sequential File stage, either in a server job or in a server Shared Container in your parallel job.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Moderator: please move to Enterprise Edition forum

(moved)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jerome_rajan
Premium Member
Premium Member
Posts: 376
Joined: Sat Jan 07, 2012 12:25 pm
Location: Piscataway

Post by jerome_rajan »

Thank you Ray. But looks like I cannot select the server sequential stage in my parallel job. Either it has been disabled or I am missing something. Your advice would be much appreciated.
Jerome
Data Integration Consultant at AWS
Connect With Me On LinkedIn

Life is really simple, but we insist on making it complicated.
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Post by SURA »

Read carefully.

You are right. You can't use directly in PX, but you need to use the Server pallet and place the sequential file stage and then use it.
Thanks
Ram
----------------------------------
Revealing your ignorance is fine, because you get a chance to learn.
jerome_rajan
Premium Member
Premium Member
Posts: 376
Joined: Sat Jan 07, 2012 12:25 pm
Location: Piscataway

Post by jerome_rajan »

My bad! Thank you.

Besides this, are there no other alternatives solely using parallel stages?
Jerome
Data Integration Consultant at AWS
Connect With Me On LinkedIn

Life is really simple, but we insist on making it complicated.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

None of which I'm aware. Unless you want to write your own, of course.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

jerome_rajan wrote:But looks like I cannot select the server sequential stage in my parallel job. Either it has been disabled or I am missing something. Your advice would be much appreciated.
Read what I wrote again, carefully.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

you can try some other way using filter command in seq file stage ..
such as:

Code: Select all

tr -d "\n"
But make sure that, your \n at the end should not be removed.

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

Post by ray.wurlod »

The newlines are part of the client's data. You can't arbitrarily delete them!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply