IOSTAT_MSG Subroutine
Lahey/Fujitsu Fortran

IOSTAT_MSG Subroutine


The IOSTAT_MSG subroutine retrieves text associated with a runtime error.


IOSTAT_MSG (iostat, message)


iostat is an INTENT(IN) scalar of type INTEGER. It contains the error status code obtained by execution of any intrinsic statement which returns a status variable.

message is an INTENT(OUT) scalar be of type CHARACTER. It is assigned the text of the runtime error message corresponding to the error code in iostat.


A CHARACTER length of 256 is sufficiently large to contain all runtime error messages at this time.

If a status variable from a successful operation is passed to IOSTAT_MSG, a blank string is returned.


real,allocatable :: a(:) integer :: istat character(len=256) :: msg open(10,file="",status="OLD",iostat=istat) call iostat_msg(istat,msg) write(*,*) trim(msg) deallocate(a,stat=istat) call iostat_msg(istat,msg) write(*,*) trim(msg) write(*,*) " Bye"