Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!seismo!uwvax!uwmacc!uwmcsd1!lakesys!mark
From: mark@lakesys.UUCP (Mark Storin)
Newsgroups: comp.sys.atari.8bit
Subject: Re: Error Checking in Action!
Message-ID: <155@lakesys.UUCP>
Date: Mon, 13-Jul-87 01:56:33 EDT
Article-I.D.: lakesys.155
Posted: Mon Jul 13 01:56:33 1987
Date-Received: Tue, 14-Jul-87 01:37:59 EDT
References: <13254@topaz.rutgers.edu>
Reply-To: mark@lakesys.UUCP (Mark Storin)
Organization: Lake Systems, Milwaukee, WI
Lines: 50

In article <13254@topaz.rutgers.edu> appelbau@topaz.rutgers.edu (Marc L. Appelbaum) writes:
>
>Does anybody have any experience with error checking in Action!?  What
>I would like to do is have something similar to a BASIC trap.
>Here's a simplified version of my program:
>
>proc getfile (byte array name)
>printe("File to read-->")
>inputS(name)
>return
>
>prom main()
>;;varios declatarions, etc
>byte array fname
>getfile(fname)
>;;;other stuff
>
>return
>
>I would to have a error proc that when it finds a error 170 (invalid
>file name) or device error it will ask for a new name to be entered.
>
>Any ideas??????

	ACTION! has a built in error routine that can be redirected.  In your
case the simplest method to check for an I/O error is to create a procedure
that is called Myerr (or any such thing).  All this needs to do is to set a
global variable to the error number when called, as in:

	Proc Myerr(Byte err)
	  Errnum=err          ;Errnum being the global error variable
	Return

	In your "main" procedure add the following code:

	Card OSERR
	OSERR=Error		;save pointer to OS error routines
	Error=Myerr		;Point the error trapping at our routine

	Now, after the user inputs a file name, try to do an open on it, then
check your Errnum variable.  If it's not 0 then there has been an error and
you can check it and procede from there.

	Be sure to reset Error (Error=OSERR) before exiting the program or
else ACTION! won't be able to find its own error handlers.

------------------------------------------------------------------------------
Mark A. Storin					These opinions are my own,
Lake Systems, Milw., WI				you can't have them.
UUCP:  {ihnp4,uwvax}!uwmcsd1!lakesys!mark