1. Home
  2. FAULT directive

FAULT directive

Checks whether to issue a diagnostic, i.e. a fault, warning or message.

Options

DIAGNOSTIC = string token Severity of the diagnostic (fault, warning, message); default faul
FAULT = text Diagnostic code; default 'UF 1' for fault, 'UF 2' for warning
EXPLANATION = text Explanatory information

Parameter

    expression Logical expression to test whether or not to give the diagnostic

Description

FAULT can be used to generate a Genstat fault, warning or message, as requested by the DIAGNOSTIC option. The diagnostic is printed in the standard Genstat format. So, for example, faults and warnings are recognised by Genstat for Windows, and added to the Event Log. Also, the diagnostic will be suppressed (like those from Genstat directives) if that has been requested by the DIAGNOSTICS option of the SET directive.

There is a single parameter, which supplies a logical expression to decide whether or not to give the diagnostic; if this is omitted, the diagnostic is always given. The FAULT option defines the code to identify a fault or warning; this has a default of 'UF 1' for a fault and 'UF 2' for a warning. (Messages always begin with the standard prefix “Message: “.) The EXPLANATION option allows you to supply some explanatory information.

FAULT is particularly useful in procedures. For example, in a regression procedure, you might put

FAULT [DIAGNOSTIC=fault; FAULT='VA 6';\

  EXPLANATION='Y-variate must contain at least 2 values']\

  NOBSERVATIONS(Y) < 2

Then, if the y-variate has less than two non-missing values, Genstat will give a “VA 6” fault, and execution of the procedure will stop. The available Genstat faults are listed in the on-line help.

Options: DIAGNOSTIC, FAULT, EXPLANATION.

Parameter: unnamed.

See also

Directives: DISPLAY, EXIT, PROCEDURE, CALCULATE.

Commands for: Program control.

Updated on June 19, 2019

Was this article helpful?