aborter Subroutine

private subroutine aborter(iunit, ierrmsg)

ABORTS A PROGRAM AFTER A FATAL ERROR CONDITION IS DETECTED.

input: iunit Unit Number of the file to write error messages to. ierrmsg An error message to write ilunerr

The advantage of using this subroutine is that it will generate a traceback showing the chain of subroutines which eventually bombed, and it forces an arithmetic error which the job control system can detect as a fatal error.

Arguments

Type IntentOptional AttributesName
integer, intent(in) :: iunit
character, intent(in) :: ierrmsg*(*)

Contents

Source Code


Common Blocks

Type AttributesNameInitial
real :: zz0
real :: zz1

Source Code

  subroutine aborter(iunit,ierrmsg)
    implicit none
    character, intent(in) :: ierrmsg*(*)
    integer, intent(in) :: iunit
    real :: zz0,zz1
    integer :: ilunerr
    common /abortcmn/ zz0,zz1
!
! zz0 is in a common block to prevent an optimizing compiler
! from evaluating 1.0/zz0 during compilation rather than during
! execution.
!
    write(iunit,1001)
1001 format(//' %ABORTER:  ** FATAL ERROR.  ABORT SUBROUTINE CALLED **'//)
  
    write(iunit,1002)ierrmsg
1002 format(1x,a,//)

! on CRAY's and VAXes:
! generate a divide-by-zero error:
!WARNING: ZZ0 is not initialised, so this may not be divide by zero
    zz1=1.0/zz0         !^
    ilunerr=5           !^

! on the DecStation:
!^      call exit(1)

    write(ilunerr,1010) zz0
1010 format(' ?ABORTER-- ZZ0= ',1PE11.4,' AND STILL EXECUTING...')

  end subroutine aborter