      SUBROUTINE ZLIMIT(Z,ISIZE1,JSIZE,ZMIN,ZMAX)
C
C NAME: SUBROUTINE ZLIMIT
C
C DESCRIPTION: ZLIMIT FINDS THE MAXIMUM (ZMAX) AND MINIMUM (ZMIN) OF
C              THE Z ARRAY.
C
      DIMENSION Z(ISIZE1,JSIZE)
      COMMON/OPTION/IMIN,IMAX,JMIN,JMAX
      COMMON/CON$/DUM$(33),UNDEF
C	INCLUDE 'OVRLAY.FTN'
      DATA XMIN,XMAX/2*0.0/
      FIRST=1.0
      SECOND=0.0
      DO 1 I=IMIN,IMAX
      DO 1 J=JMIN,JMAX
      ZZ=Z(I,J)
      IF (ZZ.EQ.UNDEF) GO TO 1
      XMIN=AMIN1(XMIN,ZZ)*SECOND+ZZ*FIRST
      XMAX=AMAX1(XMAX,ZZ)*SECOND+ZZ*FIRST
      FIRST=0.0
      SECOND=1.0
    1 CONTINUE
      ZMIN=XMIN
      ZMAX=XMAX
      RETURN
      END
