For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2005 > MS FORTRAN 5.x and direct access...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author MS FORTRAN 5.x and direct access...
mcalhoun@ksu.edu

2005-05-13, 4:10 pm

Several ws ago there was a thread about how various Fortran's
handled non-contiguous writes to and reads from direct-access files.
FWIW, I ran the following on MS FORTRAN 5.1:

PROGRAM Test

CHARACTER Record5*20/' '/
INTEGER IOerr

OPEN (1,FILE='TestFile',ACCESS='DIRECT',STATU
S='NEW',RECL=20)
WRITE (1, REC= 1) 'This is record # 1'
WRITE (1, REC=10) 'This is record #10'
READ (1, REC= 5, IOSTAT=IOerr) Record5
PRINT *, 'I/O error =', IOerr

END

From several ws ago:
>What should happen here?


>I have worked on systems which exhibited the following:
>a) The WRITE to record10 was illegal because records 2-9 have not
> been written yet. Thus one never gets to the READ.
>b) The WRITE to record10 completes, but 'under the table' the I/O
> system fills the intermediate records with zeros (or worse yet,
> garbage.) So the READ completes, but who knows what to expect...
>Most modern systems fall into the latter category.


Microsoft FORTRAN 5.1 does "b", creating a file of 200 characters
(for a record-length of 20), with garbage in place of records 2-9,
and returns some of that garbage for Record5 with IOerr=0.
--
--Myron A. Calhoun.
Five boxes preserve our freedoms: soap, ballot, witness, jury, and cartridge
PhD EE (retired). "Barbershop" tenor. CDL(PTXS). W0PBV. (785) 539-4448
NRA Life Member and Certified Instructor (Home Firearm Safety, Rifle, Pistol)
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com