[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

RE: [sqr-users] Line Terminators on flat files



Thanks for the alternative, but I finally managed to solve this issue. I
used a combination of Excel & Word to modify the flat file. First, in
Excel, i added a unique character at the end of each line. (||) Then I
opened up the file in Word, and replaced the carriage return (^p), or
Paragraph Mark, as it is called in Word, with a null value. After this
was done, I then replaced the unique character (||) with carriage
returns (^p) . This resulted in there only being CR's at the end of each
row of data, enabling the SQR to pick up all four fields successfully.
Thanks for your response.

Peter
 

-----Original Message-----
From: dbrawner /unix [mailto:dbrawner@att.net]
Sent: February 20, 2003 11:19 AM
To: sqr-users /unix
Cc: dbrawner /unix
Subject: RE: [sqr-users] Line Terminators on flat files


Convert the flat file to a .csv file with "s around long text.  Do this
by
importing to excel and saving as .csv

Then, using an #include like Ray's csv.sqh, read the file and get the
fields
into your variables like this:

begin-program
open 'your_file.csv' as 1 for-reading
record=5000:vary

while 1
read 1 into $line:5000
if #end-file
      break
end-if

do csv_get_field( $line, $variable_1 )
do csv_get_field( $line, $variable_2 )
do csv_get_field( $line, $variable_n )

do your_procedure


end-while

close 1
end-program

Dave

-----Original Message-----
From: sqr-users-admin@sqrug.org [mailto:sqr-users-admin@sqrug.org]On
Behalf Of Peter_Wheeler@gov.nt.ca
Sent: Thursday, February 20, 2003 12:38 PM
To: sqr-users@sqrug.org
Subject: [sqr-users] Line Terminators on flat files


Hello,
I am trying to read in a flat file through SQR that has 4 fields, with
the last field being a long datatype. This field is anywhere from 100 to
4000 characters in lentgh. It consists of written paragraphs, including
most ascii characters, as well as numerous carraige returns. My field
separator is a 'pipe' - |.
I cannot get SQR to properly read these 'long' lines of data as it
believes the CR is the line terminator. Is there a way for us to set the
line terminator to whatever character we want in the SQR?
Thanks

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users