Skip to main content

WRITE to output VSAM file stops writing

  • February 15, 2013
  • 0 replies
  • 0 views

Problem:

We are using a mainframe program that issues a series of WRITE statements. The output data seems to be lost after the second WRITE. There is no error but the output data is incorrect. Is there a way past this?

Resolution:

Mainframe Express flushes the buffer area by default. On the host IBM seems to allow access to a Cobol FD even after a CLOSE. This is an error according to their own documentation.  

   MVS references:

since the days of VS Cobol II:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGYA1101/CONTENTS?SHELF=IGYSH007&DT=19930312141355#4.1.1

       VS Cobol II Application Programming Guide

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGYA1101/4.1.1?SHELF=IGYSH007&DT=19930312141355

        a file is available only after a successful OPEN

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGYA1101/3.1.3.1?SHELF=IGYSH007&DT=19930312141355

      a FD is not a part of the Cobol program. It is an image of the file's record area.  

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/IGYA1101/4.2.6?SHELF=IGYSH007&DT=19930312141355

        a CLOSE releases the connection between the program and the file

  IBM Cobol for z\\OS V3.4 (Programming Guide):

http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3PG32/CCONTENTS?SHELF=igy3sh33&DN=SC27-1412-05&DT=20061117131343

  See sections:  1.1.3.1, data used in input and output operations   'not available until successful open'  

                   1.9.2, coding I/O statements for QSAM             'open makes available, close releases connection'

  IBM Cobol for z\\OS V3.4 (Language Reference)

http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/IGY3LR31/CCONTENTS?SHELF=igy3sh33&DN=SC27-1408-04&DT=20060329140556

   See section:  5.1.1, a file area is available only during an OPEN

So although IBM allows this, it should not have ever been done. But for the sake of host emulation and to allow testing and debugging of host applications in Mainframe Express, one can pass the Additional Directive of NOFDCLEAR. This prevents Micro Focus from flushing the buffer area.

Old KB# 2517

#EnterpriseDeveloper
#MFDS