May I suggest something like the following: lpread: & do read (1,fmt='(a)',iostat=iostatus) tmp if (iostatus /= 0) exit lpread ! ! here you can do whatever you want with tmp ! and it will continue to read until either: ! - end-of-file ! - error reading ! enddo lpread This is standard F90, and should work fine. Marcel. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%