I'm reading a text file that is created from a mainframe and I need a
suggestion for a deliniter other than the comma. I've gone through
the groups postings and seen just about every option. I don't have
any control over the text output and get commas in numbers and also
text field. In your opinion what would you feel is the next best
solution that the CSV reader can handle? Double quotes? Square
Brackets? Other? I have a bit of control over the delimiter that they
use in this situation.
Thanks,
Bruce Dunwiddie
I tried
System.Text.Encoding.Default= tab
and also
Dim csvData As New DataStreams.Csv.CsvReader(openFile.FileName, TAB,
System.Text.Encoding.Default)
but it's looking for the Char.. Do I set it to the Char value of 9?
Thanks
On Jan 15, 2:52 pm, shriop <shr...@hotmail.com> wrote:
> Well the CSV spec handles all the text issues that you're describing
> by using text qualifiers and escape sequences in addition to just the
> comma, so none of that requires you to switch to another delimiter
> other than comma. Now I do understand the annoyances trying to get the
> mainframe to write data using the escape sequences so I'll go back to
> your question. I would suggest simply using tab delimited files. I see
> fewer issues daily using tab delimited files than other formats like
> pipe delimited and it's fairly well recognized. And to read a tab
> delimited file using CsvReader, you just setSettings.Delimiter to tab
> andSettings.UseTextQualifier to false.
>
> Bruce Dunwiddie
>
> On Jan 15, 1:10 pm, Bill <morgenw...@gmail.com> wrote:
>
>
>
> > Bruce,
>
> > I'm reading a text file that is created from a mainframe and I need a
> > suggestion for a deliniter other than the comma. I've gone through
> > the groups postings and seen just about every option. I don't have
> > any control over the text output and get commas in numbers and also
> > text field. In your opinion what would you feel is the next best
> > solution that the CSV reader can handle? Double quotes? Square
> > Brackets? Other? I have a bit of control over the delimiter that they
> > use in this situation.
>
> > Thanks,- Hide quoted text -
>
> - Show quoted text -
csvData.Settings.Delimiter = vbTab
if you needed to set it to some other typeable character, you can use
the syntax
csvData.Settings.Delimiter = "|"c
although it looks like VB.Net will do the conversion for you if you
leave out the c
csvData.Settings.Delimiter = "|"
or yes, if you know the ascii number, you should be able to use this
syntax
csvData.Settings.Delimiter = Convert.ToChar(9)
It's even possible that there's some other simpler syntax for
converting a number to a char in VB.Net using some odd suffix, but I
don't know it.
Bruce Dunwiddie
> > - Show quoted text -- Hide quoted text -