      program getminmax
      implicit none

c -----
c number of data
      integer NDAT
      parameter (NDAT=121)

c missing value
      real    MISS
      parameter (MISS=-999.)

c IO
      integer IFILE
      parameter (IFILE=21)

c -----
c data
      character*8  HHMMSS
      real    t, wd, ws
      real    tmin,  tmax
      real    wdmin, wdmax
      real    wsmin, wsmax

c loop control
      integer i

c -----
      open(IFILE,file='datafile')
 220  continue
      read(IFILE,*,end=240)
      read(IFILE,*)
      read(IFILE,*)
      read(IFILE,*)
      read(IFILE,*)
      read(IFILE,*)
c set first data
      read(IFILE,*) HHMMSS, t, wd, ws
      tmin  = t
      tmax  = t
c      wdmin = wd
c      wdmax = wd
      wsmin = ws
      wsmax = ws
c read data
      do 230 i = 2, NDAT
        read(IFILE,*) HHMMSS, t, wd, ws
        if (t.ne.MISS) then
            if (tmin.eq.MISS) then
                tmin = t
            end if
            if (t.lt.tmin) then
                tmin = t
            end if
            if (tmax.eq.MISS) then
                tmax = t
            end if
            if (t.gt.tmax) then
                tmax = t
            end if
        end if
c        if (wd.ne.MISS) then
c            if (wd.lt.wdmin) then
c                wdmin = wd
c            end if
c            if (wd.gt.wdmax) then
c                wdmax = wd
c            end if
c        end if
        if (ws.ne.MISS) then
            if (wsmin.eq.MISS) then
                wsmin = ws
            end if
            if (ws.lt.wsmin) then
                wsmin = ws
            end if
            if (wsmax.eq.MISS) then
                wsmax = ws
            end if
            if (ws.gt.wsmax) then
                wsmax = ws
            end if
        end if
 230  continue
c outpout
      write(*,*) tmin,  ',', tmax,  ','
     &         , wsmin, ',', wsmax, ','
c     &         , wdmin, ',', wdmax
      go to 220
 240  continue
      close(IFILE)


      stop
      end
