anchor.diff:    write(dbNew,"(1a,a47,1x,a16,1x,a10,1x,a4,5(1x,a13))") "#",chr_rPad(" name",47),chr_rPad("family",16),&
       "opening","mat.","length[m]","angle[rad]","offset[m]","beta_x[m]","beta_y[m]"
     do j=1,cdb_nColl
  -    write(dbNew,"(a48,1x,a16,1x,f10.3,1x,a4,5(1x,f13.6))") cdb_cName(j),"default         ",cdb_cNSig(j),cdb_cMaterial(j),&
  +    call cdb_generateFamName(cdb_cName(j),famName)
  +    write(dbNew,"(a48,1x,a16,1x,f10.3,1x,a4,5(1x,f13.6))") cdb_cName(j),famName,cdb_cNSig(j),cdb_cMaterial(j),&
         cdb_cLength(j),cdb_cRotation(j),cdb_cOffset(j),cdb_cBx(j),cdb_cBy(j)
     end do
   
  
positive.code:   use mod_units
  
    character(len=mInputLn) inLine
    logical cErr
    integer j, dbUnit, dbNew, ioStat, iLine
  
  
negative.code: !  V.K. Berglyd Olsen, BE-ABP-HSS
  !  Updated: 2019-03-20
  ! ================================================================================================ !
  subroutine cdb_generateFamName(inElem, famName)
  
    use string_tools
    use numerical_constants
  
    character(len=mNameLen),     intent(in)  :: inElem
    character(len=cdb_fNameLen), intent(out) :: famName
  
    character(len=mNameLen) elemName
  
    famName  = " "
    elemName = chr_toLower(inElem)
    if(elemName(1:3) == "tcp") then
      if(elemName(7:9) == "3.b") then
        famName = "tcp3"
      else
        famName = "tcp7"
      end if
    else if(elemName(1:4) == "tcsg") then
      if(elemName(8:10) == "3.b" .or. elemName(9:11) == "3.b") then
        famName = "tcsg3"
      else
        famName = "tcsg7"
      end if
      if(elemName(5:6) == ".4" .and. elemName(8:9) == "6.") then
        famName = "tcstcdq"
      end if
    else if(elemName(1:4) == "tcsp") then
      if(elemName(9:11) == "6.b") then
        famName = "tcstcdq"
      end if
    else if(elemName(1:4) == "tcsm") then
      if(elemName(8:10) == "3.b" .or. elemName(9:11) == "3.b") then
        famName = "tcsm3"
      else
        famName = "tcsm7"
      end if
    else if(elemName(1:4) == "tcla") then
      if(elemName(9:11) == "7.b") then
        famName = "tcla7"
      else
        famName = "tcla3"
      endif
    else if(elemName(1:4) == "tcdq") then
      famName = "tcdq"
    else if(elemName(1:4) == "tcth" .or. elemName(1:5) == "tctph") then
      if(elemName(8:8) == "1" .or. elemName(9:9) == "1" ) then
        famName = "tcth1"
      else if(elemName(8:8) == "2" .or. elemName(9:9) == "2") then
        famName = "tcth2"
      else if(elemName(8:8) == "5" .or. elemName(9:9) == "5") then
        famName = "tcth5"
      else if(elemName(8:8) == "8" .or. elemName(9:9) == "8") then
        famName = "tcth8"
      end if
    else if(elemName(1:4) == "tctv" .or. elemName(1:5) == "tctpv") then
      if(elemName(8:8) == "1" .or. elemName(9:9) == "1") then
        famName = "tctv1"
      else if(elemName(8:8) == "2" .or. elemName(9:9) == "2") then
        famName = "tctv2"
      else if(elemName(8:8) == "5" .or. elemName(9:9) == "5") then
        famName = "tctv5"
      else if(elemName(8:8) == "8" .or. elemName(9:9) == "8") then
        famName = "tctv8"
      end if
    else if(elemName(1:3) == "tdi") then
      famName = "tdi"
    else if(elemName(1:4) == "tclp" .or. elemName(1:4) == "tcl." .or. elemName(1:4) == "tclx") then
      famName = "tclp"
    else if(elemName(1:4) == "tcli") then
      famName = "tcli"
    else if(elemName(1:4) == "tcxr") then
      famName = "tcxrp"
    else if(elemName(1:5) == "tcryo" .or. elemName(1:5) == "tcld.") then
      famName = "tcryo"
    else if(elemName(1:3) == "col") then
      if(elemName == "colm" .or. elemName(1:5) == "colh0") then
        famName = "tcth1"
      elseif(elemName(1:5) == "colv0") then
        famName = "tcth2"
      else if(elemName(1:5) == "colh1") then
        famName = "tcth5"
      else if(elemName(1:5) == "colv1") then
        famName = "tcth8"
      else if(elemName(1:5) == "colh2") then
        famName = "tctv1"
      end if
    else
      famName = "default"
    end if
  
  end subroutine cdb_generateFamName
  