      subroutine PRZMIN
      include 'size.inc'
      include 'global.inc'
      include 'units.inc'
      real R1,R2,R3,R4,TRAREA,CFACTR
      integer I,J,K,I1,I2,NOYEAR,NOAPPS,I3
      character*3 DUMMY
      data CFACTR/1.E+05/
170   read (unit=PRZLUN(MACHNO),err=1015,end=1020,fmt=180) DUMMY
      if (DUMMY .eq. ' !!') goto 210
      goto 170
180   format(A3)
210   continue
      read (unit=PRZLUN(MACHNO),err=1015,end=1020,fmt=220)TRAREA,NOYEAR,
     &NOAPPS
220   format(1X,F8.2,2X,I4,2X,I2)
      if (NOAPPS.gt.0) then
        I3=1
        do 222 I=1,NOAPPS
          read (unit=PRZLUN(MACHNO),err=1015,end=1020,fmt=225)I1,I2,R1
          I3=I3+1
          ISEGG(I)=1
          ICHEMG(I)=MCHEMG
          IMONG(I)=I1
          IDAYG(I)=I2
          IYEARG(I)=NOYEAR
          IMASSG(I)=R1
222     continue
      else
        I3=1
      endif
225   format(1X,I2,1X,I2,2X,F8.3)
230   continue
      read (unit=PRZLUN(MACHNO),err=1030,end=2000,fmt=240)
     &I1,I2,R1,R2,R3,R4
240   format(1X,I2,1X,I2,2X,4(E10.4,1X))
      if (R2 .gt. 0.0) then
        ISEGG(I3)  =1
        ICHEMG(I3) =MCHEMG
        IMONG(I3)  =I1
        IDAYG(I3)  =I2
        IYEARG(I3) =NOYEAR
        IMASSG(I3)=R2*TRAREA*CFACTR
        I3=I3+1
      endif
      if (R4 .gt. 0.0) then
        if (PRBENG .gt. 0.0) then
          ISEGG(I3)  =2
          ICHEMG(I3) =MCHEMG
          IMONG(I3)  =I1
          IDAYG(I3)  =I2
          IYEARG(I3) =NOYEAR
          IMASSG(I3)=R4*TRAREA*CFACTR*PRBENG
        endif
        if (PRBENG .lt. 1.0) then
          if (R2 .gt. 0.0) then
            IMASSG(I3-1)=IMASSG(I3-1)+R4*TRAREA*CFACTR*(1.0-PRBENG)
          else
            if (PRBENG.gt.0.0) I3=I3+1
            IMASSG(I3)=R4*TRAREA*CFACTR*(1.0-PRBENG)
            ISEGG(I3)  =1
            ICHEMG(I3) =MCHEMG
            IMONG(I3)  =I1
            IDAYG(I3)  =I2
            IYEARG(I3) =NOYEAR
          endif
        endif
      I3=I3+1
      endif
      if (I3 .le. MAXMAS) goto 230
      write (TTYOUT(MACHNO),fmt=300) MAXMAS
300   format(' EXAMS allows for',I4,' events during each year.'/        
     &' The PRZM file contains additional events that were not loaded.'/
     &' You may wish to remove some small events from the PRZM'/        
     &' exchange file and try again.')
      goto 2000
1000  write (TTYOUT(MACHNO),fmt=1010) NOYEAR
1010  format (' Error opening PRZM input file for year ', I4)
      goto 2000
1015  write (TTYOUT(MACHNO),fmt=1017)
1017  format (' Error reading PRZM file. No events loaded.')
      goto 2000
1020  write (TTYOUT(MACHNO),fmt=1025)
1025  format(' No data in PRZM file--processing ended.')
      goto 2000
1030  write (TTYOUT(MACHNO),fmt=1035)
1035  format(' Error reading PRZM input file...'/' check the results',  
     &' with SHOW PULSE LOAD command.')
      goto 2000
2000  continue
      close (unit=PRZLUN(MACHNO))
      return
      end
