Cannot detect file existing or not
In a program I am improving, I noticed that Fortran does not detect file existing or not. This led to a logic error which has not been fixed. I highly appreciate if you could point out the problems or errors and give me your corrections. open(unit=nhist,file=history,iostat=ierr)!This setting cannot exit program if file does not exist because ierr is always 0 if (ierr /=0) then write(*,*)'!!! error#',ierr,'- Dump file not found' stop endif !I used below statement, the program exits even though a file is existing open(unit=nhist,file=history,err=700) 700 ierr=-1 if (ierr /=0) then write(*,*)'!!!