Error while reading a csv file
Posted: Thu Oct 11, 2007 9:17 am
Hi Guys,
I have a routine which breaks a file in to two.
When i run the routine it says "error reading file".
On further investigation i found that there are two empty strings in the middle of the data file which is thowing this error........
Please have a look at the code below
Code:
******* Skip first few records to get to get to the column headings
skip=@true
Loop While skip
ReadSeq Rec from File
Then
Irec=Field(iRec,',',1,4)
If Irec='Date,Site,Placement,Name' Then
skip=@false
End
End
Else
Call DSLogFatal("Error reading file...":Arg1,"JobControl")
GoTo ErrorExit
End
Repeat
***************************************************
so in between the data there are two empty strings with out the delimiters.
I am not able to figure out how to skip those two lines.....
If some body has any idea how to read those lines so that i can skip them,..
Thanks in advance
S
I have a routine which breaks a file in to two.
When i run the routine it says "error reading file".
On further investigation i found that there are two empty strings in the middle of the data file which is thowing this error........
Please have a look at the code below
Code:
******* Skip first few records to get to get to the column headings
skip=@true
Loop While skip
ReadSeq Rec from File
Then
Irec=Field(iRec,',',1,4)
If Irec='Date,Site,Placement,Name' Then
skip=@false
End
End
Else
Call DSLogFatal("Error reading file...":Arg1,"JobControl")
GoTo ErrorExit
End
Repeat
***************************************************
so in between the data there are two empty strings with out the delimiters.
I am not able to figure out how to skip those two lines.....
If some body has any idea how to read those lines so that i can skip them,..
Thanks in advance
S