System abend

S0CF: Floating-point divide exception

An S0CF abend means a hexadecimal floating-point (HFP) divide instruction was given a divisor of zero. It is the floating-point counterpart of S0C9 for binary integers and S0CB for packed decimal.

Other names for this code

Also written as 0CF, SOCF, abend 0CF, system abend 0CF, S0CF-F, floating-point divide exception, floating point divide by zero.

What it means

The mainframe has three floating-point formats. Hexadecimal floating point (HFP) is the original IBM format. Binary floating point (BFP) follows the IEEE 754 standard, and there is also a decimal floating-point format. S0CF belongs to HFP. When an HFP divide instruction finds that the divisor's fraction is zero, the processor raises a floating-point divide exception, program interruption code 15 (hex F), and z/OS ends the task with system completion code 0CF and reason code F.

This exception can't be switched off with the program mask. A zero HFP divisor always interrupts the program.

Programs that use IEEE binary floating point don't get S0CF for a zero divisor. IEEE arithmetic either returns infinity and carries on, or, if the program enabled that trap, reports the error as a data exception (S0C7) with a data exception code that names the IEEE condition.

COBOL COMP-1 and COMP-2 fields use HFP by default. So do many older PL/I, C and assembler programs.

Common causes

  • A floating-point divisor is zero, for example an average computed over no records, or a ratio whose denominator was never set.
  • A COMP-1 or COMP-2 field was never initialized and holds low-values. Low-values are a valid HFP zero, so the divide fails. Spaces aren't zero in HFP, so they don't cause this.
  • A very small intermediate result underflowed to zero with the exponent underflow mask off, and that zero was later used as a divisor.
  • A COBOL DIVIDE or COMPUTE on floating-point fields has no ON SIZE ERROR clause.

How to find the problem

  1. Find CEE3215S (Language Environment) or the IEA995I symptom dump in the job log. Note the program name and the offset.
  2. Match the offset to the compiler listing to find the division.
  3. Check the divisor in the dump. An HFP value has a zero fraction when every byte after the first is zero.
  4. Trace where the divisor got its value, including any earlier calculation that could have underflowed to zero.

How to fix it

  • Test the divisor before dividing, and decide what the result should be when it is zero.
  • Add ON SIZE ERROR to COBOL DIVIDE and COMPUTE statements that use floating-point fields.
  • Initialize floating-point fields to a known value before use.
  • If underflow is producing the zero, rescale the calculation, or let the program detect underflow so it can react before dividing.

What it looks like

IEA995I SYMPTOM DUMP OUTPUT
  SYSTEM COMPLETION CODE=0CF  REASON CODE=0000000F
IEF450I ACCTLIB1 STEP020 - ABEND=S0CF U0000 REASON=0000000F

IBM documentation

IBM z/OS: 0Cx program interruptions. Use the documentation for your installed release.

Report a correction to WND Software.

Questions

What are S0CC, S0CD and S0CE?

They are the other hexadecimal floating-point program checks. S0CC is exponent overflow, S0CD is exponent underflow and S0CE is a significance exception.

Why didn't my IEEE floating-point program get S0CF?

S0CF applies only to hexadecimal floating point. IEEE division by zero gives infinity, or a data exception (S0C7) if the program enabled that trap.

What is the difference between S0CF, S0C9 and S0CB?

All three are divide failures. S0C9 is for binary integers, S0CB for packed decimal and S0CF for hexadecimal floating point.