      subroutine KINHED(EOF,CMPNAM,SYSNAM,KOUNT,TYPES,ICODE,MCHEMG)
      include 'SIZE.INC'
      include 'UNITS.INC'
      integer EOF,ICODE,K,KCHEM,KOUNT,MCHEMG,DUMMY,I
      character CMPNAM*50, DUMNAM*50, SYSNAM*50, TYPES(NPX)*1
      read (PLTLUN(MACHNO),end=120) KCHEM,DUMMY,KOUNT,ICODE
      if (MCHEMG.lt.1.or.MCHEMG.gt.KCHEM) go to 130
      do 100 K = 1, KCHEM
         if (K.eq.MCHEMG) then
            read (PLTLUN(MACHNO),end=120) CMPNAM
         else
            read (PLTLUN(MACHNO),end=120) DUMNAM
         endif
100   continue
      read (PLTLUN(MACHNO),end=120) SYSNAM
      read (PLTLUN(MACHNO),end=120) (TYPES(I),I=1,KOUNT)
      EOF = 0
110   continue
      return
120   continue
      EOF = 1
      go to 110
130   continue
      EOF = 2
      go to 110
      end
