System abend

S013: Data set could not be opened

An S013 abend means OPEN couldn't open a data set because the request conflicts with the data set or its attributes. The reason code after the dash, shown in message IEC141I, says which check failed. 013-18 is a missing member, and 013-20 is a block size that doesn't fit the record length.

Also written as 013, S013-18, S013-20, S013-34, abend 013, system abend 013, 013-18, 013-20.

What it means

Before a program can read or write a data set, OPEN builds one set of attributes from three places. They are the program's DCB, the DD statement and the data set label. Values in the program win over the JCL, and the JCL wins over the label. OPEN then checks the result. If a check fails, OPEN issues message IEC141I and ends the step with system completion code 013.

The number after the dash is what matters. The ones you'll see most are these.

  • 013-18 means the DD statement named a member of a partitioned data set (PDS or PDSE), and the member isn't there. Usually it's a typo, the wrong library, or a member that hasn't been created yet.
  • 013-20 means the block size doesn't fit the record length. For fixed-length records, BLKSIZE must be a whole multiple of LRECL. Coding BLKSIZE=800 with LRECL=133 fails this way.
  • 013-34 means the record format, record length and block size don't make sense together. Typical cases are an LRECL larger than the BLKSIZE for fixed-length records, an LRECL of zero with no variable format, or no block size available from the program, the JCL or the label. It turns up most often on a new data set that was given only part of its DCB information.

For any other code, look it up under abend 013 in IBM's system codes manual.

Common causes

  • The member named on the DD statement doesn't exist in that library (013-18). A symbol or PROC override that points at a different library has the same effect.
  • The JCL codes DCB attributes for a new data set that don't fit together, such as a BLKSIZE that isn't a multiple of LRECL for RECFM=FB (013-20).
  • A new output data set was given an incomplete or contradictory set of RECFM, LRECL and BLKSIZE values, for example an LRECL bigger than the BLKSIZE, or no LRECL at all from the JCL, the program or an SMS data class (013-34).
  • An assembler program or utility sets RECFM, LRECL or BLKSIZE itself, and those values clash with the data set.

How to find the problem

  1. Find IEC141I in the job log. It looks like IEC141I 013-18,IGG0191B,jobname,stepname,ddname,...,dsname(member). Note the reason code, the DD name and the data set name.
  2. For 013-18, open the library in ISPF 3.4 and look for the member in the member list. Then check the substituted JCL in the job log (IEFC653I lines) to confirm the job really used that library and member name.
  3. For 013-20 or 013-34, collect the attributes from the DD statement (DCB, RECFM, LRECL, BLKSIZE, DATACLAS) and from the program's FD or DCB, then work out the merged values by hand.

How to fix it

  • For 013-18, correct the member name or the library name, or create the member, then rerun the step.
  • For 013-20, code BLKSIZE=0 or leave it out on new disk data sets, and let the system choose a block size that fits.
  • For 013-34, give the new data set a complete, consistent set of RECFM and LRECL values on the DD statement, with BLKSIZE=0 or none at all, copy them from an existing data set with LIKE=, or use an SMS data class that sets them.
  • Remove DCB overrides in the JCL that disagree with the data set or the program.
  • In COBOL, keep RECORDING MODE and RECORD CONTAINS in line with the file. COBOL usually reports that kind of conflict as file status 39 rather than S013, so check the file status after every OPEN.

What it looks like

IEC141I 013-18,IGG0191B,PAYRUN01,STEP010,SYSIN,0A12,PRD101,PROD.PAYROLL.CNTL(PAYPRM07)
IEA995I SYMPTOM DUMP OUTPUT
  SYSTEM COMPLETION CODE=013  REASON CODE=00000018
IEF450I PAYRUN01 STEP010 - ABEND=S013 U0000 REASON=00000018

Questions

Why do I get S013-18 when I can see the member in ISPF?

Because the job looked in a different library than you did, or for a slightly different name. Check the substituted JCL in the job log for the real data set and member name. A zero typed in place of the letter O is a common culprit.

What block size should I code to avoid 013-20?

For new disk data sets, code BLKSIZE=0 or leave it out. The system then picks a block size that fits the record length and the device. Hard-coded block sizes cause most 013-20 abends.

Is IEC141I the same thing as S013?

IEC141I is the message and S013 is the abend. OPEN issues IEC141I first, with the reason code and the data set name, and then ends the step with S013.