The VSAM write error 24 awesome solution

The reason for VSAM write error code 24 is as follows – Invalid key for a VSAM indexed or relative file; attempt to write beyond file boundaries VS COBOL II only: for a WRITE to a relative file, size of relative record number too large for relative key.

Solution: Check the input record length and copy book total record length

More: The complete set of VSAM error codes and solutions

VSAM errors

Error processing in VSAM file

All errors in processing a VSAM file, whether logical errors in your program or input/output errors on the external storage media, return control to your COBOL program.

What COBOL will do then…

COBOL will not perform any corrective action. Just control is returned to your program.

What COBOL provides to handle errors…

END-OF-FILE
EXCEPTION/ERROR
FILE STATUS
INVALID KEY

If you do not code file status key and you do not code a declarative, serious VSAM processing errors go un-detected by your program.

VSAM file processing errors do not cause an abend, just your program continue processing with incorrect data.

You must check file status for all INPUT/OUTPUT requests…

Each VSAM file should have its own status key defined in your program.

Why many people use IDCAMS delete command

IDCAMS delete command in JCL is the first step before calling COBOL program in the next JCL step.

What is the reason…

The reason is IDCAMS REPRO command deletes all records and reset its high use RBA to zero. So that this file appears to COBOL program as, if it never contained a record.

Advertisements

Author: Srini

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