Read Line feeds in seqential file stage

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
dkaranth
Participant
Posts: 9
Joined: Tue May 20, 2008 3:51 am

Read Line feeds in seqential file stage

Post by dkaranth »

Hi guys,

I have a txt file which contains many records. Many of these records span multiple lines(i.e there can be line feed char).

eg:
111, "I work on
Datastage"

How can read one such record using the sequential file stage in Parallel job?

Another issue is that these multi-line fields can also contain comma (,). This comma also needs to be rejected by datastage and not considered as a field delimiter.

Can you please help me with this?

Regards,
Deepak
keshav0307
Premium Member
Premium Member
Posts: 783
Joined: Mon Jan 16, 2006 10:17 pm
Location: Sydney, Australia

Post by keshav0307 »

by defining the records delimiter correctly.
DSDexter
Participant
Posts: 94
Joined: Wed Jul 11, 2007 9:36 pm
Location: Pune,India

Post by DSDexter »

It doesnt matter how much lines you record is running into. What matters is where record delimiter is located. So giving the exact column and records delimiters should serve the purpose. :D


Thinking outside the box....
Your monitor can display only those many characters with the current screen resolution :P
Thanks
DSDexter
dkaranth
Participant
Posts: 9
Joined: Tue May 20, 2008 3:51 am

Post by dkaranth »

Hi guys,

I just tried the folowing input:

Col0|val0,Col1|Val
ue1Z

Here Z is the record de-limiter and comma is the value delimeter.

I get the error:
Sequential_File_1,0: Delimiter for field "Value" not found; input: {Col1|Val}

But if I give the folowing input, it works. i.e all in the same line
Col0|val0,Col1|Value1Z

So, does that mean that whatever record de-limiter we use needs to be in the same line as the rest of the record?

Regards,
Deeapk
DSDexter
Participant
Posts: 94
Joined: Wed Jul 11, 2007 9:36 pm
Location: Pune,India

Post by DSDexter »

dkaranth wrote:Hi guys,

I just tried the folowing input:

Col0|val0,Col1|Val
ue1Z

Here Z is the record de-limiter and comma is the value delimeter.

I get the error:
Sequential_File_1,0: Delimiter for field "Value" not found; input: {Col1|Val}

But if I give the folowing input, it works. i.e all in the same line
Col0|val0,Col1|Value1Z

So, does that mean that whatever record de-limiter we use needs to be in the same line as the rest of the record?

Regards,
Deeapk
Have you entered a line fed after Val?

There might be something after Val that is not visible to the naked eye. Using the od utility should explain you in detail. :D
Thanks
DSDexter
dkaranth
Participant
Posts: 9
Joined: Tue May 20, 2008 3:51 am

Post by dkaranth »

Hi,

I checked with the od utility. There are no characters after Val except line feed. Still getting the error :cry:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Is the record delimiter (that you have shown as "Z") also a linefeed?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dkaranth
Participant
Posts: 9
Joined: Tue May 20, 2008 3:51 am

Post by dkaranth »

Hi Ray,

There is a line feed after Z. But shouldn't DS ignore that and consider Z as the delimiter?

[quote="ray.wurlod"]Is the record delimiter (that you have shown as "Z") also a linefeed? ...[/quote]
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try pre-processing the file to eliminate the linefeeds that follow "Z" characters, and rely on the definition of "Z" as the record delimiter.

You should also be able to edit the table definition to indicate that the column in question contains line terminator characters (linefeeds).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
dkaranth
Participant
Posts: 9
Joined: Tue May 20, 2008 3:51 am

Post by dkaranth »

Hi Ray,

My requirement is as follows:

Some of the attributes/columns in my input file can span multiple lines(i.e. it has a line feed). And I should read them as is and transfer to another system.

If I remove the line feeds, then I wont be serving the purpose.

Any other suggestions?

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

Post by ray.wurlod »

Read again what I wrote.

Remove those linefeeds that follow "Z".
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