Skip to main content


[attrname := ] FAIL [ ( errormessage | errorcode ) ] ;

[attrname := ] FAIL( errorcode , errormessage ) ;

[attrname := ] FAIL( datatype [, [ errorcode ] [, errormessage ] ] ) ;

attrnameOptional. The action name, which turns the action into an attribute definition, therefore not executed until the attrname is used as an action.
errormessageOptional. A string constant containing the message to display.
errorcodeOptional. An integer constant containing the error number to display.
datatypeThe value type, name of a RECORD structure, DATASET, or DICTIONARY to emulate.

The FAIL action immediately halts processing on the workunit and displays the errorcode and/or errormessage. The third form is available for use in contexts where a value type or dataset is required. FAIL may not be used in an expression context (such as within a TRANSFORM)--use the ERROR function for those situations.


IF(header.version <> doxie.header_version_new,
   FAIL('Mismatch -- header.version vs. doxie.header_version_new.'));

FailedJob := FAIL('ouch, it broke');
sPeople   := SORT(Person,Person.per_first_name);
nUniques  := COUNT(DEDUP(sPeople,Person.per_first_name AND
          : FAILURE(FailedJob);
MyRecSet  := IF(EXISTS(Person),Person,
             FAIL(Person,99,'Person does not exist!!'));