Reading an ABEND
Part of the Batch Jobs with JCL section of Coddy's COBOL Programming journey. Lesson 12 of 19.
An ABEND, an abnormal end, is the system stopping a step. Two lines of the log report it:
IEF450I SALES LOAD - ABEND=S0C7 U0000 REASON=00000000
IEF472I SALES LOAD - COMPLETION CODE - SYSTEM=0C7 USER=0000A code with S is a system code, in hexadecimal: S0C7 is a data exception, arithmetic on a number field that holds something else. A U code is a user code, in decimal: U4038 comes from Language Environment, the runtime of IBM's COBOL, when a program fails on an error it did not handle.
The step's SYSOUT says why. On a mainframe Language Environment writes its messages there; in this course GnuCOBOL's runtime does, naming the program, the line, the field and its bytes:
libcob: SUMSALES.cob:24: error: 'S-AMOUNT' (Type: NUMERIC DISPLAY) not numeric: '450 'Here 450 starts on the left and two spaces follow it: a space is not a digit.
After an ABEND the later steps are not executed (IEF272I), and the job ends with ABEND=S0C7. A step with COND=EVEN runs anyway, one with COND=ONLY runs only after an ABEND, and IF (LOAD.ABEND) THEN tests for one.
Here each step has 2 seconds. A step still running then ends S322, IBM's code for a step over its time limit, and its SYSOUT says it was stopped.
Challenge
EasyStep LOAD ends S0C7. Read its SYSOUT: it names the field and the bad value. Fix that record in the instream data, so the step prints SALES TOTAL 2,625.
Try it yourself
//SALES JOB (ACCT),'CODDY',CLASS=A,MSGCLASS=X
//LOAD EXEC PGM=SUMSALES
//SALESIN DD *
NORTH 01200
SOUTH 450
EAST 00975
/*
//SYSOUT DD SYSOUT=*
All lessons in Batch Jobs with JCL
Practice on your own: Online COBOL compiler