      subroutine PAK(RECNUM,KT)
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      real BUFFER(VARREC),IO(789)
      integer IBUFF(VARIEC),IOI(7),RECNUM,OFFSET,NUSED,RECDAT(FILDAT)
     &,HRECS
      integer TRECS,RRECS,IRECS,CRECS,NREALS,NINTS,NCHARS
      integer I,KT,J,M,L,ISET,II,K
      character*1 CBUFF(VARCEC), IOC(62)
      do 100 I = 1, VARCEC
         CBUFF(I) = ' '
100   continue
      do 110 I = 1, VARIEC
         IBUFF(I) = 0
110   continue
      do 120 I = 1, VARREC
         BUFFER(I) = 0.0
120   continue
      IO(1) = MWTG(KT)
      IO(2) = KOCG(KT)
      IO(3) = KOWG(KT)
      IO(4) = KVOG(KT)
      IO(5) = HENRYG(KT)
      IO(6) = EHENG(KT)
      IO(7) = VAPRG(KT)
      IO(8) = EVPRG(KT)
      NUSED = 8
      do 130 I = 1, 6
         IO(NUSED+1) = PKG(I,KT)
         IO(NUSED+2) = EPKG(I,KT)
         IO(NUSED+3) = KIECG(I,KT)
         NUSED = NUSED+3
130   continue
      do 140 I = 1, 7
         IO(NUSED+1) = SOLG(I,KT)
         IO(NUSED+2) = ESOLG(I,KT)
         IO(NUSED+3) = KPSG(I,KT)
         IO(NUSED+4) = KPBG(I,KT)
         IO(NUSED+5) = KPDOCG(I,KT)
         IO(NUSED+6) = KDPG(I,KT)
         IO(NUSED+7) = RFLATG(I,KT)
         IO(NUSED+8) = LAMAXG(I,KT)
         NUSED = NUSED+8
140   continue
      do 160 J = 1, 7
         do 150 I = 1, 3
            IO(NUSED+1) = QUANTG(I,J,KT)
            IO(NUSED+2) = KAHG(I,J,KT)
            IO(NUSED+3) = EAHG(I,J,KT)
            IO(NUSED+4) = KNHG(I,J,KT)
            IO(NUSED+5) = ENHG(I,J,KT)
            IO(NUSED+6) = KBHG(I,J,KT)
            IO(NUSED+7) = EBHG(I,J,KT)
            IO(NUSED+8) = KOXG(I,J,KT)
            IO(NUSED+9) = EOXG(I,J,KT)
            IO(NUSED+10) = K1O2G(I,J,KT)
            IO(NUSED+11) = EK1O2G(I,J,KT)
            IO(NUSED+12) = KREDG(I,J,KT)
            IO(NUSED+13) = EREDG(I,J,KT)
            NUSED = NUSED+13
150      continue
160   continue
      do 180 J = 1, 7
         do 170 I = 1, 4
            IO(NUSED+1) = KBACWG(I,J,KT)
            IO(NUSED+2) = QTBAWG(I,J,KT)
            IO(NUSED+3) = KBACSG(I,J,KT)
            IO(NUSED+4) = QTBASG(I,J,KT)
            NUSED = NUSED+4
170      continue
180   continue
      do 200 J = 1, 7
         do 190 I = 1, 46
            IO(NUSED+I) = ABSORG(I,J,KT)
190      continue
         NUSED = NUSED+46
200   continue
      do 210 I = 1, 50
         IOC(I) = CHEMNA(I,KT)
210   continue
      NUSED = 50
      do 220 I = 1, 6
         IOC(NUSED+1) = RPASS(1)(I:I)
         IOC(NUSED+2) = WPASS(1)(I:I)
         NUSED = NUSED+2
220   continue
      do 230 I = 1, 7
         IOI(I) = SPFLGG(I,KT)
230   continue
      NUSED = 7
      HRECS = FILDAT/VARIEC
      if (FILDAT-VARIEC*HRECS.ne.0) HRECS = HRECS+1
      M = 0
      do 250 I = 1, HRECS
         read (RANUNT(MACHNO),rec=I) IBUFF
         do 240 L = 1, VARIEC
            M = M+1
            if (M.gt.FILDAT) go to 260
            RECDAT(M) = IBUFF(L)
240      continue
250   continue
260   continue
      RRECS = RECDAT(15)
      IRECS = RECDAT(16)
      CRECS = RECDAT(54)
      TRECS = RRECS+IRECS+CRECS
      NREALS = RECDAT(19)
      NINTS = RECDAT(20)
      NCHARS = RECDAT(50)
      ISET = RECDAT(9)-1
      II = RECNUM
      OFFSET = (II-1)*TRECS+ISET
      do 290 I = 1, RRECS
         J = (I-1)*VARREC
         K = J+VARREC
         J = J+1
         M = 0
         do 270 L = J, K
            M = M+1
            if (L.gt.NREALS) go to 280
            BUFFER(M) = IO(L)
270      continue
280      continue
         J = OFFSET+I
         write (RANUNT(MACHNO),rec=J) BUFFER
290   continue
      OFFSET = OFFSET+RRECS
      do 320 I = 1, IRECS
         J = (I-1)*VARIEC
         K = J+VARIEC
         J = J+1
         M = 0
         do 300 L = J, K
            M = M+1
            if (L.gt.NINTS) go to 310
            IBUFF(M) = IOI(L)
300      continue
310      continue
         J = OFFSET+I
         write (RANUNT(MACHNO),rec=J) IBUFF
320   continue
      OFFSET = OFFSET+IRECS
      do 350 I = 1, CRECS
         J = (I-1)*VARCEC
         K = J+VARCEC
         J = J+1
         M = 0
         do 330 L = J, K
            M = M+1
            if (L.gt.NCHARS) go to 340
            CBUFF(M) = IOC(L)
330      continue
340      continue
         J = OFFSET+I
         write (RANUNT(MACHNO),rec=J) CBUFF
350   continue
      return
      end
