The reason for VSAM write error code 24 (return code) 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 for VSAM return code 24.
Solution: Check the input record length and copy book total record length.
You May Also Like: The complete list of VSAM error (return) codes and solutions.
Error processing in VSAM file.
All errors in processing of a VSAM file (whether logical errors in your program or input/output errors on the external storage media) return to your COBOL program.
What COBOL will do then?
COBOL will not perform any corrective action. Just control is returned to your program.
What does COBOL program provide to handle errors?
END-OF-FILE EXCEPTION/ERROR FILE STATUS INVALID KEY
If you do not code file status for invalid key and you do not code a declarative, serious VSAM processing errors go undetected 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.
Related Posts