Reading two different delimeters in a single flat file

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
manu.dwhds
Participant
Posts: 30
Joined: Fri Sep 26, 2008 9:33 pm
Location: Bangalore

Reading two different delimeters in a single flat file

Post by manu.dwhds »

HI ,
Please any body let me know how to read two diffrent delimters conatines single file like (Ex:my flat file containes Pipe and comma).
Please suggest using which stage we can perform this reading opeartion .
Last edited by manu.dwhds on Tue Feb 15, 2011 11:05 pm, edited 1 time in total.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

First suggestion, post in the correct forum based on your job type. I guessed PX, 8.x and UNIX so moved it here. If that's not right please go back and edit your post so that it is correct.
-craig

"You can never have too many knives" -- Logan Nine Fingers
manu.dwhds
Participant
Posts: 30
Joined: Fri Sep 26, 2008 9:33 pm
Location: Bangalore

Post by manu.dwhds »

Thanks for reply,
I have flat file it containes data few of the rows as comma delimter and few of the data as pipe delimeter when i read using sequntial file stage its not reading properly ,please let me know how to set the property in sequntial file stage.
Manu
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Post by myukassign »

Option 1
----------
Read the file using sequential file stage with delimiter comma.

Then use a following column import stage, there you can specify pipe as a delimiter to further split into columns

Option 2
----------

Read the file with just one column of length varchar 500 or something 1.e. read line by line

Decalre one stage variable where you can replace all pipes with comma, or all comma with pipe to make the delimiter uniform using convert function.

Now you know what to do, you can extract columns using Field / substring function.

split the column in the transformer with Field functions, you need to do it carefully not to missout any columns.
Last edited by myukassign on Wed Feb 16, 2011 12:18 am, edited 1 time in total.
manu.dwhds
Participant
Posts: 30
Joined: Fri Sep 26, 2008 9:33 pm
Location: Bangalore

Post by manu.dwhds »

Thanks for your quick reply
Manu
Post Reply