[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: SQR & Flat Files
You can follow this example for reading a file
if exists('cust.dat') = 0
open 'cust.dat' as 10 for-reading status=#ostat record=133 ! open the
file and SQR gets the fila as 10 and define the size of record in char
else
display 'File ''cust.dat'' does not exist: exiting'
stop quiet
end-if
if #ostat = -1
display 'File ''cust.dat'' could not be opened.'
stop quiet
end-if
while 1=1 ! Loop until break
read 10 into $c:12 $st:2 $z:10 ! Read the file as 10 an store the values
in every variable with the own size
if #end-file
break ! No more records to read
end-if
begin-sql
insert into cust (city, state, zip) values ($c, $st, $z) ! Insert the
prior variable to the table
end-sql
end-while
I hope that this works for you!!
-----Mensaje original-----
De: paresh.j.patel@BELLATLANTIC.COM <paresh.j.patel@BELLATLANTIC.COM>
Para: SQR-USERS@list.iex.net <SQR-USERS@list.iex.net>
Fecha: Martes, 04 de Enero de 2000 10:47 a.m.
Asunto: SQR & Flat Files
>SQR Version: SQR/4.2.3/PC/Windows NT 4.0/ODBC Level1/Apr 22 1998
>
>I need to write a SQR to read data from a flat file (as opposed to PS
tables),
>do some processing, and then generate a report. Does anyone have a working
>example I can look at? Any help would be appreciated. Thanks.