Issue with sequential 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
suneyes
Participant
Posts: 82
Joined: Mon Jul 21, 2008 8:42 am

Issue with sequential file stage

Post by suneyes »

A very good day to you all..

I have a sequential file as an input stage which reads a comma delimited file.
I am facing problem while exporting a field in that file.
I have a record layout in the below mentioned way.

AAAAAAAAAAAA,BBBBBBBBBBBB,"G , G 'E L', S 'E AL",DDDDDDDDDDDDDDD,EEEEEEEEE

My idea is to import the following record as


COLUMN1-AAAAAAAAAAAA,
COLUMN2-BBBBBBBBBBBB,
COLUMN3-G , G 'E L', S 'E AL,
COLUMN4-DDDDDDDDDDDDDDD,
COLUMN5-EEEEEEEEE


But currently my job is exporting the above record into the below layout


COLUMN1-AAAAAAAAAAAA,
COLUMN2-BBBBBBBBBBBB,
COLUMN3-G ,
COLUMN4-
COLUMN5-G 'E L', S 'E AL,DDDDDDDDDDDDDDD,EEEEEEEEE


I currently configured my sequential file stage with the following settings..

Delimiter=comma
Quote=double
Field Delimiter=None


Can you please help to get over this situation?
sun
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

Is it always true that column3 is surrounded by double quotes, does not contain any double quotes within it, and all the other columns are not surrounded by double quotes?
Choose a job you love, and you will never have to work a day in your life. - Confucius
suneyes
Participant
Posts: 82
Joined: Mon Jul 21, 2008 8:42 am

Post by suneyes »

Yes Eric. Thank you
sun
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

Double quote your 3rd column in your input file and read it. See if that works!
Kandy
_________________
Try and Try again…You will succeed atlast!!
suneyes
Participant
Posts: 82
Joined: Mon Jul 21, 2008 8:42 am

Post by suneyes »

kandyshandy wrote:Double quote your 3rd column in your input file and read it. See if that works!
But kandy..its already double quoted in the input file..iam I getting it wrong...
sun
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

suneyes wrote:am I getting it wrong...
No.. I don't have access to the tool to check it out.
Kandy
_________________
Try and Try again…You will succeed atlast!!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The parallel Sequential File stage is notoriously bad at handling quoted strings containing field delimiters.

Create a server Shared Container containing a server Sequential File stage and use this 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.
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

ray.wurlod wrote:The parallel Sequential File stage is notoriously bad at handling quoted strings containing field delimiters.
Seems like a bug. Do you know if anyone has ever opened a PMR on it and what the response was?

It is extra effort but it can be done in a parallel job by using Field() functions in a Transfomer stage that follows the Sequential File stage. Change the file settings to have a single column that's wide enough, such as VarChar(200), and set Delimiter=none and Quote=none. Then to separate each column, use one or more Field() functions.

Specify the double quote as the delimiter for the inner-most Field() function. If you look at the sample input row with " as the delimiter, you should see 3 subtrings:

occurrence 1: AAAAAAAAAAAA,BBBBBBBBBBBB,
delimiter: "
occurrence 2: G , G 'E L', S 'E AL
delimiter: "
occurrence 3: ,DDDDDDDDDDDDDDD,EEEEEEEEE

Use an outer Field() function to derive the rest (columns 1, 2, 4, 5) based on comma as the delimiter. Example to get column2:

Code: Select all

Field(Field(in.RECORD, '"', 1), ',', 2)
Choose a job you love, and you will never have to work a day in your life. - Confucius
SURA
Premium Member
Premium Member
Posts: 1229
Joined: Sat Jul 14, 2007 5:16 am
Location: Sydney

Re: Issue with sequential file stage

Post by SURA »

I tried the same with your sample data and it works fine, but in windows.

Ensure that

Fianl Delimiter = End / whatever
Delimiter = comma
Quote = double

DS User
suneyes
Participant
Posts: 82
Joined: Mon Jul 21, 2008 8:42 am

Post by suneyes »

ray.wurlod wrote:The parallel Sequential File stage is notoriously bad at handling quoted strings containing field delimiters.

Create a server Shared Container containing a server Sequential File stage and use this ...

Thanks Ray..

I have used a sever container stage with a server sequential stage in it and it works fine with me.

I expect this would have been fixed in the later versions of datastage.


As SURA said,This is working fine in Windows as well.

Thank you all for your response.I am marking this thread as resolved.
sun
qt_ky
Premium Member
Premium Member
Posts: 2895
Joined: Wed Aug 03, 2011 6:16 am
Location: USA

Post by qt_ky »

I have mentioned the issue to one contact at IBM but have not opened any PMR on it. I would be curious if anyone else has already opened a PMR or knows of an enhancement request existing???
Choose a job you love, and you will never have to work a day in your life. - Confucius
Post Reply