C
C**************************
C**     LFN_REFN_ERR     **
C**************************

C
CD-Routine: Log Automatic Refinement Errors - LFN_REFN_ERR
C This routine is used to log errors from the automatic refinement
C procedure of the routine LFN_AUTO_REFN. If used, it is passed as the
C user supplied LOG_ERR subroutine which is one of the LFN_AUTO_REFN
C parameters an must be declared as external. This version of the error 
C handling routine treats all errors as ones which will terminate the 
C automatic refinement procedure.
CD-end
CD-Fortran:
      SUBROUTINE LFN_REFN_ERR (IUN_LOG, ICONT, ERRSTR, ERRSTR2,
     +                         NEXT)
CD-end
      INCLUDE 'implicit_none.finc'
C
C Purpose: Log automatic refinement errors
C
C Author:  John W. Campbell, October 1994
C
C Arguments:
C
      INTEGER IUN_LOG
      INTEGER ICONT
      CHARACTER*(*) ERRSTR
      CHARACTER*(*) ERRSTR2
      LOGICAL NEXT
C
CD-Parameters:
C IUN_LOG     i  (R)  Unit number for log file                        
C ICONT       i  (R)  = 0 treat as error which terminates refinent
C                     = 1 may continue with next plate if desired
C                     = 2 may continue with next pack if required
C                     =-1 interrupted
C ERRSTR      c  (R)  Error string (max 80 chars)
C ERRSTR2     c  (R)  Subsidiary error string - may be blank (max 80
C                     chars)
C NEXT        l  (W)  Set by the routine. If .true. then refinement will
C                     be continued with next pack or plate. If .false. 
C                     then refinement will be terminated. Note: the 
C                     routine must set it to .false. ICONT is 0 or -1.
CD-end
C
C====== Parameter statements
C 

C
C====== GLOBALS:
C

C
C====== FUNCTION TYPES:
C
      INTEGER LENSTR
C
C====== LOCALS:
C

C
C-------------------------------------------------------------------------------
C
C====== Output information
C
      WRITE (IUN_LOG, 1000) ERRSTR(1:LENSTR(ERRSTR))
      WRITE (IUN_LOG, 1000) ERRSTR2(1:LENSTR(ERRSTR2))
      NEXT = .FALSE.
      RETURN
C
C====== Format statements
C
 1000 FORMAT (A)
      END
