Sunday, July 3, 2011

JCL Error Codes and Abends

Once the work to be done is defined in JCL, it will be submitted to the operating system using SUBMIT command. Before submitting the job the programmer should ensure that, there should not be any JCL error by compiling the job.

JCL ERROR
If there is any syntax error/allocation issue in dataset/dataset not found, then the whole job will be rejected with the error message. Error message will be present in JES MESSAGES. This needs to be restart and resubmission of job. Following are the list of JCL errors and corresponding details:

00 - Successful completion
02 - Duplicate key, Non unique key, Alt index
04 - Record length mismatch
05&35 - Open file not present
10 - End of file
14 – RRN(Relative record no) > Relative key data
20 - Invalid Key VSAM KSDS/RRDS
21 - Sequence error on write/ changing key on re-write
22 - Duplicate key found
23 - Record/file not found
24 & 34 &44 - Boundary violation
30 - Data error
37 - Open mode not compact with the device
38 - Opening file closed with lock
39 - Open, file attributes conflicting
41 - File is open
42 - File is closed
43 - Delete/Rewrite & invalid read
46 - Sequential read without positioning
47 - Reading file not open
48 - Write without open IO
91 - VSAM password failure
92 - Opening an already open file
93 - VSAM resource not available
94 - VSAM sequential read after end of file
95 - VSAM invalid file information
96 - VSAM missing DD statement in JCL
97 - VSAM open ok, file integrity verified


ABEND
Abend happens during the execution of a program in a step. Generally it can be categorized into system abend and user abend.
  • System Abend - It will occurs when the system is not able to execute a statement which is coded in a program. This abend code will be thrown by OS.
  • User Abend - This is due to unexpected condition occurs in data passed; this abend will be thrown by application based on the requirement.

Most of the time mainframe developer struck up with SOC4, SOC7 and some of the user abend when submitting the job. Here we will see some of the system and user abend details and resolving technique.

SOC1
This is the system abend, occurs due to the following condition.
  • Misspelled DD name
  • Missing DD card
  • Error in parameters passed to subroutines
  • Tried to read the file which was not open
  • Same name given for an array or subroutine
  • Tried to call within COBOL sort I/O procedure
  • Tried to call subroutine which did not exist
  • Incomplete DCB for SORTIN file

SOC4
This system abend occurs due to following reasons:
  • A SOC4 in sort step resulted in an invalid sort control card
  • Generally this will occur due to index overflow

So in this case try to find out which variable casing the abend and see what is the maximum array size allocated for that, modify the array size according to your requirement and re-run the job.

Some times SOC4 abend will be occurred for the reason of SOC7 also

SOC7
Mainly SOC7 abend occurs due to invalid digit / invalid sign present at last byte of comp-3 value. And some cases it will due to incorrect overlap in decimal field, table overflow, alphanumeric field is being moved to numeric fields and null values being moved and using for some calculation in the code.

To resolve the SOC7 abend, first check out the SYSOUT of the corresponding job to find out where data exception is listed out. For example,
<<< AMM09884 - PROGRAM COMPILED 07/21/10  11.48.23   >>>                       
CEE3207S The system detected a data exception (System Completion Code=0C7).    
From compile unit ATT00200 at entry point ATT00200 at compile unit offset +00003022 at address 21380AA2.
<> LEAID ENTERED (LEVEL 04/26/10 AT 13.28)                                   
<> LEAID ABENDAID DD ALLOCATED BY CWBMAKDD DYNALLOC RC =00000

From the Sysout of the job try to find out where the program getting abended and also which variable causing the job to get abend. Try to find out the program which is throwing the offset present in the SYSOUT. Once you found the details, see whether any move statement present and what was the value moved to, that field before job abended. Then do the data correction for that particular record and re-run the job.

S222
This abend causing our job to get cancel, because it was suspected of looping or resource unavailability for that job.

S322   
This is the Time Abend, due to our job/job step/any catalogued procedure took more time to execute than the time limit specified in the EXEC step or job step in the job. Sometimes, this time limit can also set by internal JES2 or JES3 system.

To resolve this issue give TIME = MAXIMUM in job card.
//TZEA249C JOB CLASS=C,PRTY=15,NOTIFY=&SYSUID,TIME=MAXIMUM

S522   
This is due to TSO time out - TIME=1440 on the exec statement to bypass all job step timing

S722   
This abend due to output lines exceeded the line parameter specified on main card

S822   
This ABEND occurs when the region requested to initiate the job or TSO user could not be obtained. 

SB37
This is out of space abend. To resolve the issue, specify the output dataset with larger primary and secondary quantity, and re-run the job.

SD37
This abend due to the dataset which is specified in the job used all the primary space, and there was no secondary space specified in the job. To resolve this issue, specify the JCL with the secondary quantity for that output dataset.
           
SE37  
A multi-volume physical sequential data set was being written on a direct access device.  All space was filled on the volume; an attempt was made to obtain space on the next specified volume.  Either the space was not available on that volume or the data set already existed on that volume.

U4094
This is the commonly occurred user abend. The reason for this abend is undefined/invalid format in input dataset of the job (input dataset in packed decimal format)

For example, if suppose i want to update some records in production table using UPDATE query which is present in the input dataset. While allocating the input dataset we should make sure that, input dataset should be in normal format, otherwise if it is in packed decimal format, the JCL will take the query as undefined format(Packed format), and it resulted in user abend of U4094. We could see following message in Sysout of the job.

IKJ5555442 NO VALID TSO USERID, DEFAULT USER ATTRIBUTES USED
READY
%E77441QRY
  I  -   > Execution Begins
E  -   > ..
E  -   > Trying to execute a non – update SQL
E  -   > Check your Input
READY
END

To resolve this issue, change the (DCB parameter) input dataset to default format rather than in PACKED DECIMAL format. Just type PACK OFF in our input dataset and re-run our job.
(Note:- Sometimes we can lock our dataset form other unfortunately specification changes, by profile lock)