VSAM: How to Resolve File OPEN Errors

This is common error in VSAM files. Below are 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.

Whether a file is available or optional affects OPEN processing, file creation, and the resulting file status key.

For example, if you open in EXTENDI-O, or INPUT mode a nonexistent non-OPTIONAL file, the result is an OPEN error, and file status 35 is returned. If the file is OPTIONAL, however, the same OPEN statement returns file status 05, and, for open modes EXTEND and I-O, creates the file.

Advertisements

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.

Related Posts

Get new content delivered directly to your inbox.

Author: Srini

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