read line from file fortran
integer :: stat
character(len=200) :: line
open (1, file='data.dat', status='old') ! can not have unit=6
do
read(1, '(A)', IOSTAT=stat) line
if (IS_IOSTAT_END(stat)) exit
print *, line
end do
close (1)