anchor.diff:  !  V.K. Berglyd Olsen, BE-ABP-HSS
   !  Created: 2019-10-07
   !  Updated: 2019-10-07
  -!  Get name from collimator type ID
  -! ================================================================================================ !
  -character(len=9) function cdb_getTypeName(typID)
  +!  Get name from collimator stage ID
  +! ================================================================================================ !
  +character(len=9) function cdb_getStageName(typID)
   
     integer, intent(in) :: typID
   
     if(iand(typID,cdb_stgPrimary) == cdb_stgPrimary) then
  -    cdb_getTypeName = "PRIMARY"
  +    cdb_getStageName = "PRIMARY"
     elseif(iand(typID,cdb_stgSecondary) == cdb_stgSecondary) then
  -    cdb_getTypeName = "SECONDARY"
  +    cdb_getStageName = "SECONDARY"
     elseif(iand(typID,cdb_stgTertiary) == cdb_stgTertiary) then
  -    cdb_getTypeName = "TERTIARY"
  +    cdb_getStageName = "TERTIARY"
     elseif(iand(typID,cdb_stgOther) == cdb_stgOther) then
  -    cdb_getTypeName = "OTHER"
  +    cdb_getStageName = "OTHER"
     elseif(iand(typID,cdb_stgCrystal) == cdb_stgCrystal) then
  -    cdb_getTypeName = "CRYSTAL"
  +    cdb_getStageName = "CRYSTAL"
     else
  -    cdb_getTypeName = "UNKNOWN"
  -  end if
  -
  -end function cdb_getTypeName
  +    cdb_getStageName = "UNKNOWN"
  +  end if
  +
  +end function cdb_getStageName
   
   ! ================================================================================================ !
   !  V.K. Berglyd Olsen, BE-ABP-HSS
  
positive.code:   write(dbNew,"(a)") "# Families"
    do j=1,cdb_nFam
      write(dbNew,"(a,1x,a16,1x,f13.6,1x,a)") "NSIG_FAM",cdb_famName(j),&
        cdb_famNSig(j),trim(cdb_getTypeName(cdb_famStage(j)))
    end do
    write(dbNew,"(a)") "#"
    write(dbNew,"(a)") "# Collimators"
  
negative.code:   character(len=cdb_fNameLen) famName
    character(len=mNameLen) collDummy
    logical cErr, fExists
    integer j, dbUnit, ioStat, iLine, famID, matID, collStage
  
    cErr = .false.
  
  