How To Read A Variable Length Vsam File
I am running one COBOL pgm which is reading one VSAM file. Efd Cfd Software here. Below is ithe input output section in my pgm. SELECT INPUT-FILE ASSIGN TO DDINPUT ORGANIZATION IS INDEXED ACCESS MODE IS RANDOM RECORD KEY IS INPUT-KEY FILE STATUS IS WS-INPUT-STATUS. And FD entry is as follow. FILE SECTION.
FD INPUT-FILE IS EXTERNAL (as this is in sub pgm) COPY INPUTREC. When I ran this pgm, it failed with file status code =04. Somewhere I found that when in FD we have only one record even if the file is VB it treats it is FB. So FB should have record contains or Varying clause.
Neither the LENGTH option nor the SET option is specified on a READ command for a file with variable-length records or for a BDAM file with variable-length or undefined-format records. 11 The length of a record read with the INTO option specified exceeds the value specified in the LENGTH option; the record is truncated, and the data area supplied in the LENGTH option is set to the actual length of the record. We had the same problem last year and used Python to parse the different record types out to separate files so that each file was fixed length records. Example: read data from a variable lenth file and display the data along with the length of each of the record.