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

Re: [sqr-users] Read a file into sqr



Debbie,

SQR reads a text file line by line. Just put the read within an endless loop
and break out when the end-of-file is reached.

For example:

open 'blah.txt' as 1 for reading record=100:vary

while 1

 if #end-file
   break
 end-if

read 1 into $some_variable:500
!The 500 indicate how many columns or chars wide the widest line is.

let $paragraph = $paragraph || ' ' || $some_variable

!OR ANOTHER APPROACH
read 1 into $name:30 $addr:30 $city:20 $state:2 $zip:5
!  <--do something here with the retrieved variables (store in array, print,
etc)-->

end-while

close 1

NOTE: I am referencing version 8.1 help file for my example.

Kyle Leonard
1AnswerSolutions

On Tue, 3 Jan 2006 09:05:37 -0500, Debbie Larney wrote
> I have a text file that I am reading in through sqr. The file has no 
> carriage returns or line breaks so the file wraps around. The end of 
> a line appears to be delineated by a non ascii character so I can 
> identify the end of a line. I think I need to in essence do a find 
> and replace on the non ascii character so that I can replace it with 
> a line break and read the file line by line into the sqr. Anyone 
> have sample code or ideas doing a find and replace within sqr.  Do I 
> have to first read the entire file into a string and then do the 
> find and replace. If so what are the limitations with this method.
> 
> Thanks,
> 
> Debbie
> 
> ******************************************************************** 
> CONFIDENTIALITY NOTICE: 
> The information contained in this e-mail is legally privileged and 
> confidential information intended only for the use of the individual 
> or entity to whom it is addressed.  If the reader of this message is 
> not the intended recipient, you are hereby notified that any viewing,
>  dissemination, distribution, or copying of this e-mail message is 
> strictly prohibited.  If you have received and/or are viewing this e-
> mail in error, please immediately notify the sender by reply e-mail, 
> and delete this e-mail from your system.
> 
> Thank you. 
> ******************************************************************** 
> 
> _______________________________________________
> sqr-users mailing list
> sqr-users@sqrug.org
> http://www.sqrug.org/mailman/listinfo/sqr-users



___________________________________
Kyle J. Leonard
kyle.leonard@1answersolutions.com

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