SUBROUTINE FERCHK
*-- Author : S.Burke
      SUBROUTINE FERCHK(IERR)
                                                                        
      PARAMETER (MAXERR=200)                                            
      DIMENSION IERCNT(MAXERR,2)                                        
      SAVE ILEVT,INUM,IERCNT                                            
                                                                        
C     ------BOSMDL                                                                                            
      LOGICAL       BEGJOB,ENDRUN,BEGRUN,REVENT,ENDJOB,OTHDAT           
      COMMON/BOSMDL/BEGJOB,ENDRUN,BEGRUN,REVENT,ENDJOB,OTHDAT,          
     +              LCCRUN,NCCRUN,NEVENT,                               
     +              IHA,IBS,IDB,IDATEL,LUP,ISN,JSN                      
      SAVE  /BOSMDL/                                                    
C     ------                                                                                                  
                                                                        
      DATA ILEVT/-1/,INUM/0/,IERCNT/MAXERR*0,MAXERR*0/                  
                                                                        
                                                                        
      CALL HCDIR('//PAWC/FFDBG',' ')                                                                   
                                                                        
      IF (NEVENT.NE.ILEVT) THEN                                         
         DO 100 II=1,INUM                                               
            VAL = IERCNT(II,1)                                          
            IF (VAL.GT.0.) CALL HFILL(10000+IERCNT(II,2),VAL,0.,1.)                                    
 100     CONTINUE                                                       
         ILEVT = NEVENT                                                 
         CALL VZERO(IERCNT,MAXERR)                                                                     
      ENDIF                                                             
                                                                        
      IMARK = 0                                                         
      DO 200 II=1,INUM                                                  
         IF (IERCNT(II,2).EQ.IERR) IMARK = II                           
 200  CONTINUE                                                          
                                                                        
      IF (IMARK.LE.0) THEN                                              
         IF (INUM.EQ.MAXERR) RETURN                                     
         INUM = INUM + 1                                                
         CALL HBOOK1(10000+IERR,'Error count',100,0.,1000.,0.)                                         
         IERCNT(INUM,1) = 1                                             
         IERCNT(INUM,2) = IERR                                          
      ELSE                                                              
         IERCNT(IMARK,1) = IERCNT(IMARK,1) + 1                          
      ENDIF                                                             
                                                                        
      CALL HCDIR('//PAWC',' ')                                                                         
                                                                        
      RETURN                                                            
      END                                                               
*