      subroutine KINET(KIN,MCHEMG)
      include 'SIZE.INC'
      include 'INPAR.INC'
      include 'UNITS.INC'
      real TABLE(132),OUTPUT(7),PMIN(7),PMAX(7),P
      integer SELECT(7),DUMP,III,IV
      integer MAXP,IERR,KOUNT,ICODE,MCHEMG,LRAIL,KNT,K,J,II,K1,K2
      integer I,NSEL,IHIT,IOFF,L,KIN,NSLINE
      parameter (NSLINE=20)
      character TUNIT(4)*6
      character CHEMNA*50, ECONAM*50, TYPEG(NPX)*1
      data DUMP,MAXP,TUNIT/0,7,'Hours ','Days  ','Months','Years '/
      rewind PLTLUN(MACHNO)
      call KINHED (IERR,CHEMNA,ECONAM,KOUNT,TYPEG,ICODE,MCHEMG)
      if (IERR.eq.1) go to 210
      if (IERR.eq.2) go to 220
      III = LRAIL(CHEMNA,50)
      IV = LRAIL(ECONAM,50)
      write (TTYOUT(MACHNO),5000) CHEMNA(1:III),ECONAM(1:IV)
5000  format (//1X,'Chemical: ',A/1X,'Environment: ',A)
      write (TTYOUT(MACHNO),5010) TUNIT(ICODE),KOUNT
5010  format (/' Simulation units:   ',A6/' Number of segments: ',I4)
      KNT = KOUNT
      K = KNT/NSLINE
      J = KNT-NSLINE*K
      if (J.ne.0) K = K+1
      do 100 II = 1, K
         K1 = (II-1)*NSLINE+1
         K2 = K1+NSLINE-1
         if (K2.gt.KNT) K2 = KNT
         write (TTYOUT(MACHNO),5020) (I,I=K1,K2)
         write (TTYOUT(MACHNO),5030) (TYPEG(I),I=K1,K2)
100   continue
5020  format (' Segment Number: ',100(I2,1X))
5030  format (' Segment "TYPE": ',100(1X,A1,1X))
      call KINSEL (MAXP,KOUNT,NSEL,SELECT)
      if (NSEL.gt.0) go to 110
      write (TTYOUT(MACHNO),5040)
5040  format (//' No parameters selected; command terminated.')
      go to 210
110   continue
      do 120 I = 1, NSEL
         PMAX(I) = -1.E30
         PMIN(I) = 1.E30
120   continue
      rewind PLTLUN(MACHNO)
      call KINHED (IERR,CHEMNA,ECONAM,KOUNT,TYPEG,ICODE,MCHEMG)
      if (IERR.eq.1) go to 180
      if (DUMP.eq.0) go to 140
      III = LRAIL(CHEMNA,50)
      IV = LRAIL(ECONAM,50)
      write (TTYOUT(MACHNO),5000) CHEMNA(1:III),ECONAM(1:IV)
      write (TTYOUT(MACHNO),5010) TUNIT(ICODE),KOUNT
      KNT = KOUNT
      K = KNT/10
      J = KNT-10*K
      if (J.ne.0) K = K+1
      do 130 II = 1, K
         K1 = (II-1)*10+1
         K2 = K1+9
         if (K2.gt.KNT) K2 = KNT
         write (TTYOUT(MACHNO),5020) (I,I=K1,K2)
         write (TTYOUT(MACHNO),5030) (TYPEG(I),I=K1,K2)
130   continue
140   continue
      call KINRED (IERR,KOUNT,TABLE,IHIT,MCHEMG)
      if (IERR.eq.2) go to 180
      if (DUMP.eq.0) go to 160
      write (TTYOUT(MACHNO),5050) (TABLE(I),I=1,7)
5050  format (' $AVE',7G10.3)
      do 150 I = 1, KOUNT
         IOFF = (I-1)*5+7
         K = IOFF+5
         J = IOFF+1
         write (TTYOUT(MACHNO),5060) TABLE(1),TYPEG(I),(TABLE(L),L=J,K)
5060     format (' $COM',G10.3,3X,A1,1X,5E10.3)
150   continue
160   continue
      do 170 I = 1, NSEL
         K = SELECT(I)
         P = TABLE(K)
         if (P.gt.PMAX(I)) PMAX(I) = P
         if (P.lt.PMIN(I)) PMIN(I) = P
170   continue
      go to 140
180   continue
      if (DUMP.eq.0) go to 200
      do 190 I = 1, NSEL
         K = SELECT(I)
         write (TTYOUT(MACHNO),5070) K,PMIN(I),PMAX(I)
5070     format (/,' DATUM (K) ',I3,' MIN: ',1PE10.3,' MAX: ',1PE10.3)
190   continue
200   continue
      if (KIN.eq.1) call KINLIS (KOUNT,SELECT,NSEL,TABLE,OUTPUT,TYPEG,
     &   CHEMNA,ECONAM,MCHEMG)
      if (KIN.eq.2) call KINPLT (KOUNT,SELECT,NSEL,TABLE,OUTPUT,TYPEG,
     &   CHEMNA,ECONAM,PMAX,PMIN,MCHEMG)
210   continue
      return
220   continue
      write (TTYOUT(MACHNO),5080) MCHEMG
5080  format (//' No data available with MCHEM set to: ',I5)
      go to 210
      end
