A film is deposited on a substrate disposed in a substrate processing
chamber. The substrate has a trench formed between adjacent raised
surfaces. A first portion of the film is deposited over the substrate
from a first gaseous mixture flowed into the process chamber by
chemical-vapor deposition. Thereafter, the first portion is etched by
flowing an etchant gas having a halogen precursor, a hydrogen precursor,
and an oxygen precursor into the process chamber. Thereafter, a second
portion of the film is deposited over the substrate from a second gaseous
mixture flowed into the processing chamber by chemical-vapor deposition.