        subroutine ckerr(ier)
c
c check error code "ier"
c ier = 0  --> return
c ier = odd   --> ERROR : close opened files, write "controlled error 
c                 detection" message in standard output  and EXIT
c ier = even  --> set "WARNING issued" flag on
c ier = -99   --> final message
c
c a.tento v.1.0 4/02
c a.tento v.1.1 6/02
c
c REQUIRED routines:
c clall
        implicit none
        integer ier
c
        integer iwf, ieo, i
        save iwf
        data iwf/0/
c
c
        if ( ier .eq. 0 ) return
c
        ieo = ier - int(ier/2) * 2 
c
        if ( ier .ne. -99 ) then
         if ( ieo .eq. 0 ) then
          iwf = 1 
          return
         else
          do 1 i = 1, 4
           write(*,100)
1         continue
          call clall
          stop 2
         endif
        else
         call clall
         if ( iwf .eq. 0 ) then
          do 2 i = 1, 4
           write(*,300)
2         continue
          stop 0
         else
          do 3 i = 1, 4
           write(*,200)
3         continue
          stop 1
         endif
        endif
c
100     format(' >>>>>>>>>       CONTROLLED ERROR EXIT       <<<<<<<<<')
200     format(' >>>>>>>>> WARNING MESSAGES HAVE BEEN ISSUED <<<<<<<<<')
300     format(' >>>>>>>>>                O.K.               <<<<<<<<<')
        end
