Microsoft KB Archive/32158

Nothing Written with Less Than 1024 Bytes Free and “Disk Full”

PSS ID Number: Q32158 Article last modified on 04-21-1993

2.00 2.10 2.20 MS-DOS

Summary:

Question: When my program is run from a floppy disk with a few bytes less than 1024 available bytes free, it creates a Line Sequential file and writes a number of records to the file/buffer successfully (as indicated by the “00” file status). When attempting to WRITE more than 512 bytes, a “disk full” file status is generated as expected. However, after closing the file and exiting the program, the floppy contains a data file with a byte length of zero. What happened to the records that were written successfully?

Response: A disk sector is 1024 bytes. If there were less 1024 bytes available on the floppy disk when the program began, there was not a free sector to write the new file. As a result, all of the records “disappeared”; however, to the program they would seem to have been written successfully, because the COBOL run time was successful in passing the records to the Input/Output buffer.

Additional reference words: 2.00 2.10 2.20 Copyright Microsoft Corporation 1993.