Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Scratch files

maria
Beginner
521 Views
Hi,

I have a very simple question about openning scratch files. I am using IVF 9.0.
I have some scratch files opened during the run. I thought that these files would be deleted automatically
after the runis completed. But theyare not. I then have to use a CLOSE statement with STATUS = '
DELETE' todelete the scratch files.
Something wong with my coding? My open and close statements are attached. Thanks.

DO N=1,M

IFILE=IC+NC(N)

OPEN (UNIT=IFILE, FORM='UNFORMATTED', STATUS='SCRATCH', ERR=95)
ENDDO


DO N=1, M
IFILE=IC+NC(N)
CLOSE(IFILE,STATUS='DELETE')
ENDDO
0 Kudos
2 Replies
lklawrie
Beginner
521 Views
Have you tried just closing them? According to my reference, if you close them, then they will automatically be deleted, but if you don't issue a CLOSE on them, they may stay around.
0 Kudos
Anonymous66
Valued Contributor I
521 Views
The scratch files should be deleted when the program terminates.In both9.0 and the latest version of the compiler, the scratch file is being deleted for the simple program below:

[fortran]program test OPEN (UNIT=5, FORM='UNFORMATTED', STATUS='SCRATCH' ) write(5,IOSTAT=IO_STATUS) "Hello" !close(5) end program test [/fortran]
Can you share an example program where the scratch file is not being deleted?
0 Kudos
Reply