Reading a file using 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
mallikachaithu
Participant
Posts: 4
Joined: Thu Jul 22, 2010 4:38 am

Reading a file using sequential file stage

Post by mallikachaithu »

Hi,

I have text file which has multiple seperators in the data. (i.e the data consists of comma separator, space seprator in the same file)
I want to read this file using sequential file stage.
Can you guys help me how can i proceed.

Thanks
Mallika
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Can you post some examples of records from that file? :?

You'll probably need to read the record as a single long varchar field and then parse it "manually" but examples would help provide better direction.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Consider using Field Delimiter String property.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
epmenard
Premium Member
Premium Member
Posts: 17
Joined: Fri Oct 08, 2010 2:02 pm
Location: Montreal

Post by epmenard »

OR another option is to use tr or sed as unix command in a pre-job subroutine to replace one of the separators by the other allowing a read using a single separator value
mallikachaithu
Participant
Posts: 4
Joined: Thu Jul 22, 2010 4:38 am

Post by mallikachaithu »

Hi Chulett,

The file is like

111, "Mallika", India
121 "Chaithu" US
123, "Krishna", China

in the above file i have comma separated data in row-1 and space separated data in row-2.
So this file i want to read.
Mallika
sachinag
Participant
Posts: 12
Joined: Fri Mar 12, 2010 4:38 am

Re: Reading a file using sequential file stage

Post by sachinag »

Hi,

Read ur file with a delimiter that u think will not come in ur file as a delimiter,this will read record in ur file as a single column.

If you want to create the different files of same delimiter we can do that also using a transformer and count function in the constraint.

Regards
Sachin Gupta
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Of course, another option is to get whomever or whatever is producing that file to build a valid csv file rather than junk like that. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Reading a file using sequential file stage

Post by ray.wurlod »

sachinag wrote:Hi,

Read ur file with a delimiter that u think will not come in ur file as a delimiter,this will read record in ur file as a single column.

If you want to create the different files of same delimiter we can do that also using a transformer and count function in the constraint.

Regards
Sachin Gupta
The second person personal pronoun is spelled "you" in English, or "your" in possessive case.

Please eschew SMS-style abbreviations and prefer professional written English on DSXchange.
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