General HydroStatics
Ship Stability Software
Command of the Week
(New or interesting aspects of GHS that you may not know about)

Error Recovery


One of the features of the high-level "command language" that gives GHS its flexibility and power is its ability to avoid and recover from error conditions.

The GHS main program offers the ERROR system variable, the ERROR command, and the ESC macro for responding to input errors (as is thoroughly documented under the ERROR command).

In Part Maker (and PMX/GHSX), the RECOVER command can be used to direct the program to execute a particular macro in case of an input error.

RECOVER macname

The RECOVER command can be issued anywhere in the PM run file, and it can appear more than once. The only restriction is that the named macro exist. Example:

 MACRO ERR
  message Type QUIT to exit Part Maker.
 /
 RECOVER ERR

Another error-handling technique is to suppress a potential error from halting the program. In the GHS main program, this is commonly done by setting the ERROR variable to -4. For example,

SET ERROR=-4 | ERASE "Maybe.TXT" | SET ERROR=0

(This is slightly easier than checking for the existence of the file first and not doing the ERASE command if the file does not exist.)

In the PM/PMX/GHSX environment, the same thing is done quite simply by the ERROR IGNORE command, which causes any error in the next command to be ignored. For example,

ERROR IGNORE
ERASE "Maybe.TXT"

In that environment, there is also an ERROR system variable which is quite different from the one mentioned above. It is a string variable which will contain the error description. It can be set by the user as well as communicating an error detected by the system.

Questions, comments, or requests?
Contact Creative Systems, Inc.

support@ghsport.com

USA phone: 360-385-6212 Fax: 360-385-6213
Office hours: 7:00 am - 4:00 pm Pacific Time, Monday - Friday

Mailing address:
PO Box 1910
Port Townsend, WA 98368 USA

www.ghsport.com

Click here for an index to this and previous COWs