Hi guys,
I've got following situation:
- there is a code where I open and close a file with form='UNFORMATTED', access='SEQUENTIAL'
- the file is open several times with position='APPEND'
The settings of the project include:
- [COMPATIBILITY] use power station I/O format = YES
- [DATA] use bytes as RECL = YES
PROBLEM
When trying to READ the data the results based on data are not correct. I've noticed that there is comma mark placed on file CLOSE.
When data is written only once to the file the results are correct.
When SEQUENTIAL is replaced with STREAM the results are also correct.
However I cannot use in the project I am dealing with both right now. Is there any reason why I would like to replace SEQUENTIAL with STREAM?
And the msot important question, why I get wrong results in my case? Any ideas? :)
This is a sort listing of what I am doing in the code:
do i=1,n aout(i)=real(i) bout(i)=real(i*i) enddo iout = 20 iin = 21 open(UNIT=iout,FILE='uformtest.fem',FORM='UNFORMATTED', 1 STATUS='NEW',ACCESS='SEQUENTIAL',IOSTAT=ISTAT) write(iout,IOSTAT=ISTAT) (aout(i),i=1,n) close(iout,IOSTAT=ISTAT) open(UNIT=iout,FILE='uformtest.fem',FORM='UNFORMATTED', 1 STATUS='OLD',ACCESS='SEQUENTIAL',POSITION='APPEND', 1 IOSTAT=ISTAT) write(iout,IOSTAT=ISTAT) (bout(i),i=1,n) close(iout,IOSTAT=ISTAT) open(UNIT=iin,FILE='uformtest.fem',FORM='UNFORMATTED', 1 STATUS='OLD',ACCESS='SEQUENTIAL',IOSTAT=ISTAT) read(iin,IOSTAT=ISTAT) (ain(i),i=1,n) read(iin,IOSTAT=ISTAT) (bin(i),i=1,n) close(iin,IOSTAT=ISTAT)
When trying to check values of ain and bin I'v found that values of ain are printed correctly values bin are all zeros.
Thans in advance for any suggestions.
Lukasz