Microsoft KB Archive/68222

FIX: BACKSPACE Fails on File OPENed with ACCESS=APPEND PSS ID Number: Q68222 Article last modified on 07-19-1994

5.00 | 5.00

MS-DOS | OS/2

= SYMPTOMS =

When a file is OPENed with ACCESS=‘APPEND’ and the size of the file is less than the BLOCKSIZE used in the OPEN statement, a BACKSPACE of that file will fail. This does not appear to occur with files OPENed with ACCESS=‘SEQUENTIAL’ or ‘DIRECT’.

= STATUS =

Microsoft has confirmed this to be a bug in the products listed above. This problem was corrected in Microsoft FORTRAN version 5.10.

= MORE INFORMATION =

The sample code below demonstrates an incompatibility with the BACKSPACE command and a file OPENed with ACCESS=‘APPEND’.

Sample Code
character*80 str, blanks, lastrec integer iocheck, numrec, block

blanks = ' ' lastrec = 'This is the last record' C ** CREATE INPUT FILE **

WRITE (*, '(1x, A\)') *  'Enter the number of blank records to write -> ' READ (*, *) numrec

WRITE (*, '(1x, A\)') *  'Enter the BLOCKSIZE (multiple of 512, >= 512) -> ' READ (*, *) block block = 512 + ((block-512)/512)*512 WRITE (*,*)

WRITE (*, '(1x, Total records written -> , i4)') numrec + 1 WRITE (*, '(1x, Total bytes written  -> , i4)') *  (numrec + 1) * 82 WRITE (*, '(1x, BLOCKSIZE            -> , i4)') block WRITE (*,*)

OPEN (10, file='test.dat') DO 20 i = 1, numrec WRITE (10, '(A)') blanks 20 CONTINUE

WRITE (10, '(A)') lastrec CLOSE (10) C ** READ INPUT FILE **

OPEN (10, file='test.dat', access='append', blocksize=block)

BACKSPACE (unit = 10, iostat = iocheck) WRITE (*, '(1x, Status of first BACKSPACE = , i4)') iocheck BACKSPACE (unit = 10, iostat = iocheck) WRITE (*, '(1x, Status of second BACKSPACE = , i4)') iocheck WRITE (*,*)

READ (10, '(A)') str

WRITE (*, '(1x, A)') str

END Additional reference words: 5.00 F6501

=
================================================================

Copyright Microsoft Corporation 1994.