
247 Cal.App.2d 761 (1967)
ORANGE COUNTY MUNICIPAL WATER DISTRICT, Plaintiff and Appellant,
v.
ANAHEIM UNION WATER COMPANY, Defendant and Appellant.
Civ. Nos. 8057, 8086, 8206.
California Court of Appeals. 
Jan. 17, 1967.
 Winthrop O. Gordon for Plaintiff and Appellant.
 Wright & Finley, Dudley K. Wright and George Jeffries for Defendant and Appellant.
 BROWN (Gerald), P. J.
 In this condemnation action, plaintiff-condemner, Orange County Municipal Water District, appeals from a judgment awarding defendant its costs and trial preparation expenses. Defendant-condemnee, Anaheim Union Water Company, appeals from an order striking the award of trial preparation expenses, and from orders retaxing costs and taxing a supplemental cost bill.
 In July 1964, pretrial was set for October 16, 1964. On August 7, 1964, plaintiff served and filed a request for dismissal.
 On November 20, 1964, the trial court granted defendant's motion for judgment of dismissal and awarded defendant "... costs and disbursements which sum includes all necessary expenses incurred in preparation for trial. ..."; the judgment was entered November 23, 1964. Because time in which to appeal was expiring, on January 15, 1965, plaintiff filed a notice of appeal from the judgment. On February 4, 1965, the trial court granted plaintiff's motion to strike all costs other than attorney fees. Defendant appeals from this order and from an order of March 12, 1965, awarding attorney fees of $2,500, but denying necessary trial preparation expenses.
 On March 17, 1965, defendant filed a cost bill claiming attorney fees for the proceedings involving the first cost bill. The trial court, on April 20, 1965, granted plaintiff's motion to tax this cost bill. From this order defendant appeals.
 The appeals raise two questions:
 I. Whether trial preparation expenses are recoverable.
 Code of Civil Procedure, section 1255a provides: "a) The plaintiff may abandon the proceeding ... by serving on defendants and filing in court a written notice of abandonment; ... b) The court may, upon motion made within 30 days after such abandonment, set aside the abandonment if it *763 determines that the position of the moving party has been substantially changed to his detriment in justifiable reliance upon the proceeding and such party cannot be restored to substantially the same position as if the proceeding had not been commenced. c) ... [U]pon the expiration of the time for filing such a motion, on motion of any party, a judgment shall be entered dismissing the proceeding and awarding the defendants their costs and disbursements, which shall include all necessary expenses incurred in preparing for trial ... and reasonable attorney fees ... provided, however, ... that said costs and disbursements shall not include expenses incurred in preparing for trial where the action is dismissed 40 days or more prior to the time set for the pretrial conference. ..." [Italics added.]
 The statute specifically sets forth the method of abandoning a condemnation action: First there is notice of abandonment, served and filed, followed by a 30 day waiting period to allow the abandonment to be set aside by a party (undoubtedly a defendant) whose position has been detrimentally affected to a substantial degree by the condemnation action. Then, upon motion, a judgment is entered dismissing the action, allowing costs and disbursements, including all necessary trial preparation expenses. [1] The proviso which follows, forbidding trial preparation expenses "where the action is dismissed 40 days or more" before pretrial conference, contemplates, we believe, the judgment of dismissal referred to in the forepart of subdivision (c) of Code of Civil Procedure, section 1255a, italicized above. Unlike subdivisions (a) and (b) dealing with abandonment, subdivision (c) captioned "Judgment dismissing proceeding" treats the timing and consequences of a judgment entering dismissal, and therefore when the exclusionary provision of subdivision (c) refers to dismissing an action, it means dismissal by judgment.
 [2] We now look to the facts of this case. Plaintiff served and filed a request for dismissal August 7, 1964. We interpret this to mean a notice of abandonment. (Torrance Unified School Dist. v. Alwag, 145 Cal.App.2d 596, 599 [302 P.2d 881].)
 [3a] Judgment of dismissal was entered November 23, 1964. This was not 40 days or more before pretrial; instead it was 38 days after the date set for pretrial. The exclusionary provision, therefore, does not apply. Defendant should recover its trial preparation expenses necessarily incurred. *764
 [4] Necessarily incurred means, among other things, incurred before defendant is served with notice of abandonment. Once a defendant knows the action is abandoned and there will be no trial, he cannot reasonably continue to prepare for trial. [3b] Here, defendant should recover trial preparation expenses necessarily incurred before service on it of the August 7, 1964, notice of abandonment.
 Our holding is consistent with La Mesa-Spring Valley School Dist. v. Otsuka, 57 Cal.2d 309 [19 Cal.Rptr. 479, 369 P.2d 7], in which abandonment occurred and the judgment of dismissal was entered more than 40 days before trial.
 II. Whether attorney fees in opposing a motion to tax costs are recoverable in an abandoned condemnation action.
 Code of Civil Procedure, section 1255a, authorizes the recovery of reasonable attorney fees upon the abandonment and dismissal of a condemnation action. [5] As stated in Decoto School Dist. v. M. & S. Tile Co., 225 Cal.App.2d 310, 315 [37 Cal.Rptr. 225]: "Certainly, section 1255a contemplates that a defendant will take every reasonable and necessary step to establish such costs and disbursements and to protect his rights thereto. If, in so protecting his rights he must take an appeal, he should be reimbursed for the reasonable attorney fees incurred in connection therewith because such expense proximately and directly results from the plaintiff's action in abandoning the proceedings. Upon the same rationale he should be entitled to reasonable attorney fees in proceedings subsequent to the original motion to retax costs necessary to establish and perfect his rights to the costs and disbursements, including attorney fees, to which he is entitled under section 1255a."
 It was error to tax defendant's second cost bill.
 The judgment of November 23, 1964, is affirmed. The orders of February 4, 1965, March 12, 1965, and April 20, 1965, are reversed with directions to the trial court to determine necessary trial preparation expenses incurred before defendant was served with the August 7, 1964, notice of abandonment, including, but not confined to, appraisal and attorneys fees, and attorneys fees in opposing the motion to tax costs. Defendant to recover costs on appeal.
 Coughlin, J., and Whelan, J., concurred.
