Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

flushing of files in case of an abend in a COBOL Program

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

When I used a flat file with record format FBA in a COBOL Program, some times the last record that was written before cancelling the program using a cancel command on the job is not getting flushed out to the actual physical file.

Is it expected that an abend would not flush all records that were written using COBOL write statment?

Please help me out.
 
The answer to your question could be multi-leveled, so bear with me for a minute.

The effects of COBOL IO (or any language IO) depend largely on the implementation of the IO on the platform being used.

Sometimes, the WRITE statement does not actually access any storage device, the IO goes to memory. This is used by many platforms as a way of improving an application throughput, since accessing a disk, for example, is relatively very time consuming. When memory cashing is used (as in this example), the system waits for a predetermined block of memory to be full before writing it to disk.

It is possible then that the last block of data could be lost when a program abends. Some platforms do not have mechanisms to prevent the loss of data on abend.

A rule of thumb is to close your file before exiting your program. CLOSE is usually implemented to flush any remaining data.

As an aside, I have worked on platforms such as Tandem, where closing files before stopping a program is optional. This feature is usually an indication that your platform will flush your buffers automatically when your program stops or abends.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top