        subroutine FLOWS
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      include 'LOCAL1.INC'
      include 'LOCAL2.INC'
        real EVAPL(NPX), WATINL(NPX), TOTIN, TOTOUT
        integer I, ICPTES(NPX), J, JJ
      do 100 J = 1, KOUNT
         RAINFL(J) = 0.
         EVAPL(J) = 0.
         SEEPSL(J) = 0.
         NPSFL(J) = 0.
         STRMFL(J) = 0.
         STSCOL(J) = 0.
         NPSCOL(J) = 0.
         ICPTES(J) = 0
100   continue
      do 110 J = 1, NCON
         if (JFRADG(J).le.0) go to 110
         JJ = JFRADG(J)
         ICPTES(JJ) = 1
110   continue
      TOTIN = 0.
      do 140 J = 1, KOUNT
         if (J.gt.1.and.(TYPEG(J).eq.'B'.or.TYPEG(J).eq.'H'.or.TYPEG(J-1
     &      ).ne.'B')) go to 120
         RAINFL(J) = RAING(NDAT)*AREAG(J)/730.5
         EVAPL(J) = EVAPG(J,NDAT)*AREAG(J)/730.5
         if (TCELG(J,NDAT).gt.0.0) go to 120
         RAINFL(J) = 0.0
         EVAPL(J) = 0.0
120      continue
         STRMFL(J) = STFLOG(J,NDAT)*1000.
         if (STRMFL(J).ne.0.) STSCOL(J) = STSEDG(J,NDAT)/STRMFL(J)
         SEEPSL(J) = SEEPSG(J,NDAT)*1000.
         NPSFL(J) = NPSFLG(J,NDAT)*1000.
         if (NPSFL(J).ne.0.) NPSCOL(J) = NPSEDG(J,NDAT)/NPSFL(J)
         WATINL(J) = STRMFL(J)+SEEPSL(J)+NPSFL(J)+RAINFL(J)-EVAPL(J)
         if (WATINL(J).le.0..or.ICPTES(J).ne.0) go to 130
         write (TTYOUT(MACHNO),5000) J
         go to 180
5000  format (/1X,'Hydrologic definition of segment',I4,' is ','improper
     &.'/1X,'There is a net advected flow leaving this ','segment,'/1X,'
     &but the flow pathway has not been specified.'/1X,'Simulation abort
     &ed.')
130      continue
         TOTIN = TOTIN+WATINL(J)
140   continue
      call WATADV (TOTIN,WATINL)
      if (IFLAG.eq.8) go to 190
      call SEDADV
      call DISPER
      if (KOUNT.eq.1) go to 170
      do 160 J = 1, KOUNT
         TOTOUT = 0.
         do 150 I = 1, KOUNT
            TOTOUT = TOTOUT+WATFL(I,J)+WATFL(J,I)
150      continue
         if (TOTOUT.ne.0.) go to 160
         write (TTYOUT(MACHNO),5010) J
         go to 180
160   continue
5010  format (1X,'System definition error: segment ',I4/1X,'is not conne
     &cted to other system elements.'/1X,'Simulation aborted.')
170   continue
      go to 190
180   continue
      IFLAG = 8
190   continue
      return
      end
