Error handling Interview Questions


Why does ABEND happen?

The program's code may cause runtime errors or the program to abend based on the different possible inputs.

What is the error handling?

Error handling is a mechanism used to handle the possible runtime errors by notifying the user with a message or routing the program flow to skip the program abend.

How do you handle errors in COBOL?

COBOL program errors can be handled through the code. The error handling code can take actions such as handling the situation, issuing a message, or stopping the program execution.

What kind of error is trapped by ON SIZE ERROR option?

The ON SIZE ERROR handles the following cases -

  • Fixed-point overflow.
  • Division by zero.
  • Zero raised to zero power.
  • Zero raised to a negative number.
  • The negative number raised to a fractional power.

Frequently Asked Questions -

What causes ABEND to occur?

What are the greatest ways to steer clear of ABEND?

What is the error that is trapped by the ON SIZE ERROR option?
What is the role of the ON SIZE ERROR option in trapping error?
What kinds of errors are caught by the ON SIZE ERROR option?
What is the purpose of ON SIZE ERROR options in trapping errors?

Consider a scenario where we have a program having an array of 20 items. When the program tries to access the 21st item, the program fails to abend. What is the reason for this?