VSAM File Status

VSAM file Status

It plays an important role in VSAM processing. There are some important VSAM File Status Codes which we get while processing the VSAM. Apart from this  Codes, there is some important return code in as well.

Important VSAM file Status or VSAM Return codes-

file status04

VSAM file status code04 or VSAM return code 04 occurs due to either of these-

  • The Length of the record does not match the properties or attributes defined for the length of the  file.
  • Your File is a Variable Length block file but you defined a fixed length block in your FD clause.
  • Most of the time, this error occurs while reading from a  file or writing to a file.

How to fix File Status04

Assign the proper record length of your  file in the DCB Parameter and match it with the length provided in the FD clause of your COBOL Program.

return code 08

VSAM return code 08 occurs due to –

  • The logical error in the program

How to fix return code 08

The Logic of COBOL Program itself is wrong so you need to correct the logic of the program.

file status13

It occurs due to –

  • File Not Found

How to fix file status13

Provide the correct details of the file name. Check if the path of your VSAM file is correct.

file status16

It 16 occurs due to –

  • It depends on the type of file, the program used to access the VSAM file and is mostly related to accessing 

How to fix file status16

Fix will be based on the way you are accessing the file from a program. Are you trying to update a  file for which you do not have permissions?

file status 19

VSAM file status 19 occurs due to –

  • In case you are accessing VSAM file in CICS and you did not provide a proper entry of the  file

How to fix file status 19

Check if the PCT entry of the  file is proper.

file status 20

VSAM file status 20 occurs due to –

  • In case of  KSDS or RRDS, the key is an INVALID KEY

How to fix file status 20

Correct the KEY. Check the position, definition etc and correct it.

file status 22

VSAM file status 22 occurs due to either-

  • Duplicate key defined for  Indexed or relative Files
  • Duplicate alternate key but the alternate key is defined as unique.

How to fix file status 22

Remove the duplicate entry of key

file status 23

VSAM file status 23 in COBOL occurs due to either-

  • The record is not found when you are trying to access using a key.
  • File not found.

How to fix file status 23

Check if the record is correct or the path to access the file is given correctly.

file status 24

VSAM file status 24 occurs due to either-

  • Trying to write beyond the boundary in case of Relative and indexed files using the key.
  • Size of the Relative Record number is larger.

How to fix file status 24

Do not write beyond the boundary or change the boundary.

return code 28

VSAM return code 28 occurs due to either-

  • The primary space is already exhausted and the space in Secondary space cannot be extended further due to the limitation in space.
  • The Index CI is not large enough

How to fix file status 28

Check with your storage group or try to give less value to your secondary allocation.

status code 35

VSAM file status code 35 occurs due to either-

  • You are trying to open a file which is not present.
How to fix file status 35

Check why the file is not present? Are you providing the correct filename with the correct path?

status 37

VSAM file status 37 occurs due to either-

  • You are trying to open a  file in a particular mode which is not allowed for that file.

How to fix file status code 37

Check the file opening modes available for the file and fix it.

file status 39

VSAM file status code 39 occurs due to either-

  • The Unsuccessful opening of a  file due to the conflicting attributes of the file.
  • Wrong value in DCB which is not matching the file attributes in the Program.

how to resolve file status 39 in cobol

Check the file attribute in the actual file, the file attributes defined in the FD section of the program,  the record length in your DCB Parameter and the record mode etc.

file status 41

VSAM file status code 41 occurs due to-

  • When the file is already opened and we try to do an OPEN operation once again on the file which is already opened.

how to fix file status 41

Change the program to make sure that you do not give OPEN file on the file which is already opened.

file status 42

VSAM file status code 42 occurs due to-

  • When the file is already Closed and you try to do a CLOSE operation once again on the file which is already closed.

how to fix file status 42

Change the program to make sure that you do not give CLOSE file on the file which is already closed.

file status 46

VSAM file status code 46 occurs due to-

  • If you try to sequentially read a  file even when the end of the record is reached.

how to fix file status 46

Once the End of the File is reached, do not read the file.

file status 47

VSAM file status code 47 occurs due to-

  • If you try to read a file which is not opened in  INPUT or I-O mode.

how to fix file status 47

Open the file in INPUT or I-O mode.

file status 90

VSAM file status code 90 occurs due to either of these-

  • Unsuccessful OPEN, READ, WRITE or CLOSE operation.
  • You defined ‘LINE SEQUENTIAL’ for  file
  • You missed to initialize the  file before OPEN, READ or WRITE statement.
  • If you are trying to open an empty file or a file which does not exist and you have not tried to capture the return code of the OPEN or READ or WRITE, then you can get this generic error.
  • There can be other reason for status code 90 as well as this error is not a specific rather a generic error.

how to fix file status 90

If you have coded ‘LINE SEQUENTIAL’ then remove it.

Code the file status for OPEN, READ, WRITE or CLOSE operation and see where you are getting the error so that you can easily fix that.

file status 91

VSAM file status code 91 occurs due to either of these-

  •  Password Failure.
  • authorization failure

how to fix file status 91

Check the password which is given for VSAM file or whether you are authorized to access the  file or not?

file status 92

VSAM file status 92 in COBOL occurs due to either of these-

  • Logic error.
  • Common logic errors are like a wrong way of Opening the file, improper way of reading the  file or Writing the  file.

How to resolve file status 92 in COBOL

Check the logic of the program mentioned above and fix it.

The most common status code 92 is ‘VSAM file status 92 while writing’ and you need to fix the logical error related to write or rewrite. Check if the file is opened correctly for writing

file status 93

VSAM file status code 93 in COBOL occurs due to either of these-

  • resource not available.
  • Storage is insufficient for 
  • Extents used up and extra extents not available

how to fix file status 93

Check with your storage group.

file status 96

VSAM file status code 96 in COBOL occurs due to –

  • Missing DD statement for the VSAM or QSAM file.

how to fix file status 96

Code the missing DD statement in the JCL

file status 97

VSAM file status code 97 in COBOL occurs due to –

  • ItOPEN file successful and the file integrity verified. This might happen when a previous Job did not close the  file so VSAM has to verify the integrity of the file.
Is there any fix required for this

VSAM status code 97 is not a problem or issue.

open return code 100

‘VSAM open Return code is 100 error’ occurs due to –

  • Improper loading of  file.
  • Loading of a cluster using REPRO failed.

how to resolve 'VSAM open return code 100'

Before building the alternate index(AIX) and path, you need to load the cluster.

file status 160

VSAM file status code 160 in COBOL occurs due to either of these-

  • The input  file might be empty when you try to open it.

how to fix file status 160

Check with your storage group.

file status 168

VSAM file status code 168 in COBOL occurs due to either of these-

  • The device type is not supported.

Tutorials for all brains!