ILE COBOL Programmer's Guide

The ON SIZE ERROR Phrase

The ON SIZE ERROR phrase of the ADD, SUBTRACT, MULTIPLY, DIVIDE, and COMPUTE statement will:

ILE COBOL registers the above mentioned condition handler at priority level 85. A user condition handler, which is registered at priority level 165, will only receive control if the above mentioned condition handler does not handle the exception.

When no ON SIZE ERROR phrase is coded, the binary and decimal overflow messages will not be issued, and floating-point overflow messages will be ignored. All other arithmetic MCH messages will typically be handled by the function check condition handler unless a user condition handler has been registered using the CEEHDLR API.

A size error condition occurs in the following situations:

During arithmetic operations, typical errors are size errors (MCH1210) and decimal data errors (MCH1202). Most MCH errors are not directly detected by ILE COBOL; they are detected by the operating system and result in system messages. ILE COBOL then monitors for these messages, setting internal bits that determine whether to run a SIZE ERROR imperative statement or issue a runtime message (LNR7200) to end the program.

To prevent the LNR7200 message from being sent, a user condition handler can be registered using the CEEHDLR API to handle the MCH messages or an ILE COBOL error handler can be coded using the COBOL bindable APIs to handle the LNR72xx inquiry messages.

ILE COBOL does detect errors that result from division by zero during an arithmetic operation. If detected by ILE COBOL, these errors cause the SIZE ERROR imperative statement to run.

System message MCH1210 generally occurs when moving one binary or decimal numeric field to another, and the receiver is too small. This error is monitored by ILE COBOL, and also results in the running of the SIZE ERROR imperative statement.

LNR7200 is a run-time message that is usually issued when an unmonitored severe error occurs in your ILE COBOL program.

System message MCH1202 is a typical example of an unmonitored severe error. This kind of error results in the ILE COBOL run-time message LNR7200 (or LNR7204 if the error occurs in a program called by a ILE COBOL program). System messages MCH3601 and MCH0601 are other examples of unmonitored severe errors.


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