I`m using gfortran-4.2.1 under x86_64. when i use some code like below, it always reports "Fortran runtime error: End of file", but if i run it in single thread mode, it works. program test use omp_lib character(256):: filename real:: f_r,f_i,realn,imgn integer:: iii,stat integer:: tID,fIDA,fIDB open(10,file='./data/def.dat') !$omp parallel do !$omp& default(shared) !$omp& private(iii,tID,fIDA,fIDB,filename,stat) !$omp& schedule(static,1) !$omp& reduction(+:real,img) do iii=1,1000 tID = omp_get_thread_num() fIDA = 1000 + tID fIDB = 2000 + tID !$omp critical read(10,'(A)') filename !get file name for a record file !$omp end critical print*,'Processing: ',filename open(fIDB,file=filename,form='unformatted',ACCESS='stream',status='old',iostat=stat) if(stat .ne. 0) then print*,'------------------------------Error------------------------------' end if do v=0,2000 do u=0,2000 read(unit=fIDB) f_r,f_i !errors here realn = realn + f_r imgn = imgn + f_i end do end do close(fIDB) end do !$omp end parallel do close(10) end program test