Outputs error message and terminates program
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | WHERE |
Program or subroutine the error is being called from |
||
character(len=*), | intent(in) | :: | ErrMsg |
The error message itself |
SUBROUTINE ERROUT( WHERE, ErrMsg ) !! Outputs error message and terminates program ! Arguments CHARACTER (LEN=*), INTENT( IN ) :: WHERE !! Program or subroutine the error is being called from CHARACTER (LEN=*), INTENT( IN ) :: ErrMsg !! The error message itself INTEGER :: Last WRITE( PRTFile, * ) WRITE( PRTFile, * ) '*** FATAL ERROR ***' Last = LEN( WHERE ) WRITE( PRTFile, * ) 'Generated by program or subroutine: ', WHERE( 1 : Last ) Last = LEN( ErrMsg ) WRITE( PRTFile, * ) ErrMsg( 1 : Last ) WRITE( PRTFile, * ) CLOSE( PRTFile ) ! Intel Fortran can't handle the following ! ERROR STOP 'Fatal Error in ' // WHERE( 1 : Last1 ) // ': ' // ErrMsg( 1 : Last2 ) ERROR STOP 'Fatal Error: Check the print file for details' END SUBROUTINE ERROUT