COBOL ON SIZE ERROR – How to Resolve Quickly

The following is the general format of arithmetic statements with the ON SIZE ERROR phrase:

arithmetic statement
imperative statement]
imperative statement]
[END-arithmetic verb]

As with ROUNDED, the arithmetic statements are ADD, SUBTRACT, MULTIPLY, DIVIDE, and COMPUTE. The END-arithmetic verb term is END-ADD, END-SUBTRACT, and so on, and it must match up the statement being used.

Share it to your friends

The NOT ON SIZE ERROR phrase and the END-arithmetic term were introduced with the 1985 COBOL Standard and generally are not available with 1974 compilers.

When the ON SIZE ERROR phrase is specified and the condition does occur, the receiving field is not modified by the arithmetic statement, but the statements following that phrase are executed instead.

When the condition does not occur, the results are placed in the receiving field, and the statements following any NOT ON SIZE ERROR phrase are executed.

If no ON SIZE ERROR phrase is coded, but the condition does occur, the results are unspecified. In most cases, the high-order digits that will not fit will be truncated.

DB2 Tutorial

DB2 Tutorial with questions and answers for interviews.


Recent Posts


Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.