unable to read from a space delimited sequential 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
siddesai
Participant
Posts: 26
Joined: Thu Apr 26, 2007 11:28 pm

unable to read from a space delimited sequential file

Post by siddesai »

Hello All,

I have a sequential file with columns delimited by a space.

In all there are 4 columns in the source file.

Config settings -
1. Delimiter = white space
2. Final Delimiter = end
3. Column Type = Varchar
4. Column Length = Not specified

1 2 3 4

Code: Select all

51 01   07.04.2010 
Note that column 3 has a <<space>> value so when I read this row in view data DS reads column 4 in column 3. I have also specified null field value for column 3 as a ' ' but that doesn't seem to work either.

I have tested this with one single row and the problem seems to persist.
siddesai
Participant
Posts: 26
Joined: Thu Apr 26, 2007 11:28 pm

Post by siddesai »

For testing purpose, as soon as I add a value to the 3rd column, View data works fine but when I remove that value - same error.
chvenkat.v
Participant
Posts: 94
Joined: Fri Dec 14, 2007 3:22 am

Post by chvenkat.v »

write unix script to modify delimeter value and call that into before sub-routine.
paultechm
Participant
Posts: 27
Joined: Wed Jul 25, 2007 2:09 am

Re: unable to read from a space delimited sequential file

Post by paultechm »

Read as a single varchar column, use convert function to replace 'space' into 'comma'(or any other) ,use column import to parse this into multiple columns


-Paul
siddesai
Participant
Posts: 26
Joined: Thu Apr 26, 2007 11:28 pm

Post by siddesai »

Thanks for your replies.

The problem with using single varchar and then convert function is that when a column has a space in it then it will treat it as a delimiter therefore I will again end up with consecutive delimiters and incorrect column mappings

E.g.
59.40
749.50
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then get whomever is producing the file for you to create it properly. Either quote the fields or use a delimiter that does not occur in the data. Or both.
-craig

"You can never have too many knives" -- Logan Nine Fingers
siddesai
Participant
Posts: 26
Joined: Thu Apr 26, 2007 11:28 pm

Post by siddesai »

Unfortunately, I have zero control over that.

Craig, do you think there is any other solution to treat consecutive delimiter as one for my original post? Excel has it so I find it hard to believe DS doesnt have any option.



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

Post by chulett »

I don't see how treating "consecutive delimiters as one" would help here but perhaps I'm missing something, late on a Sunday night. Seems to me that would just slide any following fields down into the wrong column. :?

Still, bottom line is your file is invalid as a delimited file. I know you may have no control over that but you can certainly present that to whomever produces it and make your concerns known. Can't imagine it would be all that hard for them to produce something... proper.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Harini
Premium Member
Premium Member
Posts: 80
Joined: Tue Mar 16, 2010 1:32 am

Post by Harini »

If you can do it in excel, either you convert it to excel sheet and then read the csv file in Datastage, or ask them to convert it and give it to you.
jyothisdasms
Participant
Posts: 33
Joined: Wed May 19, 2010 12:15 am
Location: Pune

Post by jyothisdasms »

Read the whole file in one field without giving any delimitter.
Then use the change function to convert the two consecutive space into a single space.Then you can split the records using a Coulmn import stage giving space as delimitter

Let me know the results !!
" Dream like you will live forever, live like you will die today."
Post Reply