anchor.diff:        INTEGER(IntKi)                         :: ErrStatLcl                    ! Error status local to this routine.
   
         CHARACTER(20), ALLOCATABLE             :: Words       (:)               ! The array "words" parsed from the line.
  -
  +      CHARACTER(*), PARAMETER                :: RoutineName = 'ParseInAry'
  +
  +      ErrStat = ErrID_None
  +      ErrMsg  = ""
   
   
         ALLOCATE ( Words( AryLen ) , STAT=ErrStatLcl )
         IF ( ErrStatLcl /= 0 )  THEN
  -         CALL ExitThisRoutine ( ErrID_Fatal, NewLine//' >> Fatal error allocating memory for the Words array in ParseDbAry.' )
  +         CALL SetErrStat ( ErrID_Fatal, 'Fatal error allocating memory for the Words array.',ErrStat,ErrMsg,RoutineName )
  +         CALL Cleanup()
            RETURN
         ENDIF
   
   
  -      READ (FileInfo%Lines(LineNum),*,IOSTAT=ErrStatLcl)  DbAry
  +      READ (FileInfo%Lines(LineNum),*,IOSTAT=ErrStatLcl)  InAry
         IF ( ErrStatLcl /= 0 )  THEN
  -         CALL ExitThisRoutine ( ErrID_Fatal, NewLine//' >> A fatal error occurred when parsing data from "' &
  +         CALL SetErrStat ( ErrID_Fatal, 'A fatal error occurred when parsing data from "' &
                      //TRIM( FileInfo%FileList(FileInfo%FileIndx(LineNum)) )//'".'//NewLine//  &
  -                   ' >> The "'//TRIM( AryName )//'" array was not assigned valid REAL values on line #' &
  +                   ' >> The "'//TRIM( AryName )//'" array was not assigned valid INTEGER values on line #' &
                      //TRIM( Num2LStr( FileInfo%FileLine(LineNum) ) )//'.'//NewLine//' >> The text being parsed was :'//NewLine &
  -                   //'    "'//TRIM( FileInfo%Lines(LineNum) )//'"' )
  +                   //'    "'//TRIM( FileInfo%Lines(LineNum) )//'"',ErrStat,ErrMsg,RoutineName )
  +         CALL Cleanup()
            RETURN
         ENDIF
   
  
positive.code:       INTEGER(IntKi)                         :: NameIndx                      ! The index into the Words array that points to the variable name.
  
        CHARACTER(20)                          :: Words       (2)               ! The two "words" parsed from the line.
  
  
  
        CALL GetWords ( FileInfo%Lines(LineNum), Words, 2 )                     ! Read the first two words in Line.
        IF ( Words(2) == '' )  THEN
           CALL ExitThisRoutine ( ErrID_Fatal, NewLine//' >> A fatal error occurred when parsing data from "' &
                     //TRIM( FileInfo%FileList(FileInfo%FileIndx(LineNum)) )//'".'//NewLine//  &
                     ' >> The variable "'//TRIM( ExpVarName )//'" was not assigned valid string value on line #' &
                     //TRIM( Num2LStr( LineNum ) )//'.' )
           RETURN
        ENDIF
  
        CALL ChkParseData ( Words, ExpVarName, FileInfo%FileList(FileInfo%FileIndx(LineNum)) &
                          , FileInfo%FileLine(LineNum), NameIndx, ErrStatLcl, ErrMsg )
        IF ( ErrStatLcl /= 0 )  THEN
           CALL ExitThisRoutine ( ErrID_Fatal, ErrMsg )
           RETURN
        ENDIF
  
        ChVar = Words(3-NameIndx)
        IF ( ErrStatLcl /= 0 )  THEN
           CALL ExitThisRoutine ( ErrID_Fatal, NewLine//' >> A fatal error occurred when parsing data from "' &
                     //TRIM( FileInfo%FileList(FileInfo%FileIndx(LineNum)) )//'".'//NewLine//  &
                     ' >> The variable "'//TRIM( ExpVarName )//'" was not assigned valid REAL value on line #' &
                     //TRIM( Num2LStr( LineNum ) )//'.' )
           RETURN
        ENDIF
  
        IF ( PRESENT(UnEc) )  THEN
           IF ( UnEc > 0 )  WRITE (UnEc,'(1X,A15," = ",A20)')  Words
        END IF
  
        LineNum = LineNum + 1
  
        CALL ExitThisRoutine ( ErrID_None, ' ' )
  
        RETURN
  
     !=======================================================================
     CONTAINS
     !=======================================================================
        SUBROUTINE ExitThisRoutine ( ErrID, Msg )
  
           ! This subroutine cleans up the parent routine before exiting.
  
  
              ! Argument declarations.
  
           INTEGER(IntKi), INTENT(IN)       :: ErrID                            ! The error identifier (ErrLev)
  
           CHARACTER(*),   INTENT(IN)       :: Msg                              ! The error message (ErrMsg)
  
  
              ! Local declarations.
  
           LOGICAL                          :: IsOpen                           ! A flag that indicates if the input unit is still open.
  
  
              ! Set error status/message
  
           ErrStat = ErrID
           ErrMsg  = TRIM( Msg )//NewLine//' >> The text being parsed was :'//NewLine//'    "'//TRIM( FileInfo%Lines(LineNum) )//'"'
  
  
  
           RETURN
  
        END SUBROUTINE ExitThisRoutine ! ( ErrID, Msg )
  
     END SUBROUTINE ParseChVar ! ( FileInfo, LineNum, ExpVarName, ChVar, ErrStat, ErrMsg, UnEc )
  !=======================================================================
     SUBROUTINE ParseDbAry ( FileInfo, LineNum, AryName, DbAry, AryLen, ErrStat, ErrMsg, UnEc )
  
        ! This subroutine parses the specified line of text for AryLen REAL values.
        ! Generate an error message if the value is the wrong type.
  
  
           ! Arguments declarations.
  
        INTEGER, INTENT(IN)                    :: AryLen                        ! The length of the array to parse.
  
        REAL(DbKi), INTENT(OUT)                :: DbAry       (AryLen)          ! The double-precision REAL array to receive the input values.
  
        INTEGER(IntKi), INTENT(OUT)            :: ErrStat                       ! The error status.
        INTEGER(IntKi), INTENT(INOUT)          :: LineNum                       ! The number of the line to parse.
  
        INTEGER,        INTENT(IN), OPTIONAL   :: UnEc                          ! I/O unit for echo file. If present and > 0, write to UnEc.
  
        CHARACTER(*),   INTENT(In)             :: AryName                       ! The array name we are trying to fill.
        CHARACTER(*),   INTENT(OUT)            :: ErrMsg                        ! The error message, if ErrStat /= 0.
  
  
negative.code:    IF ( IOS /= 0 )  THEN
        Failed = .TRUE.
        ErrStat = ErrID_Fatal
        ErrMsg = 'OpenFUnkFile:Cannot open file "'//TRIM( OutFile )//'".  Another program like MS Excel may have locked it for writing.'
        IF ( FailAbt )  CALL ProgAbort ( TRIM(ErrMsg) )
     ELSE
        Failed = .FALSE.
  