Can we read empty VSAM file using COBOL

2 posts / 0 new
Last post
Can we read empty VSAM file using COBOL


We know that we face abend when we try to read an empty vsam file in a cobol program, some file status 35 comes.

We generally would place a low value record (null record as we refer) to overcome this problem.

But I fail to understand what could be the logic behind this restriction.

"; ; ; ;

The only thing that I could think of, is that if vsam is empty then we do not have any value for the key and thus is not readable, but when we put a null record then the first record can be read. Please let me know if you agree with this.

As a rule I create a VSAM

As a rule I create a VSAM initial load program. It opens the file as output, writes a record, deletes the record just written [y'all don't want to process an unrelated record - especially when doing sequential access to the VSAM dataset]. After executing the initial load program other applications can open the VSAM dataset in I-O mode.   

Log in or register to post comments
Sponsored Listing