Simple Mainframe Universe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

COBOL Troubleshooting


S0CB decimal divide exception

S0CB is a decimal divide exception: packed-decimal division by zero (or quotient overflow).

What it means

  • The packed-decimal equivalent of S0C9.
  • Almost always a zero divisor from unvalidated input data.

Common causes

  • Zero divisor from file input or calculation.
  • Uninitialized packed divisor field.

How to diagnose

  • Display the divisor in hex at the failing statement.
  • Trace the divisor back to its source field.

How to fix it

  • Test divisor for zero before the DIVIDE.
  • Clean the input data or supply a default.

Example: Guard packed division

IF WS-RATE NOT = ZERO COMPUTE WS-RESULT = WS-AMOUNT / WS-RATE ON SIZE ERROR PERFORM 9000-DIV-ERROR END-COMPUTE ELSE PERFORM 9000-ZERO-RATE END-IF.

Zero test plus ON SIZE ERROR covers both S0CB causes.

Interview tip

  • Q: How would you troubleshoot a S0CB decimal divide exception in production?
  • A: I would verify the divisor value at failure and add zero-checking plus data validation upstream.

Prevention checklist

  • Validate all divisors.
  • Reject or default zero rates in input edits.




© copyright mainframebug.com
Privacy Policy
MainframeBug Assistant