
379 N.W.2d 914 (1986)
Phyllis SMITH and Gordon Smith, Appellants,
v.
Thomas C. LALLY, Farida Sheikh Rajput, and the Finley Hospital, Appellees.
No. 85-387.
Supreme Court of Iowa.
January 15, 1986.
Corliss C. Baty, Maquoketa, for appellants.
Robert V.P. Waterman and Thomas D. Waterman, of Lane & Waterman, Davenport, for appellee Thomas C. Lally.
Peter C. Fieweger, of Katz, McAndrews, Durkee, Balch & Lefstein, P.C., Rock Island, Illinois, for appellee Farida Sheikh Rajput.
*915 Brendan T. Quann, of O'Connor & Thomas, P.C., Dubuque, for appellee Finley Hosp.
Considered by UHLENHOPP, P.J., and HARRIS, McCORMICK, McGIVERIN and SCHULTZ, JJ.
McCORMICK, Justice
Plaintiffs filed the same medical malpractice action against defendants on three occasions. They voluntarily dismissed the first two actions. Later they were unsuccessful in seeking to have the second dismissal modified or vacated. Summary judgment was subsequently entered against plaintiffs in the third action based on the preclusive effect of the second dismissal. Plaintiffs appeal from the order refusing to modify or vacate their second dismissal and the order dismissing their third action. We affirm the orders in each case.
This appeal involves the application of Iowa Rule of Civil Procedure 215. In relevant part, the rule provides:
A party may, without order of court, dismiss his own petition ... at any time before trial has begun, subject to the provisions of rule 138.1.... A dismissal under this rule shall be without prejudice unless otherwise stated; but if made by any party who has previously dismissed an action against the same defendant, in any court of any state or of the United States, including or based on the same cause, such dismissal shall operate as an adjudication against him on the merits, unless otherwise ordered by the court, in the interests of justice.
The parties agree that plaintiffs' first dismissal was without prejudice pursuant to this rule. The dispute concerns the second dismissal. Although the second dismissal was characterized by plaintiffs as without prejudice, they did not obtain an order of the court authorizing such a dismissal "in the interests of justice."
Plaintiffs' actions were based on injuries allegedly suffered by Phyllis Smith from radiation therapy by defendants Lally and Rajput at the defendant hospital in Dubuque in early 1982. The first action was brought in September 1984 in Johnson County. Defendants moved for change of venue pursuant to Iowa Rule of Civil Procedure 175 on the ground that the action was based on conduct in Dubuque County and none of the defendants resided in Johnson County. Before the motion was ruled on, plaintiffs filed the action in Scott County and filed a dismissal of their Johnson County action without prejudice. Defendants filed a motion for change of venue in the Scott County action, alleging none of the defendants resided there. Plaintiffs then filed the action in Dubuque County. Before the court in Scott County ruled on the change of venue motion, plaintiffs filed their voluntary dismissal of the Scott County action. They recited in the dismissal that it was without prejudice but had not sought or obtained a court order determining the dismissal was not an adjudication on the merits.
Defendants filed a motion for summary judgment in the Dubuque County action, alleging the second dismissal operated as an adjudication on the merits that precluded plaintiffs' claim. Plaintiffs filed an application in Scott County asking that their second dismissal be found to be without prejudice or, alternatively, that the dismissal be vacated. This application was denied. Subsequently the motion for summary judgment was granted. Plaintiffs took timely appeals from the two rulings.
Plaintiffs seek to avoid the application of rule 215 on two grounds. First they contend the rule is inapplicable because their dismissals were preceded in each instance by filing a new action in a different venue. Secondly they contend the district court in Scott County erred in holding it lacked authority to modify or vacate the second dismissal.
I. Applicability of rule 215. Plaintiffs allege that their claim remained viable despite their two dismissals because the claim was the subject of a separate pending action each time an action was dismissed. They assert that their purpose *916 was merely "to locate the proper venue and in so doing clear the dockets in the counties where venue did not lie." Under this approach plaintiffs could have filed actions in all ninety-nine counties and dismissed ninety-eight of them without prejudice, despite the language of rule 215. Nothing in rule 215 suggests that the existence of a separate pending action makes any difference in its operation.
Moreover, the purpose of rule 215 is antithetical to plaintiffs' argument. The purpose of the rule is to prevent indiscriminate dismissals of actions by litigants. See 3 Iowa Rules of Procedure Annotated 271 (3d ed. 1970). Repeated filings and dismissals obviously have a harassing effect that the two-dismissal rule is designed to prevent.
We find no merit in plaintiffs' contention that rule 215 did not apply in this case.
II. Authority of the district court in Scott County. Plaintiffs separately contend that the district court in Scott County erred in holding it lacked authority to modify or vacate plaintiffs' dismissal of their action in that county. Their problem is with their second dismissal because under rule 215 a second voluntary dismissal operates as an adjudication on the merits "unless otherwise ordered by the court, in the interests of justice."
In refusing to modify the dismissal, the court in Scott County reasoned that the dismissal deprived the court of jurisdiction to enter a subsequent order determining in the interests of justice that the dismissal would not constitute an adjudication against plaintiffs on the merits. The court found that such a determination could only be made before or contemporaneously with the dismissal.
We believe the court was correct. Rule 215 gives a plaintiff a right to dismiss an action at any time before the beginning of trial. When any defense pleadings are solely defensive, the dismissal terminates the court's jurisdiction of the action. See Witt Mechanical Contractors, Inc. v. United Brotherhood of Carpenters, 237 N.W.2d 450, 451 (Iowa 1976). Thus plaintiffs' dismissal of their action in Scott County was absolute and deprived the court of jurisdiction of the case.
In refusing the alternative request to vacate the dismissal, the district court examined the provisions of Iowa Rule of Civil Procedure 252 and found no ground applicable in the circumstances alleged by plaintiffs. Rule 252 gives the court jurisdiction to entertain a direct attack on a final adjudication on certain enumerated grounds by petition filed in the original action. See, e.g., Forsmark v. State, 349 N.W.2d 763, 766-67 (Iowa 1984). Plaintiffs do not now rely on rule 252.
They contend, nevertheless, that the court had authority to rule on their application and reinstate the case in an exercise of discretion, citing Pilcher Hardware Company v. Clark, 218 Iowa 150, 253 N.W. 907 (1934). The Pilcher case involved dismissal of an action by a lawyer after he had been discharged by the plaintiff. The case antedated the rules of civil procedure and has no applicability here. We have no occasion to determine whether the ground for vacating the dismissal in Pilcher is now available under rule 252.
Plaintiffs also rely on Engelhardt v. Bell & Howell Company, 299 F.2d 480 (8th Cir.1962), a case decided under Federal Rule of Civil Procedure 41, on which rule 215 is based. The court in Engelhardt recognized that a litigant's dismissal of his second action was an adjudication on the merits in bar of a third suit. The court held that the adjudication could not be collaterally attacked. Id. at 484. In language relied on by plaintiffs, the court said, "The appropriate remedy here was to move to set aside or vacate the dismissal of the second action." Id. This statement merely confirms that if an adjudication is not subject to collateral attack, it must be attacked directly. Plaintiffs' problem is that they did not establish any ground under the Iowa Rules of Civil Procedure to support either a collateral or direct attack on the Scott County adjudication.
We affirm on both appeals.
AFFIRMED.
