FKLRSD COMMENTS
*-- Author : S.Burke / J.V. Morris
      SUBROUTINE FKLRSD(JPL,S,C,IFLAG,RES,CRES,CHI,IERR)
*-----------------------------------------Updates 24/01/92-------                                             
**: FKLRSD 30205.SB. Trap overflows.                                                                          
*-----------------------------------------Updates----------------                                             
**********************************************************************                                        
*                                                                    *                                        
* Calculate residuals and chi-squared                                *                                        
*                                                                    *                                        
* ERROR CONDITIONS;                                                  *                                        
*       IERR =   0 ; normal termination                              *                                        
*       IERR =   3 ; no measurement at this plane                    *                                        
*   ->  IERR = 112 ; CRES not positive definite                      *                                        
*                                                                    *                                        
*   ->  Fatal error                                                  *                                        
*                                                                    *                                        
**********************************************************************                                        
*KEEP,FKECODE.                                                                                                
*KEND.                                                                                                        
*                                                                                                             
* Common block definitions                                                                                    
*                                                                                                             
*KEEP,FKNPL.                                                                                                  
*                                                                                                             
* 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.                                                                        
*                                                                                                             
* /FKPROJ/                                                                                                    
* /FKFILT/                                                                                                    
* /FKSMTH/                                                                                                    
* /FKINT/                                                                                                     
* /FKRSID/                                                                                                    
* /FKTRUE/                                                                                                    
* /FKDBG/                                                                                                     
*KEEP,FKFLAG.                                                                                                 
*KEEP,FKMEAS.                                                                                                 
*KEND.                                                                                                        
**********************************************************************                                        
*                                                                                                             
* Local arrays ...                                                                                            
*                                                                                                             
**********************************************************************                                        
*                                                                                                             
* Initialisation and checks ...                                                                               
*                                                                                                             
         CALL VZERO(RES,4)                                                                             
         CALL VZERO(CRES,8)                                                                            
         CALL FKERR(IUTIL,IROUT,IWARN,IINF3,IERR)
**********************************************************************                                        
*                                                                                                             
* Calculate the residuals                                                                                     
*                                                                                                             
*                                                                                                             
* and the covariance                                                                                          
*                                                                                                             
C         SIGN=-1.D0                                                                                          
*                                                                                                             
* and the chi-squared                                                                                         
*                                                                                                             
         CALL FKERR(IUTIL,IROUT,IFATAL,IRCV,IERR)
         CALL FKERR(IUTIL,IROUT,IFATAL,IRCV,IERR)
*