SUBROUTINE FKPRNT
*-- Author : S.Burke
      SUBROUTINE FKPRNT(NUM,ICODE)
**********************************************************************                                        
*                                                                    *                                        
* Print out an error report                                          *                                        
*                                                                    *                                        
**********************************************************************                                        
                                                                        
*KEEP,FKNPL.                                                                                                  
      CHARACTER*5 CKDBG                                                 
      PARAMETER (CKDBG='FKDBG')                                         
      PARAMETER (NPL=72)                                                
      LOGICAL LTRUE,LFIRST,LTRPL,LTRPLD                                 
      DOUBLE PRECISION TRUE,RTRUE,CHITRU,SPRO,CPRO,SFIL,CFIL            
     &,                SSMT,CSMT,SSMTR,CSMTR,DPRO,CBPRO,QPRO,QGAIN      
     &,                RPRO,CRPRO,RFIL,CRFIL,RSMT,CRSMT,CHIFIL,CHISMT   
*                                                                                                             
* Per-track values can go in H1WORK; note that LTRUE and LFIRST must                                          
* be set at least per event.                                                                                  
*                                                                                                             
* This is about 36k words long; the remaining common blocks are                                               
* about 3.6k in total. Some of this could be in /H1WORK/, but the                                             
* blocks would have to be reorganised.                                                                        
*                                                                                                             
      COMMON /H1WORK/                                                   
* /FKPROJ/                                                                                                    
     &                SPRO(5,NPL),CPRO(5,5,NPL)                         
* /FKFILT/                                                                                                    
     &,               SFIL(5,NPL),CFIL(5,5,NPL)                         
* /FKSMTH/                                                                                                    
     &,               SSMT(5,NPL),CSMT(5,5,NPL)                         
     &,               SSMTR(5,NPL),CSMTR(5,5,NPL)                       
* /FKINT/                                                                                                     
     &,               DPRO(5,5,NPL),CBPRO(5,5,NPL),QPRO(5,5,NPL)        
     &,               QGAIN(5,5,NPL),IAPROX,LFIRST                      
* /FKRSID/                                                                                                    
     &,               RPRO(2,NPL),CRPRO(2,2,NPL),RFIL(2,NPL)            
     &,               CRFIL(2,2,NPL),RSMT(2,NPL),CRSMT(2,2,NPL)         
     &,               CHIFIL(NPL),CHISMT(NPL)                           
* /FKTRUE/                                                                                                    
     &,               TRUE(5,NPL),RTRUE(5,NPL),CHITRU(NPL),LTRUE        
* /FKDBG/                                                                                                     
     &,               LTRPL(NPL),LTRPLD(NPL)                            
*KEEP,FKCNTL.                                                                                                 
      COMMON /FKCNTL/ LUN,IPR,ITR,IPL,JSTART,JSTOP,JLAST,JSTEP          
*KEEP,FKLERR.                                                                                                 
      PARAMETER(NROUT=20,NCODE=50)                                      
      COMMON /FKLERR/ NMERR(NCODE,NROUT),NUERR(NCODE,NROUT)             
     &,               NFAT,NERR,NOFL,NUFL,IULAST,IRLAST,MAXERR          
*KEND.                                                                                                        
                                                                        
**********************************************************************                                        
                                                                        
      CHARACTER*6 CMROUT(NROUT),CUROUT(NROUT),CROUT                     
                                                                        
      DATA CMROUT/'FKLFIT','FKLPRO','FKLFLT','FKLSMO','FKLRFL'          
     &,           'FKLWM ','FKLRSD','FKLPRS','FKLPAS','FKLFTR'          
     &,           'FKLSPR','FKLFXY','FKLSSM','FKLXY ','FKLXYZ'          
     &,           'FKLPAF','Unused','Unused','Unused','Unused'/         
                                                                        
      DATA CUROUT/'FKCOVR','FKCOVP','FKINV ','FKNORM','FKRST '          
     &,           'FKQG  ','FKLOOK','FKHUNT','FKCHPR','FKCHXY'
     &,           'FKCVXY','Unused','Unused','Unused','Unused'          
     &,           'Unused','Unused','Unused','Unused','Unused'/         
                                                                        
**********************************************************************                                        
                                                                        
      IF (IULAST.EQ.0) THEN                                             
         CROUT=CMROUT(IRLAST)                                           
      ELSE                                                              
         CROUT=CUROUT(IRLAST)                                           
      ENDIF                                                             
                                                                        
      IF (NUM.EQ.0) THEN                                                
         WRITE(LUN,*)                                                   
         WRITE(LUN,*) 'Routine ',CROUT                                  
         WRITE(LUN,*)                                                   
      ELSEIF (NUM.LT.0 .AND. ICODE.GT.100) THEN                         
         WRITE(LUN,1000) ICODE,CROUT,IPL,ITR,JSTEP                      
      ELSEIF (NUM.LT.0) THEN                                            
         WRITE(LUN,1100) ICODE,CROUT,IPL,ITR,JSTEP                      
      ELSE                                                              
         WRITE(LUN,1200) ICODE,NUM                                      
      ENDIF                                                             
                                                                        
 1000 FORMAT(' *** Fatal error ',I4,' in routine ',A6,                  
     &                ': Plane =',I3,' Track =',I10,' JSTEP =',I3)      
 1100 FORMAT('     Error       ',I4,' in routine ',A6,                  
     &                ': Plane =',I3,' Track =',I10,' JSTEP =',I3)      
 1200 FORMAT(' Count for error code ',I4,' =',I6)                       
                                                                        
      RETURN                                                            
      END                                                               
*