ON-ERROR (On Error)

Free-Form Syntax ON-ERROR {exception-id1 {:exception-id2...}}
Code Factor 1 Extended Factor 2
ON-ERROR List of exception IDs

You specify which error conditions the on-error block handles in the list of exception IDs (exception-id1:exception-id2...). You can specify any combination of the following, separated by colons:

nnnnn
A status code
*PROGRAM
Handles all program-error status codes, from 00100 to 00999
*FILE
Handles all file-error status codes, from 01000 to 09999
*ALL
Handles both program-error and file-error codes, from 00100 to 09999. This is the default.

Status codes outside the range of 00100 to 09999, for example codes from 0 to 99, are not monitored for. You cannot specify these values for an on-error group. You also cannot specify any status codes that are not valid for the particular version of the compiler being used.

If the same status code is covered by more than one on-error group, only the first one is used. For this reason, you should specify special values such as *ALL after the specific status codes.

Any errors that occur within an on-error group are not handled by the monitor group. To handle errors, you can specify a monitor group within an on-error group.

When all the statements in an on-error block have been processed, control passes to the statement following the ENDMON statement.

For an example of the ON-ERROR statement, see MONITOR (Begin a Monitor Group).

For more information, see Error-Handling Operations.



[ Top of Page | Previous Page | Next Page | Contents | Index ]