      subroutine UNPENV(RECNUM)
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      real BUFFER(VARREC)
      integer IBUFF(VARIEC),RECNUM,OFFSET,I,M,L,ISET,J,NUSED
      integer RRECS, IRECS, CRECS, TRECS, NREALS, NINTS, NCHARS
      integer RECDAT(FILDAT), HRECS
      character*1 CBUFF(VARCEC)
      include 'ENVSIZ.INC'
      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
      HRECS = FILDAT/VARIEC
      if (FILDAT-VARIEC*HRECS.ne.0) HRECS = HRECS+1
      M = 0
      do 140 I = 1, HRECS
         read (RANUNT(MACHNO),rec=I) IBUFF
         do 130 L = 1, VARIEC
            M = M+1
            if (M.gt.FILDAT) go to 150
            RECDAT(M) = IBUFF(L)
130      continue
140   continue
150   continue
      NREALS = RECDAT(25)
      NINTS = RECDAT(26)
      NCHARS = RECDAT(51)
      RRECS = RECDAT(21)
      IRECS = RECDAT(22)
      CRECS = RECDAT(55)
      TRECS = RRECS+IRECS+CRECS
      ISET = RECDAT(11)-1
      OFFSET = (RECNUM-1)*TRECS+ISET
      M = 0
      do 180 I = 1, RRECS
         J = OFFSET+I
         read (RANUNT(MACHNO),rec=J) BUFFER
         do 160 L = 1, VARREC
            M = M+1
            if (M.gt.NREALS) go to 170
            IO(M) = BUFFER(L)
160      continue
170      continue
180   continue
      OFFSET = OFFSET+RRECS
      M = 0
      do 210 I = 1, IRECS
         J = OFFSET+I
         read (RANUNT(MACHNO),rec=J) IBUFF
         do 190 L = 1, VARIEC
            M = M+1
            if (M.gt.NINTS) go to 200
            IOI(M) = IBUFF(L)
190      continue
200      continue
210   continue
      OFFSET = OFFSET+IRECS
      M = 0
      do 240 I = 1, CRECS
         J = OFFSET+I
         read (RANUNT(MACHNO),rec=J) CBUFF
         do 220 L = 1, VARCEC
            M = M+1
            if (M.gt.NCHARS) go to 230
            IOC(M) = CBUFF(L)
220      continue
230      continue
240   continue
      LATG = IO(1)
      LONGG = IO(2)
      ELEVG = IO(3)
      NUSED = 3
      do 250 I = 1, NPX
         VOLG(I) = IO(NUSED+1)
         AREAG(I) = IO(NUSED+2)
         DEPTHG(I) = IO(NUSED+3)
         XSAG(I) = IO(NUSED+4)
         LENGG(I) = IO(NUSED+5)
         WIDTHG(I) = IO(NUSED+6)
         NUSED = NUSED+6
250   continue
      do 270 I = 1, NCON
         XSTURG(I) = IO(NUSED+1)
         CHARLG(I) = IO(NUSED+2)
         ADVPRG(I) = IO(NUSED+3)
         NUSED = NUSED+3
         do 260 J = 1, MAXDAT
            DSPG(I,J) = IO(NUSED+J)
260      continue
         NUSED = NUSED+MAXDAT
270   continue
      do 280 I = 1, MAXDAT
         OXRADG(I) = IO(NUSED+1)
         CLOUDG(I) = IO(NUSED+2)
         RAING(I) = IO(NUSED+3)
         OZONEG(I) = IO(NUSED+4)
         RHUMG(I) = IO(NUSED+5)
         ATURBG(I) = IO(NUSED+6)
         NUSED = NUSED+6
280   continue
      do 300 I = 1, MAXDAT
         do 290 J = 1, NPX
            FROCG(J,I) = IO(NUSED+1)
            CECG(J,I) = IO(NUSED+2)
            AECG(J,I) = IO(NUSED+3)
            PCTWAG(J,I) = IO(NUSED+4)
            TCELG(J,I) = IO(NUSED+5)
            PHG(J,I) = IO(NUSED+6)
            POHG(J,I) = IO(NUSED+7)
            REDAGG(J,I) = IO(NUSED+8)
            BACPLG(J,I) = IO(NUSED+9)
            BNBACG(J,I) = IO(NUSED+10)
            PLMASG(J,I) = IO(NUSED+11)
            BNMASG(J,I) = IO(NUSED+12)
            KO2G(J,I) = IO(NUSED+13)
            STFLOG(J,I) = IO(NUSED+14)
            STSEDG(J,I) = IO(NUSED+15)
            NPSFLG(J,I) = IO(NUSED+16)
            NPSEDG(J,I) = IO(NUSED+17)
            SEEPSG(J,I) = IO(NUSED+18)
            DOCG(J,I) = IO(NUSED+19)
            CHLG(J,I) = IO(NUSED+20)
            DFACG(J,I) = IO(NUSED+21)
            DISO2G(J,I) = IO(NUSED+22)
            EVAPG(J,I) = IO(NUSED+23)
            WINDG(J,I) = IO(NUSED+24)
            BULKDG(J,I) = IO(NUSED+25)
            SUSEDG(J,I) = IO(NUSED+26)
            NUSED = NUSED+26
290      continue
300   continue
      KOUNT = IOI(1)
      NUSED = 1
      do 310 I = 1, NCON
         JFRADG(I) = IOI(NUSED+1)
         ITOADG(I) = IOI(NUSED+2)
         JTURBG(I) = IOI(NUSED+3)
         ITURBG(I) = IOI(NUSED+4)
         NUSED = NUSED+4
310   continue
      do 320 I = 1, 50
         ECONAM(I) = IOC(I)
320   continue
      NUSED = 50
      do 330 I = 1, 6
         RPASS(2)(I:I) = IOC(NUSED+1)
         WPASS(2)(I:I) = IOC(NUSED+2)
         NUSED = NUSED+2
330   continue
      do 340 I = 1, NPX
         TYPEG(I) = IOC(NUSED+I)
340   continue
      NUSED = NUSED+NPX
      do 350 I = 1, MAXDAT
         AIRTYG(I) = IOC(NUSED+I)
350   continue
      NUSED = NUSED+MAXDAT
      return
      end
