
    Ex parte PARSONS & WHITTEMORE ALABAMA PINE CONSTRUCTION CORPORATION. (Re PARAGON BUILDERS, INC. v. PARSONS & WHITTEMORE ALABAMA PINE CONSTRUCTION CORPORATION).
    1931421.
    Supreme Court of Alabama.
    March 3, 1995.
    
      Michael L. Edwards and David B. Block of Balch & Bingham, Birmingham, for petitioner.
    E. Mabry Rogers and John J. Park, Jr. of Bradley, Arant, Rose & White, Birmingham, for respondent.
   MADDOX, Justice.

This petition for a writ of mandamus relates to an action pending in the Jefferson County Circuit Court. The petition presents two questions: first, whether Jefferson County is a proper venue for an action involving claims arising out of a construction project at a wood pulp processing plant in Monroe County; and second, whether the pendency of a prior declaratory judgment action in Monroe County involving the same parties in the Jefferson County action requires that this Jefferson County action be dismissed. The petitioner seeks a writ of mandamus directing the Jefferson Circuit Court to dismiss the action pending there.

We hold 1) that Jefferson County is not a proper venue for this action, and 2) that the declaratory judgment action pending in Monroe County is a prior pending action within the meaning of § 6-5-440, Ala.Code 1975, and that the Jefferson County action is barred. We therefore grant the writ.

In 1990, Parsons and Whittemore Alabama Pine Construction Corporation (hereinafter called “P & W”), a Delaware corporation, entered into a contract with B.L. Montague Company (“Montague”), under which Montague undertook to design and construct a chip conveyor system for the woodyard at P &Ws mill in Claiborne, Alabama. The contract between P & W and Montague provided that any disputes or claims between the parties would be arbitrated in Birmingham, Alabama.

Montague subsequently entered into a subcontract with Paragon Builders, Inc. (“Paragon”), under which Paragon undertook to assemble the structural steel and other components of the chip conveyor system according to the design furnished by Montague. Paragon and Montague’s subcontract also contained an arbitration provision.

Various problems and delays arose during the construction of the chip conveyor, and Paragon gave notice to Montague of its complaints and of the additional costs that could be incurred; Montague notified P & W of these complaints. After construction was completed, Paragon submitted claims to Montague, seeking to recover the excess costs it had incurred. Montague submitted these claims to P <& W, but both Montague and P & W denied responsibility for the excess costs. Paragon then demanded arbitration with Montague under the provisions of its contract, and Montague, in turn, sought arbitration with P & W, claiming indemnity for the damages claimed by Paragon. The American Arbitration Association (“AAA”) granted a request by Montague to consolidate the two arbitration proceedings, which were then set to take place in May 1994 in the eity of Birmingham. P & W retained a Birmingham law firm to represent it in the arbitration proceedings.

In January 1994 Montague informed all parties and the AAA that it was going out of business and that it would not participate in the arbitration. Paragon and Montague then entered into a “pass-through” agreement under which Montague permitted Paragon to proceed against P & W in Montague’s name. Counsel for P & W then asked the AAA to dismiss P & W from the proceedings, on the grounds that P & W had no arbitration agreement with Paragon. The AAA denied this request, but did agree to limit the arbitration proceeding to only those portions of Paragon’s claims that Montague could have presented to P & W.

On April 20, 1994, P & W sued in the Circuit Court of Monroe County, seeking in-junctive relief and a judgment declaring that it was not obligated to arbitrate with Paragon and that the pass-through agreement violated the P & W-Montague contract. The Monroe County Circuit Court entered a preliminary injunction in favor of P & W on May 12, 1994, barring Paragon from proceeding against P & W in Montague’s name. Paragon subsequently undid the “pass-through” agreement with Montague and proceeded against Montague alone in the May 1994 arbitration; the arbitration board awarded Paragon damages from Montague for its claim.

On April 21, 1994, (the day after the Monroe County action was filed) Paragon filed an action against P & W in the Circuit Court of Jefferson County; that action sought monetary damages for its excess costs. P & W moved to dismiss the Jefferson County action, or, in the alternative, to transfer it to Monroe County, which P & W claimed was the proper venue. The trial judge refused P & W’s motion, stating in its order:

“Both parties had voluntarily agreed to arbitration and to venue (as to said arbitration) in Jefferson County. This agreement to arbitrate concerned disputes that had arisen prior to the filing of the subject action and, further, said agreement was to be in lieu of litigation.
“Prom a review of submitted materials, it appears defendant P & W was not pleased with the tentative findings of the arbitrators. Whereupon, the defendant went to Monroe County to file suit. That suit was preceded by this suit by 24 hours. [The record indicates that this last statement is incorrect; this fact is discussed later in this opinion.]
“It is readily discernible that when arbitration appeared not to favor the defendant, defendant has attempted to disregard its agreement to resolve disputes in Jefferson County. Hence, there appears to have been a race to the courthouse.
“For all the reasons shown above, and in order that there not be even the appearance of ‘forum shopping’, defendant’s motion is denied (i.e., dismissal is denied and change of venue is denied).”

In its petition for a writ of mandamus, P & W first argues that Jefferson County was not a proper venue for Paragon’s action because P & W did no business there and had no registered agent there when Paragon’s action was filed. In addition, P & W argues that its filing of the declaratory judgment action in Monroe County barred Paragon’s Jefferson County action, because the Monroe County proceeding was a prior pending action within the provisions of § 6-5-440, Ala.Code, 1975. We agree with P & W on both points.

A writ of mandamus is a drastic and extraordinary writ, to be issued only where there is (1) a clear legal right in the petitioner to the order sought; (2) an imper-atíve duty upon the respondent to perform, accompanied by a refusal to do so; (3) the lack of another adequate remedy; and (4) properly invoked jurisdiction of the court. Ex parte Alfab, Inc., 586 So.2d 889 (Ala. 1991). Where, as here, the exercise of an inferior court’s discretion is involved, the writ of mandamus may be issued only to compel the exercise of its discretion; it may not be issued to control or review the exercise of discretion except where an abuse of discretion is shown. Ex parte Ford Motor Credit Co., 561 So.2d 244 (Ala.Civ.App.1990), citing, Ex parte Auto Owners Ins. Co., 548 So.2d 1029 (Ala.1989).

When determining proper venue of an action against a foreign corporation, the only issues for the trial court to decide are: 1) whether the corporation was doing business by agent in the forum county at the time the action was filed, Ex parte Charter Retreat Hospital, 538 So.2d 787, 789 (Ala.1989), and 2) whether the trial court has sufficient facts before it to ascertain the proper venue of the action. Ex parte Alpine Bay, 518 So.2d 113, 114 (Ala.1987).

If the county where the action was filed is not a proper venue, then the trial court errs when it refuses to transfer the case to the proper venue. Ex parte Ralston, 519 So.2d 488-89, 490 (Ala.1987); Ex parte Wilson, 408 So.2d 94, 97 (Ala.1981).

Under the provisions of § 6-3-7, Ala. Code 1975, a foreign corporation may be sued in any county in which it does business by agent. In determining whether venue of an action against a corporation is proper in the county where the action was filed, the definitive question is whether the corporation is doing business in that county. Ex parte Alpine Bay, 518 So.2d at 114. A corporation does “business by agent” in a county if, with some regularity, it performs there some of the business functions for which it was created. Ex parte SouthTrust Bank, 619 So.2d 1356, 1358 (Ala.1993).

We conclude that the trial court erred in determining that venue was proper in Jefferson County. P & W, as the movant, met its burden of proving that venue was improper in Jefferson County. It produced evidence that its only place of business was in Claiborne, Alabama, and that its sole business function was to manage construction projects at the wood pulp processing plant located there. P & W also produced evidence that it had never conducted business in Jefferson County or stored materials there. On the other hand, Paragon contends that venue is proper in Jefferson County because P & W had agreed under the terms of its contract with Montague to arbitrate any dispute in Birmingham. Paragon also contends that P & W retained a Birmingham law firm to represent it in the arbitration proceedings, and that this action constitutes “doing business” in Birmingham (and thereby in Jefferson County). We disagree with both of Paragon’s contentions.

As stated earlier, a corporation does “business by agent” in a county if, with some regularity, it performs there some of the business functions for which it was created. We find that P & W’s retention of Birmingham lawyers to represent its interests in the arbitration proceedings does not constitute doing business by agent in Jefferson for the purposes of venue. This Court has previously held that prosecuting or defending lawsuits in the courts of a particular county does not constitute doing business in that county. See Southern Guardian Life Insurance Co. v. Freeman, 283 Ala. 429, 218 So.2d 143 (1969). Additionally, this Court has held that hiring attorneys in private practice on a case-by-case basis, involving the giving of legal advice and the rendering of legal services generally, does not constitute “doing business by agent” as contemplated by § 6-3-7. See Ex parte Real Estate Financing, Inc., 450 So.2d 461, 463 (Ala.1984). After careful consideration, we can find no reason in the record before us or in the law of this state to treat hiring attorneys for an arbitration proceeding any differently.

Additionally, we find no merit in Paragon’s contention that P & W’s agreement with Montague to arbitrate in Birmingham is sufficient to find that P & W is “doing business” in Jefferson County for the purposes of venue. We conclude that P & W’s agreement to arbitrate in Birmingham should not be considered “doing business” in Jefferson County, because the agreement to arbitrate was incidental, at best, to P & W’s business purpose — the management and supervision of construction projects at its Claiborne plant. Also, we note that even if P & W should be found to have had an agreement to arbitrate with Paragon in Jefferson County, such an agreement could not be considered an agreement on P & W’s part to be sued in Jefferson County. As P & W correctly points out, under § 6-3-1, Ala.Code 1975, parties cannot make agreements regarding venue that alter or change the provisions of the law regarding venue. Ex parte Bailey, 410 So.2d 402, 403 (Ala.1982).

The next issue which we must address is whether P & W’s Monroe County action seeking a declaratory judgment and injunc-tive relief operates as a prior pending action to Paragon’s action for money damages filed in Jefferson County, within the meaning of § 6-5-440, Ala.Code 1975. In arguing that it does, P & W cites Penick v. Cado Systems of Central Alabama, 628 So.2d 598, 599-601 (Ala.1993), wherein this Court held that § 6-5-440 barred a subsequent action asserting claims that should have been, but were not, presented as compulsory counterclaims in an action already pending between the two parties. P & W argues that Paragon’s claims in its Jefferson County action are, in fact, compulsory counterclaims that must be filed in P & W’s action in Monroe County, and therefore must be dismissed or transferred.

To determine whether a counterclaim is compulsory, we must begin with an examination of Rule 13(a), Ala.R.Civ.P., which provides, in pertinent part, as follows:

“(a) Compulsory Counterclaims. A pleading shall state as a counterclaim any claim which at the time of serving the pleading the pleader has against any opposing party, if it arises out of the transaction or occurrence that is the subject matter of the opposing party’s claim and does not require for its adjudication the presence of third parties of whom the court cannot acquire jurisdiction.... ”

Committee Comments to that rule contain the following pertinent statements:

“The purpose of this provision is to avoid circuity of actions, and to require assertion as counterclaims of those claims which are likely to turn on the same facts as the original claim. A counterclaim is compulsory if there is any logical relation of any sort between the original claim and the counterclaim.”

(Citations omitted; emphasis added.) We have consistently applied the “logical relationship” test suggested in these Committee Comments to determine what is and what is not a compulsory counterclaim. See Ex parte Canal Insurance Co., 534 So.2d 582 (Ala.1988); and Brooks v. Peoples National Bank of Huntsville, 414 So.2d 917 (Ala.1982); see, also, O’Donohue v. Citizens Bank, 350 So.2d 1049 (Ala.Civ.App.1977).

“[Claims are logically related] to the opposing party’s claim where separate trials on each of their respective claims would involve a substantial duplication of effort and time by the parties and the courts. Where multiple claims involve many of the same factual issues, or the same factual and legal issues, or where they are offshoots of the same basic controversy between the parties, fairness and considerations of convenience and of economy require that the counterclaimant be permitted to maintain his cause of action. Indeed the doctrine of res judicata compels the counterclaimant to assert his claim in the same suit for it would be barred if asserted separately, subsequently.”

Mississippi Valley Title Ins. Co. v. Hardy, 541 So.2d 1057, 1059-60 (Ala.1989). (Citations omitted.)

While we have not defined the terms “transaction” and “occurrence” in Rule 13(a), the Missouri Supreme Court has defined “transaction” in its Rule 55.32(a), which is identical to our Rule 13(a). In Myers v. Clayco State Bank, 687 S.W.2d 256, 260-61 (Mo.App.1985), quoting Cantrell v. City of Caruthersville, 359 Mo. 282, 221 S.W.2d 471 (1949), that court wrote:

“Transaction imports a pliable meaning and may encompass a series of occurrences, and depends in application, not so much upon the immediacy of connection, as upon logical relationship. Claim [of either the original pleader or of the counterpleader] refers not the form of the action, but ‘to the underlying facts combined with the law giving a party a right to a remedy of one form or another based on the claim.’ Subject matter of the claim does not equate merely with the cause of action, nor the object of the action, but rather ... describes the composite of ‘physical facts, the things real or personal, the money, lands, chattels, and the like, in relation to which the suit is prosecuted.’ ... Thus, the term transaction extends to include ... ‘all of the facts and circumstances which constitute the foundation of a claim’ [and] ... ‘all the facts and circumstances out of which the injury complained of arose.’

(Citations omitted; emphasis in Myers.) This definition is consistent with our “logical relationship” test and the purpose of Rule 13(a); we have noted that “[t]he rule on compulsory counterclaims should receive a ‘broad realistic interpretation in light of the interest of avoiding a multiplicity of suits.’ ” Mississippi Valley Title Ins. Co. v. Hardy, 541 So .2d at 1060.

Under our “logical relationship” test, we conclude that Paragon’s claims in its Jefferson County action are, in fact, compulsory counterclaims subject to § 6-5-440, Ala.Code 1975, and thus are due to be either dismissed or transferred under that section. The Monroe County action and the Jefferson County action deal with different facets of a central question: whether P & W is liable in any way to Paragon for costs incurred during the construction of the chip processing system. P & W contends in the Monroe County action that it has no privity or contractual relationship with Paragon and is thus not liable for any loss Paragon may have incurred. Additionally, it appears that Paragon’s answer to P & W’s Monroe County complaint contains, as affirmative defenses, charges that P & W was guilty of negligence and breach of contract in regard to its agreement with Montague; these charges are similar to the claims made by Paragon in its Jefferson County action.

Paragon claims that § 6-5-440 applies only to a party acting as the plaintiff in two different actions; that claim is without merit. This Court held in Penick v. Cado Systems of Central Alabama, Inc., 628 So.2d 598 (Ala.1993), that § 6-5-140 also acts to bar a subsequent action by a party who first appeared as the defendant in a prior action. Accordingly, we hold that, for purposes of the Jefferson County action, the Monroe County action is a prior pending action under § 6-5-440, Ala.Code 1975, and thus bars the Jefferson County action. See Ex parte Canal Ins. Co., 534 So.2d 582 (Ala.1988).

Paragon contends, however, that its Jefferson County action should be given priority because P & W’s filing in Monroe County was based on a “race to the courthouse”; it says that P & W’s declaratory judgment action was “preemptive” and was part of an attempt to secure a chosen forum. It is evident from the order of the Jefferson County judge that he thought so as well. We cannot agree with this contention. It is undisputed that the wood processing plant where P & W does business by agent is located in Monroe County; additionally, the construction that is the subject of these two lawsuits took place there. We cannot hold that P & W acted improperly by suing in Monroe County.

We have reviewed the submitted materials, and we find that, contrary to the trial judge’s finding, P & Ws filing in Monroe County preceded the Jefferson County filing by one day—not the other way around. The trial judge’s assertion that “[b]oth parties had voluntarily agreed to arbitration ... in Jefferson County,” although correct, does not mention that these parties had agreed to arbitrate with Montague, and not directly with each other. Additionally, it appears that P & Ws quarrel with the arbitrators was not over their findings, but over the fact that, after Montague’s withdrawal from the proceedings, P & W was being forced to arbitrate with Paragon, a company with which P & W claims to have had no privity or contractual relationship.

Based upon the facts and circumstances of this case, and the applicable law, we conclude that the trial judge abused his discretion in refusing to transfer or dismiss Paragon’s Jefferson County action. We, therefore, grant the petition for the writ of mandamus and direct the trial judge either to dismiss the Jefferson County action, or, in the alternative, to transfer it to Monroe County.

WRIT GRANTED.

SHORES, HOUSTON, KENNEDY, INGRAM and COOK, JJ., concur.  