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 are the best practices to avoid ABEND?

Follow the coding standards.

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 are the different types of error-handling verbs available?

COBOL has specific categories to handle the error conditions -

  • Handling errors in STRING and UNSTRING operations.
  • Handling errors in Arithmetic operations.
  • Handling errors in File operations.
  • Handling errors in CALL statements.

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.

What is the S0C1 error?

Program tries to execute an instruction which does not exist.

What is the S0C4 error?

It is a protection exception when tries to reference the memory address which is not part of program runtime memory allocation.

What is the S0C5 error?

An address developed and used by the program lies outside of the available virtual storage.

What is the S0C7 error?

S0C7 is a data exception. It occurs when tries to move non-numeric data was attempted to move in numeric variable.

What is the SOCB error?

This operation error may occur when a 'division by zero' occurs.

Frequently Asked Questions -

What causes ABEND to occur?

What are the greatest ways to steer clear of ABEND?

How to deal with mistakes and exceptions in COBOL?
How can you handle exceptions and errors in COBOL?
How do you handle exception conditions in COBOL?

Different abends which you encountered which running a COBOL program and resolution for it?

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?

What are the causes for S0C1, S0C4, S0C5, S0C7, S0CB abends?