UNIX format CSV File read into Jade

For questions and postings not covered by the other forums
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

UNIX format CSV File read into Jade

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:56 pm

by Scott Sheng >> Fri, 23 Dec 2005 12:12:56 GMT

The CSV file pull out from Sun Solarios OS, its file format is UNIX and cannot be read into Jade system correctly, it is imported to be as one line in Jade. But if you save it to be as PC file format, then it can be read into one by one line. My work space for it is below.

vars
file:File;
s:String;begin

create file transient;
file.fileName:="C:\T20051223000000.csv";
while not file.endOfFile()
do
s:=file.readLine();
write s;
endwhile;
epilog
delete file;
end;

I'd appreciate if someone could help me this.

Thanks
Scott

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: UNIX format CSV File read into Jade

Postby ConvertFromOldNGs » Fri Aug 07, 2009 12:56 pm

by Murray Symon >> Fri, 23 Dec 2005 21:17:47 GMT

Unix has a different line terminator (Lf) from PC/Windows (CrLf).
Jade sets the default according to the platform it is running on.
You can re-define it on the File object as follows (before the while loop):

file.endOfLine := Lf;

--
HTH,
Murray Symon.


Return to “General Discussion”

Who is online

Users browsing this forum: No registered users and 15 guests