VSAM: How to resolve File OPEN errors

This is very common error in VSAM files. The below are the reasons and resolution for OPEN error (File status code is 35).

Opening a file (ESDS, KSDS, or RRDS)

Before you can use WRITE, START, READ, REWRITE, or DELETE statements to process records in a file, you must first open the file with an OPEN statement.

File availability and creation affect OPEN processing, optional files, and file status codes 05 and 35.

For example, if you open a file that is neither optional nor available in EXTEND, I-O, or INPUT mode, you get file status 35 and the OPEN statement fails. If the file is OPTIONAL, the same OPEN statement creates the file and returns file status 05.

An OPEN operation works successfully only when you

set fixed file attributes in the

DD

statement or data-set label for a file and specify consistent attributes for the file in the

SELECT

clause and

FD

entries of your COBOL program. 

VSAM OPEN Error Resolution and Check in the Program

Mismatches in the following items result in a file status code 39 and the failure of the OPEN statement:

  • Attributes for file organization (sequential, relative, or indexed)
  • Prime record key
  • Alternate record keys
  • Maximum record size
  • Record type (fixed or variable)

Additional Points

  • Add file status check before you write the logic for VSAM OPEN statement.
  • A file can be empty or loaded, for both the types, check file status after the OPEN¬†statement.

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.