        subroutine ENVIN(ECO1)
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
        integer J, NSPEC1, NSPEC2, N, NFIRST, NLAST, WRITER
        character*3 ECO1,ECO2
5000  format (A3)
5010  format (8F10.0)
      if (ECO1.eq.'QQQ') then
         WRITER = TTYOUT(MACHNO)
         go to 110
      endif
      WRITER = PRINTR(MACHNO)
      open (unit=ENVLUN(MACHNO),FILE='ENCANON.DAT',status='OLD')
      if (.not.(TOPOPN(MACHNO))) rewind ENVLUN(MACHNO)
100   continue
      read (ENVLUN(MACHNO),5000,end=140) ECO2
      if (ECO2.ne.ECO1) go to 100
110   continue
      read (ENVLUN(MACHNO),5040) ECONAM
      read (ENVLUN(MACHNO),5020) KOUNT
5020  format (16I5)
      if (KOUNT.le.0.or.KOUNT.gt.NPX) then
         write (WRITER,5030) KOUNT,NPX
5030  format (' Environment describes',I9,' segments;'/' no more than', 
     &I3,' can be used.')
         IFLAG = 8
         go to 150
      endif
      read (ENVLUN(MACHNO),5040) (TYPEG(J),J=1,KOUNT)
5040  format (80A1)
      do 120 J = 1, KOUNT
         if (TYPEG(J).eq.'l') TYPEG(J) = 'L'
         if (TYPEG(J).eq.'e') TYPEG(J) = 'E'
         if (TYPEG(J).eq.'h') TYPEG(J) = 'H'
         if (TYPEG(J).eq.'b') TYPEG(J) = 'B'
120   continue
      read (ENVLUN(MACHNO),5010) LATG,LONGG,ELEVG
      read (ENVLUN(MACHNO),5010) (VOLG(J),J=1,KOUNT)
      read (ENVLUN(MACHNO),5010) (AREAG(J),J=1,KOUNT)
      read (ENVLUN(MACHNO),5010) (DEPTHG(J),J=1,KOUNT)
      read (ENVLUN(MACHNO),5010) (XSAG(J),J=1,KOUNT)
      read (ENVLUN(MACHNO),5010) (LENGG(J),J=1,KOUNT)
      read (ENVLUN(MACHNO),5010) (WIDTHG(J),J=1,KOUNT)
      read (ENVLUN(MACHNO),5020) NSPEC1
      read (ENVLUN(MACHNO),5020) (JFRADG(J),J=1,NSPEC1)
      read (ENVLUN(MACHNO),5020) (ITOADG(J),J=1,NSPEC1)
      read (ENVLUN(MACHNO),5010) (ADVPRG(J),J=1,NSPEC1)
      read (ENVLUN(MACHNO),5020) NSPEC2
      read (ENVLUN(MACHNO),5020) (JTURBG(J),J=1,NSPEC2)
      read (ENVLUN(MACHNO),5020) (ITURBG(J),J=1,NSPEC2)
      read (ENVLUN(MACHNO),5010) (XSTURG(J),J=1,NSPEC2)
      read (ENVLUN(MACHNO),5010) (CHARLG(J),J=1,NSPEC2)
      if (MODEG.eq.3.or.PRSWG.eq.0) then
         NFIRST = 1
         NLAST = 12
      else
         NFIRST = MONTHG
         NLAST = MONTHG
      endif
      do 130 N = NFIRST, NLAST
         read (ENVLUN(MACHNO),5010) (DSPG(J,N),J=1,NSPEC2)
         read (ENVLUN(MACHNO),5010) (WINDG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (STFLOG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (STSEDG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (NPSFLG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (NPSEDG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (SEEPSG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) RAING(N)
         read (ENVLUN(MACHNO),5010) CLOUDG(N)
         read (ENVLUN(MACHNO),5010) OZONEG(N)
         read (ENVLUN(MACHNO),5010) RHUMG(N)
         read (ENVLUN(MACHNO),5010) ATURBG(N)
         read (ENVLUN(MACHNO),5040) AIRTYG(N)
         read (ENVLUN(MACHNO),5010) (DFACG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (EVAPG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (SUSEDG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (BULKDG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (PCTWAG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (FROCG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (CECG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (AECG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (TCELG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (PHG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (POHG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) OXRADG(N)
         read (ENVLUN(MACHNO),5010) (BACPLG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (BNBACG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (PLMASG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (BNMASG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (KO2G(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (DOCG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (CHLG(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (DISO2G(J,N),J=1,KOUNT)
         read (ENVLUN(MACHNO),5010) (REDAGG(J,N),J=1,KOUNT)
130   continue
      go to 150
140   continue
      write (WRITER,5050) ECO1
5050  format (' Data location error--no database found for'/' environmen
     &t ',A3/' Program execution terminated.')
      IFLAG = 8
150   continue
      close (unit=ENVLUN(MACHNO))
      return
      end
