Agreed. You may find tho', that the extra call out to TRIM may cause the
input loop to be too slow to collect all the incoming data. Better to get
the data, then trim as you process it...

Your loop doesn't cater for 80 col lines (or whatever length) and therefore
runs the risk of getting to the same place: the input buffer filling up
prematurely, or an embedded CR being interpreted an an Enter.

By limiting the input to a defined length, the INPUT buffer just handles 80
chars. You may even find, however, that a loop of -1 within a loop of recs
may work better... this captures any char sequences embedded (if any) and
ensures NO overflow, but might be a bit excessive. This is the method used
when getting input from laboratory machines, with NAKs and ACKs, etc.

* just get the data in
next.key = 0
LOOP
   chr = 0
   LOOP
      chr += 1
      if chr = {whatever length} THEN EXIT
      INPUT X,-1
      LINE := X
   REPEAT
   next.key += 1
   WRITE LINE ON FILE, next.key
REPEAT

* now process the input
SSELECT FILE
LOOP
   ...
REPEAT

As for getting the data across, you could always mail it...!!!

then issue a PINE command line and capture the output.


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tim Stokes
Sent: 26 February 2008 06:26 PM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] Type ahead buffer overflow

That is very similar to the one I use. Here is mine.

REC = ''
LOOP
INPUT XXX
UNTIL XXX = "*NED OF TEXT*" DO
REC<-1> = XXX
REPEAT

If you want to lose blank lines you change REC<-1> = XXX to 
IF TRIM(XXX) # "" THEN REC<-1> = XXX
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to