
C ERROR HANDLER FOR I/O ROUTINES. SHOULD BE CALLED ON ALL I/O ERRORS.
C PRINTS OUT FATAL ERROR MESSAGE AND CALLS THE CRAPS EXIT HANDLER.
C
C INPUT:
C    ROUTINE - THE ROUTINE FROM WHICH IOERR IS CALLED [CHARACTER*(*)]
C    IUNIT   - THE UNIT ON WHICH THE I/O ERROR OCCURED.
C    IERTYP  - THE I/O ERROR NUMBER (FROM IOSTAT=XXX).

      SUBROUTINE IOERR(ROUTINE,IUNIT,IERTYP)
      IMPLICIT NONE
  
      CHARACTER*(*) ROUTINE
      INTEGER IUNIT, IERTYP

cYAU      WRITE(*,100) ROUTINE,IERTYP,IUNIT
cYAU100   FORMAT(T3,'@',A,'-F, I/O Error (IOSTAT = ',I3,') on Unit ',I3,'.')
      WRITE(*,100) ROUTINE
 100  FORMAT(/,' @',A,': An I/O Error has occurred.')
      CALL ERRMSG

      CALL ERREX
      RETURN
      END

