Skip to content
systemcoding.dev
Mainframe

System Abends vs User Abends on z/OS Explained

A system abend is a three-digit hex code from z/OS, a user abend a four-digit decimal code from a program. Learn to tell them apart and where to look each up.

7 min read
Summarize in AI
Flat illustration of two options weighed side by side, with the C, Linux and Rust logos.

A job fails, and the job log says ABEND=S0C7 or ABEND=U4038 or, on another night, ABEND=S806. All three are abends, and they are not the same kind of thing. Telling the two kinds apart is the first skill of a mainframe support person, because it decides which manual to open and who to ask. This post explains the difference between system and user abends on z/OS 3.1, shows how to read the line that reports them, covers the reason codes that go with them, and lists where to look up each kind. It is the beginner's start of the abend path in the complete guide to z/OS abend codes and how to fix them.

What an abend is

When a program or the system cannot continue a task, it issues an ABEND, short for abnormal end. The task stops, the system frees what it can, and a completion code is recorded. The completion code is what the job log shows. A job that ends normally has a condition code, also called a return code, a number the program chose, such as 0 for success and 8 for a warning that the next step can check. An abend is the other way a step can end: not a number the program returned, but a crash with a code.

The two kinds

The completion code has two parts that can be set independently, a system part and a user part, and the way the log shows them tells you which kind you have.

A system abend shows as S followed by three hexadecimal digits, for example S0C7, S806 or SB37. The system, or a system service called by the program, issued it. The three digits are hexadecimal, so each can be 0 to 9 and A to F, and the codes run from S000 to SFFF. The meaning of each is defined by IBM in the z/OS MVS System Codes manual.

A user abend shows as U followed by four decimal digits, for example U0016 or U4038. A program issued it, and the number can be anything from 0 to 4095. The meaning of each number belongs to whoever wrote the code that issues it. Your own application can issue user abends, and so can products that run on z/OS, such as Db2, IMS, Language Environment and the scheduler.

In the job log the two appear in one line:

Text
IEF450I PAYRPT RUNPAY - ABEND=S0C7 U0000 REASON=00000007

The format is ABEND=Sxxx Uyyyy. Here the system part is S0C7 and the user part is U0000, which means "no user code". A user abend reads the other way around:

Text
IEF450I PAYRPT RUNPAY - ABEND=S000 U4038 REASON=00000001

Now the system part is S000, no system code, and the user part is U4038. Which part has a non-zero value tells you the kind. In everyday talk people say "the job abended with S0C7" or "with a U4038", using the non-zero part.

Where each kind comes from

System abends come from three places. The hardware raises a program interruption when an instruction cannot run, such as a data exception, and the system turns it into an S0Cx abend. A system service rejects a request, as when the program loader cannot find a module (S806), an open fails (S013) or a dataset runs out of space (SB37). And the system enforces a limit or an operator action, such as S322 for a CPU time limit or S222 for an operator cancel.

User abends come from programs that decide to stop. A COBOL program under Language Environment can issue one through the CEE3ABD service. Language Environment itself issues some, for severe conditions. A database product issues them for its own failures, and so does an installation's own standard error routine. The common thread is that someone wrote code that said "abend with this number", and the number has the meaning they gave it.

Reason codes

Many abends carry a second number, the reason code, that narrows the cause. The IEF450I line shows it as REASON=. For a program check it is the interruption code, which is why S0C7 shows REASON=00000007. For other system abends it is a code specific to the abend: S806 has reason code 04 for "module not found", and S013 abends are accompanied by a message IEC141I 013-18, where 18 is the reason. A reason code is only meaningful together with its abend code, so always record both. S806-04 and S806-08 are different problems.

For a user abend, the reason code is defined by the issuer, and many issuers set it to give detail. The Language Environment user abends, for example, carry a reason code in the message that precedes the abend.

Where to look each up

KindLook inNotes
System abend Sxxxz/OS MVS System CodesLists every code with an explanation, system action and programmer response, and the reason codes
LE runtime condition (CEExxxx, IGZxxxx)Language Environment Runtime MessagesThe message text before the abend is the authority
Dataset and access method messages (IEC...)z/OS MVS System MessagesThe message number gives the cause
User abend from Db2, IMS, CICSThat product's messages and codes manualA Uxxxx from IMS means something different from the same number from Db2
User abend from your own programThe program's documentation or its sourceAsk the author, or search for CEE3ABD or the abend call in the source

The manuals are on the IBM Documentation site, and the system codes are listed in numeric order, so a lookup is a matter of the three digits.

Which one is more serious

Neither kind is worse in itself. A system abend can be trivial, such as S222 for a cancel someone requested, or severe, such as a S0C4 that points at a damaged storage area. A user abend can be a deliberate stop, such as a control total that did not balance, which the author wanted to be impossible to ignore. What matters is what the code says about the cause and what state the job left behind.

A useful rule is that system abends in the S0Cx family point at the program or its data, resource abends such as S806, S80A and SB37 point at the job's environment, and user abends point at whoever issued them, a decision that depends on who that is. The first move in each case differs, so classify before fixing.

An example of each

A system abend from a program, caused by bad data in a numeric field:

SYSABEND.cblcobol
       IDENTIFICATION DIVISION.
       PROGRAM-ID. SYSABEND.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-AMOUNT           PIC S9(5)V99 COMP-3.
       01  WS-TOTAL            PIC S9(7)V99 COMP-3 VALUE ZERO.
       PROCEDURE DIVISION.
           ADD WS-AMOUNT TO WS-TOTAL
           GOBACK.

WS-AMOUNT has no VALUE clause and is never set, so it holds whatever the storage held. If those bytes are not a valid packed number, the ADD raises a data exception and the job ends with S0C7. If the storage happened to be zeros, the program would run without an abend, which is why uninitialized fields cause failures that appear and vanish.

A user abend, issued on purpose:

USERABND.cblcobol
       IDENTIFICATION DIVISION.
       PROGRAM-ID. USERABND.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-CODE             PIC S9(09) COMP VALUE 100.
       01  WS-CLEANUP          PIC S9(09) COMP VALUE 1.
       PROCEDURE DIVISION.
           DISPLAY 'INPUT FILE IS EMPTY'
           CALL 'CEE3ABD' USING WS-CODE WS-CLEANUP
           GOBACK.

The job log shows:

Text
INPUT FILE IS EMPTY
IEF450I USERABND RUN - ABEND=S000 U0100 REASON=00000000

The program stopped itself with user code 100, and anyone reading the log needs to know that U0100 means "input file is empty" in this shop. That knowledge belongs in the job's runbook, or the program's header. A user abend without documentation is a puzzle for the next person.

What to do first

For a system abend, note the code and the reason code, read the messages just before it in the log, and look up the code in the System Codes manual. For a program check, get the statement from the runtime message. For a user abend, find out who issued it: search the program source and its called modules for the abend call, look for a product message that mentions the number, and check the runbook. Both kinds then follow the same path: find the cause, fix it, decide whether the job can restart.

When the distinction is blurred

Language Environment sits between your program and the system and sometimes turns a condition into an abend of the other kind. A program check in a COBOL program under LE produces a CEE3207S message and ends with the system code S0C7, but a severe condition that LE decides to terminate on can produce a user abend U4038 with the original condition in the message. So an abend that looks like a user abend from LE can come from a plain data error. The message before it, with the prefix CEE or IGZ, says what really happened.

Also inDebugging
Share

Keep reading

Get new posts by email

We send one email when a new post is published. No spam.

Unsubscribe in one click. No spam, ever.