COBOL file status

File status 35: Required file not available at OPEN

File status 35 means an OPEN INPUT, I-O or EXTEND failed because a file not declared OPTIONAL isn't available. Usually the DD statement is missing or misnamed, or the VSAM cluster has never held any records.

Other names for this code

Also written as FS 35, file status code 35, COBOL status 35, VSAM status 35, file status 35 VSAM empty, status key 35, SK35.

What it means

Status 35 is a permanent error from OPEN. The SELECT clause doesn't say OPTIONAL, so the file is required, and the runtime couldn't find it. OPEN OUTPUT doesn't return 35, because output mode creates the file.

What counts as available depends on the access method. A QSAM file needs a DD allocation and the data set has to exist. A VSAM file needs a DD allocation, has to have been defined with IDCAMS, and has to hold records or have held them at some point. So a VSAM cluster that was defined and never loaded gives 35 on OPEN INPUT or OPEN I-O. That catches many people out. A line-sequential file lives in the z/OS UNIX file system, and the file the program points at has to exist there.

VSAM's own OPEN error code for a missing or unusable DD statement is 128 (X'80'). If data-name-8 shows return code 8 with that code, the DD is the problem. If the program has no FILE STATUS clause and no error declarative, the runtime writes IGZ0035S, naming the file and the status, and the program ends with abend U4038.

Common causes

  • The DD statement is missing from the step, or its name doesn't match the ASSIGN clause. ASSIGN TO PAYIN looks for a DD named PAYIN.
  • A new VSAM cluster has never been loaded, and the program opens it INPUT or I-O.
  • The program runs under TSO, a test tool or a new procedure where the file was never allocated.
  • A procedure override meant to add the DD went to the wrong step.

How to find the problem

  1. Read the message. With no FILE STATUS clause you'll see IGZ0035S naming the file and program. With FILE STATUS, DISPLAY it after the OPEN.
  2. Check the step's allocation messages in JESYSMSG for the ddname. If it isn't listed, the DD is missing.
  3. Compare the ASSIGN clause with the JCL. The ddname is the last part of the assignment name, so ASSIGN TO S-PAYIN looks for DD PAYIN.
  4. For VSAM, run IDCAMS LISTCAT ALL. A HI-U-RBA of 0 and a REC-TOTAL of 0 mean the cluster has never been loaded.

How to fix it

  • Add or correct the DD statement.
  • Prime a new VSAM cluster before programs read or update it. Load it with IDCAMS REPRO, or write a dummy record and delete it. After that the cluster counts as available even when empty.
  • If the file may really be absent, add OPTIONAL to the SELECT clause. OPEN then returns 05 instead of failing.
  • Add a FILE STATUS clause and check it after every OPEN, so the program reports which file failed instead of abending.

IBM documentation

IBM Enterprise COBOL documentation. Use the documentation for your installed release.

This link opens the relevant IBM reference library or lookup instructions. Match the complete code and your installed product release; it is not a code-specific review.

Report a correction to WND Software.

Questions

Why do I get 35 when the VSAM file exists?

Because it has never held a record. COBOL treats a VSAM cluster that was never loaded as unavailable for INPUT or I-O. Load it first, with IDCAMS REPRO or a program that writes the first records with OPEN OUTPUT.

What is the difference between 35 and 96?

35 is for OPEN INPUT, I-O or EXTEND of a required file. 96 is for the modes that would create the file, such as OPEN OUTPUT of a VSAM file with no DD.

Can OPEN OUTPUT give file status 35?

No. OPEN OUTPUT creates the file, so a missing file isn't an error for it in the same way.