I wanted to post this in case some of you are unaware of this behavior in
ILE/COBOL. We are in the midst of migrating several hundred COBOL programs
from a VSE mainframe environment to ILE/COBOL on v5r3/v5r4 systems. VSE
supports a language environment (LE) similar to ILE but not nearly as
We have many programs that contain arithmetic statements that, depending on
the data passed, could potentially encounter division by zero. Practically
all of these programs are not coded with the ON SIZE ERROR clause that would
trap that exception. When division by zero does occur in the LE environment
and no exception handler is specified, the O/S gets involved, cancels the
program and produces a dump. This is the default behavior when division by
zero occurs and it is not handled by the application program.
I was shocked to discover that in ILE/COBOL this is not the case at all. If
division by zero is encountered at run-time and no exception handler is
specified (i.e. no ON SIZE ERROR clause) ILE/COBOL executes an implicit
"MOVE ZERO TO result-field" and continues normal processing with the next
statement. I have confirmed this with IBM and have an open PMR on this
For us that is a serious problem. While I agree completely that the programs
should have been written such that the program would handle the exception,
they weren't and it was acceptable to us that the O/S would trap the
Now we have a very serious problem with our migration. The IBM solution is
suppressing the problem which, when encountered, will cause other problems
that may not be apparent until a later time.
By the way, it is my understanding from conversations with others that
ILE/RPG does NOT have the same default behavior that ILE/COBOL does but does
the same thing that we are used to seeing on the mainframe, i.e. a serious
exception which forces the O/S to get involved.
I intend to continue discussions with IBM.
Are any of you as concerned about this as I am?
Here is the response I got from IBM support:
The COBOL developer provided this information:
"Using CEEHDLR will not help in this case as it requires an exception to
be raised for CEEHDLR to be called. ILE COBOL design is such that Divide by
Zero will not cause an exception to be raised, so CEEHDLR will not be
Using ON SIZE ERROR and an imperative statement after every division
operation is the best way to trap this kind of error.
Please submit a Design Change Request stating that you would like to have
a PROCESS option in ILE COBOL so that it behaves in a way similar to System
z COBOL when these errors occur."
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2021 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.