      SUBROUTINE D0DES0(T0,X0,T1,X1,NX,DT,TSTOP,OK,HANDLE,E)
C
C  OUTPUT FILTER FOR USE WITH GLOBAL MAXIMUM ERROR OPTION IN DODES.
C
      COMMON /DODESM/IGMAX,IGMAXO
C
      DOUBLE PRECISION T0,X0(NX),T1,X1(NX),DT,TSTOP
      REAL E(NX)
      LOGICAL OK
      EXTERNAL HANDLE
C
      DOUBLE PRECISION TEMP
C
      COMMON /CSTAK/DS
      DOUBLE PRECISION DS(500)
      REAL RS(1000)
      EQUIVALENCE (DS(1),RS(1))
C
C ... RAISE THE GLOBAL MAXIMUM, IF NECESSARY.
C
      IF (T0.NE.T1.AND.IGMAX.GT.0)
     1   CALL MOVEFR(NX,RS(IGMAX),RS(IGMAXO))
C
C ... OTHERWISE, RETURN IT TO ITS PREVIOUS VALUE.
C
      IF (T0.EQ.T1.AND.IGMAX.GT.0)
     1   CALL MOVEFR(NX,RS(IGMAXO),RS(IGMAX))
C
      TEMP=DT
C
      CALL HANDLE(T0,X0,T1,X1,NX,DT,TSTOP,E)
C
C/6S
C     IF ((DT/DABS(DT))*(TSTOP-T1).LT.0.0D0) CALL SETERR
C    1   (49HDODES2 - DT RETURNED BY HANDLE HAS THE WRONG SIGN,49,4,2)
C/7S
      IF ((DT/DABS(DT))*(TSTOP-T1).LT.0.0D0) CALL SETERR
     1   ('DODES2 - DT RETURNED BY HANDLE HAS THE WRONG SIGN',49,4,2)
C/
C
C/6S
C     IF (.NOT.OK .AND. DABS(TEMP).LT.DABS(DT)) CALL SETERR
C    1   (49HDODES2 - CANNOT RAISE DT IN HANDLE WHEN .NOT.OKAY,49,8,2)
C/7S
      IF (.NOT.OK .AND. DABS(TEMP).LT.DABS(DT)) CALL SETERR
     1   ('DODES2 - CANNOT RAISE DT IN HANDLE WHEN .NOT.OKAY',49,8,2)
C/
C
      RETURN
C
      END
