      subroutine LOADUP(CHEM1,ECO1)
      include 'SIZE.INC'
      include 'GLOBAL.INC'
      include 'LOCAL.INC'
      include 'UNITS.INC'
      character*3 CHEM1(NCHEM), ECO1
      integer I,IDUM,J,K,N,NPATH,NSEGS,NSTART,NSTOP
      do 100 I = 1, MAXMAS
         ISEGG(I) = 0
         ICHEMG(I) = 0
         IMONG(I) = 0
         IDAYG(I) = 0
         IYEARG(I)=1991
         IMASSG(I) = 0.0
100   continue
      do 110 K = 1, MAXDAT
         do 110 J = 1, NCHEM
            do 110 I = 1, NPX
               STRLDG(I,J,K) = 0.0
               NPSLDG(I,J,K) = 0.0
               PCPLDG(I,J,K) = 0.0
               DRFLDG(I,J,K) = 0.0
               SEELDG(I,J,K) = 0.0
110   continue
      open (unit=RANUNT,FILE='RUNTOX.DAT',status='OLD')
      if (.not.(TOPOPN)) rewind RANUNT
      read (RANUNT,5060) ECO1
      read (RANUNT,5080) MODEG,PRSWG,MONTHG,NYEARG,YEAR1G
      if (MODEG.gt.0.and.MODEG.le.NMODE) go to 120
      write (TTYOUT,5000) MODEG
      IFLAG = 8
      go to 250
5000  format (1X,'This version of EXAMS does not have an operating'/1X,'
     &MODE of ',I5,'.  The RUN has been aborted.')
120   continue
      read (RANUNT,5070) KCHEM
      if (KCHEM.le.NCHEM) go to 130
      write (TTYOUT,5010) NCHEM,KCHEM
5010  format (/1X,'This implementation of EXAMS was set up for',I5/1X,'C
     &hemicals at most.  The code must be recompiled'/1X,'in order to RU
     &N',I5,' compounds.'/1X,'The RUN command has been cancelled.')
      IFLAG = 8
      go to 250
130   continue
      read (RANUNT,5060) (CHEM1(I),I=1,KCHEM)
      if (MODEG.ne.2) then
         read (RANUNT,5090) IDUM
      else
         read (RANUNT,5090) TCODEG,TINITG,TENDG,CINTG
      endif
      read (RANUNT,5090) IDUM,ABSERG,RELERG
      read (RANUNT,5070) NPULSE
      if (NPULSE.eq.0) go to 170
      if (NPULSE.lt.0) go to 160
      if (NPULSE.le.MAXMAS) go to 140
      write (TTYOUT,5030) NPULSE,MAXMAS
      IFLAG = 8
      go to 250
140   continue
      do 150 I = 1, NPULSE
         read (RANUNT,5070) ISEGG(I),ICHEMG(I),IMONG(I),IDAYG(I),
     &IMASSG(I)
150   continue
      go to 170
160   continue
      write (TTYOUT,5020)
      IFLAG = 8
      go to 250
5020  format (1X,'A pulse load request contained a negative'/1X,'number 
     &of pulses -- RUN aborted.')
5030  format (1X,'The requested number of chemical pulse loads',' (',I5,
     &')'/1X,'is larger than the maximum provided for ','(',I5,')'/1X,'i
     &n this version of EXAMS.  To work this '/1X,'problem, increase the
     & size of "MAXMAS" and recompile.'/' RUN aborted.')
170   continue
      if (MODEG.eq.3) then
         NSTART = 1
         NSTOP = 12
      elseif (PRSWG.eq.0) then
         NSTART = 13
         NSTOP = 13
      else
         NSTART = MONTHG
         NSTOP = MONTHG
      endif
      do 200 N = NSTART, NSTOP
         do 190 K = 1, KCHEM
            read (RANUNT,5070) NSEGS
            if (NSEGS.eq.0) go to 190
            do 180 J = 1, NSEGS
               read (RANUNT,5090) I,STRLDG(I,K,N),NPSLDG(I,K,N),PCPLDG(I
     &            ,K,N),DRFLDG(I,K,N),SEELDG(I,K,N)
180         continue
190      continue
200   continue
      close (unit=RANUNT)
      if (KCHEM.eq.1) go to 260
      if (KCHEM.gt.1) go to 210
      write (TTYOUT,5040) KCHEM
5040  format (' EXAMS cannot be RUN for ',I5/' chemicals.  Simulation ab
     &orted.')
      IFLAG = 8
      go to 250
210   continue
      do 220 I = 1, NTRAN
         CHPARG(I) = 0
         TPRODG(I) = 0
         NPROCG(I) = 0
         RFORMG(I) = 0
         YIELDG(I) = 0.0
         EAYLDG(I) = 0.0
220   continue
      open (unit=RANUNT,FILE='PRODUCT.DAT',status='OLD')
      if (.not.(TOPOPN)) rewind RANUNT
      read (RANUNT,5070) NPATH
      if (NPATH.le.0) go to 250
      if (NPATH.le.NTRAN) go to 230
      IFLAG = 8
      write (TTYOUT,5050) NPATH,NTRAN
5050  format (1X,I9,' product chemistry pathways for generation of'/1X,'
     &autochthonous chemical loadings were requested, but this'/1X,'vers
     &ion of EXAMS supports only ',I5/1X,'Simulation aborted.')
      go to 250
230   continue
      do 240 J = 1, NPATH
         read (RANUNT,5070) CHPARG(J),TPRODG(J),NPROCG(J),RFORMG(J),
     &      YIELDG(J),EAYLDG(J)
240   continue
250   continue
      close (unit=RANUNT)
5060  format (A3)
5070  format (4I5,2F10.0)
5080  format (10I5)
5090  format (I5,5F10.0)
260   continue
      return
      end
