TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: SID LEE
from: RONALD SCHLEGEL
date: 1997-05-31 17:57:00
subject: READ/DATA

Sid,
 
SL> It's not clear to me why your code fragment doesn't work as you
SL> if err = 4 then restore read temp$ end if
 
That's exactly why...:) We had the same code fragments & I discovered a 
way around this & why it doesn't work. (Might be good to add to the PB-
FAQ)
 
Here's the wrong version:
 
-------------------
 
ON ERROR RESUME NEXT
 
READ Temp$
 IF ERR = 4 THEN
  RESTORE
  READ Temp$
 END IF
 
DATA Run, Jog, walk
 
--------------------
 
In the above example (to my discovery) Once it reaches ERR = 4, it never 
"resets" the error to a null. So, once ERR=4 is in memory, it RESTORES
at each call to READ. :)
 
Here's my correction:
 
----------------------
ON ERROR GOTO Handler
 
READ Temp$
 
DATA Run, Jog, Walk
 
Handler:
 
SELECT CASE ERR
  CASE 4
   RESTORE
   RESUME
  END SELECT
---------------------
 
Works like a charm...:)
 
Thanks for the input, though...
 
-Ron
 
 * RM 1.3 03129 * Joy fixes us to eternity and pain fixes us to time.
--- TriToss (tm) Professional 11.0 - #229
---------------
* Origin: * Dynasty BBS * The Home of Crazy Nights Software * (1:110/1065.0)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.