If the defendant shall not bring into court the amount due, with costs, or if for any other cause a decree shall pass for the complainant, the court may direct a reference to a sheriff to ascertain and report the situation of the mortgaged premises, or may determine the same on oral or other testimony, and if it shall appear that the same can be sold in parcels, without injury to the parties, the decree shall direct so much of the mortgaged premises to be sold as will be sufficient to pay the amount then due on such mortgage, with costs, and such decree shall remain a security for any subsequent default.