# <span class='text-muted'>091.</span> Use iostat and iomsg to handle READ errors

<span style='font-size: small;' class='text-muted'>topic: {ref}`input-and-output`</span>

```{note}
This tip is a draft[^draft].

[^draft]: From the perspective of FortranTip Browser, "draft" means that
  it hasn't been edited for formatting,
  hasn't had corresponding Fortran programs added,
  the text content hasn't been enhanced, etc.
  Draft texts are extracted from the corresponding Tweet using the Twitter API.
```

The Fortran 2003 module iso_fortran_env has constants 

iostat_eor -- end of record
iostat_end -- end of file

to which the iostat of a READ statement will be set if that error occurs. READ also has an iomsg specifier returning a text error message.


---

<blockquote class="twitter-tweet"><p lang="en" dir="ltr">The Fortran 2003 module iso_fortran_env has constants <br><br>iostat_eor -- end of record<br>iostat_end -- end of file<br><br>to which the iostat of a READ statement will be set if that error occurs. READ also has an iomsg specifier returning a text error message.<a href="https://t.co/Rm6DmsKPP9">pic.twitter.com/Rm6DmsKPP9</a></p>&mdash; FortranTip (@fortrantip) <a href="https://twitter.com/fortrantip/status/1482687630877892608?ref_src=twsrc%5Etfw">January 16, 2022</a></blockquote><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>