!
! $Header$
!
      SUBROUTINE minmaxqfi(zq,qmin,qmax,comment)
      IMPLICIT none

#include "dimensions.h"
#include "dimphy.h"

      CHARACTER*(*) comment
      real qmin,qmax
      real zq(klon,klev)

      INTEGER jadrs(klon), jbad, k, i

      DO k = 1, klev
         jbad = 0
         DO i = 1, klon
         IF (zq(i,k).GT.qmax .OR. zq(i,k).LT.qmin) THEN
            jbad = jbad + 1
            jadrs(jbad) = i
         ENDIF
         ENDDO
         IF (jbad.GT.0) THEN
         PRINT*, comment
         DO i = 1, jbad
            PRINT*, "i,k,q=", jadrs(i),k,zq(jadrs(i),k)
         ENDDO
         ENDIF
      ENDDO

      return
      end
