
387 So.2d 792 (1980)
Douglas BAGGETT
v.
J. O. SIMS.
79-440.
Supreme Court of Alabama.
August 22, 1980.
Clement J. Cartron of Cartron & Pearson, Huntsville, for appellant.
Charles L. Murphree of Caddell, Shanks, Harris, Moores & Murphree, Decatur, for appellee.
*793 FAULKNER, Justice.
This is an appeal from a judgment of the Circuit Court of Morgan County, denying Baggett's demand for a jury trial. We reverse and remand for a jury trial on the merits.
Sims filed a two-count complaint, on July 14, 1977, alleging $23,500.00 due by open account and $23,500.00 plus eight percent (8%) interest per annum for machinery and equipment allegedly sold and delivered on an oral contract. On August 12, 1977, Baggett served a motion to dismiss for failure to state facts upon which relief could be granted. This motion was overruled on September 13, granting Baggett twenty days in which to answer. On September 30, Baggett served a two-count compulsory counterclaim and an answer denying both counts of the complaint. A reply to the counterclaim was served October 17, denying both allegations. On November 15, within 30 days after the service of the reply to the counterclaim but more than 30 days after the service of the answer to the complaint, Baggett filed a "Motion Demanding Jury Trial." This motion was overruled on January 26, 1978.
After an ore tenus hearing, judgment was entered against Baggett for $27,260.00, and in favor of Sims on the counterclaim.
The primary issue for review is whether the trial judge erred in not granting Baggett a trial by jury, when the demand for one was filed within thirty days after the service of the reply to a compulsory counterclaim but more than thirty days after the service of the answer to the complaint. We hold that the jury trial was timely demanded and should have been granted with respect to all issues addressed in the complaint and compulsory counterclaim.
The first factual consideration is whether Baggett filed a timely demand for a jury trial, thereby falling within the prescription of Rule 38(b), ARCP; or, whether he filed a motion for a jury trial inducing the trial judge's discretion within Rule 39(b), ARCP. Rules 38(b) and 39(b) of the Alabama Rules of Civil Procedure state:
Rule 38(b): Demand. Any party may demand a trial by jury of any issue triable of right by a jury by serving upon the other parties a demand therefor in writing at any time after the commencement of the action and not later than 30 days after the service of the last pleading directed to such issue. Such demand may be indorsed upon a pleading of the party, and such demand shall be deemed to be a demand for a struck jury.
Rule 39(b): By the Court. Issues not demanded for trial by jury as provided in Rule 38 shall be tried by the court; but notwithstanding the failure of a party to demand a jury in an action in which such a demand might have been made of right, the court in its discretion upon motion may order a trial by jury of any or all issues.
It is clear from the language of the Rules, that Rule 39(b) is not invoked unless there has been a failure to comply with Rule 38. The court's discretion will be activated only when a motion has been made for a jury trial, and a motion will be made only when (a) a jury trial has not been demanded and the time within which to do so has expired; or, (b) the demand for the jury trial, though made, was untimely. In all other cases pertinent to a demand for a jury trial, the trial judge's discretion will not be invoked. Furthermore, the jury trial will be waived if not demanded according to Rule 38(b), and the case will be tried non-jury if the subsequent Rule 39(b) motion is overruled. Rules 38(b) and 39(b), ARCP.
We must ascertain whether Rule 38(b) has been complied with by determining whether the jury trial request was timely. Rule 38(b) provides that the demand must be made "not later than 30 days after the service of the last pleading to such issue." Baggett contends that the last pleading to such issue in this case is the reply to the compulsory counterclaim and that he complied with the time frame in Rule 38(b). Accordingly, he maintains that he should be granted a jury trial.
*794 Sims asserts that Baggett designated his jury trial request as a "motion" and that it should be treated as one, invoking the trial judge's discretion in Rule 39(b). Sims further asserts that, even if the motion is treated procedurally as a demand, it only encompasses those issues raised in the counterclaim and not those raised in the complaint because more than thirty days had passed since the service of the answer. Additionally, it is argued that with respect to those issues raised in the complaint, Baggett had filed a motion that was properly overruled within the judge's discretion. Indeed, it is claimed that for this court to overrule the judge's discretion would be tantamount to holding that the judge has no discretion at all.
Although Sims has made a very persuasive attempt to convince us that this case is controlled by the trial court's discretion in Rule 39(b), we find that substance over form controls this issue. Notwithstanding the fact that Baggett entitled his request "Motion Demanding Jury Trial," it is in all practical respects a demand for a jury trial in accordance with Rule 38(b) and not a motion under Rule 39(b), because of its timeliness. This brings us to the sub-issue of whether the demand was timely for a jury trial on the entire case, or only on those issues raised in the compulsory counterclaim.
This issue is squarely addressed in Moore's treatise on Federal Practice stating that although there are two different approaches to this question they both reach the same result; namely, that if the demand for a jury trial has timely been made after the reply to a compulsory counterclaim, the demand is good as to all issues addressed in the original complaint and in the compulsory counterclaim, except for those issues expressly excepted in the demand. 5 Moore's Federal Practice ¶ 38.39[2], at 314-318; (2nd ed. 1948). Rule 38(c), ARCP.
One line of reasoning states that if the demand is timely after the reply to a compulsory counterclaim, the trial court has the discretion to disregard the waiver of the jury trial on those issues raised in the answer and complaint if the demand was not made timely with respect to those pleadings. It is suggested that for ease and efficiency of judicial administration, the court should exercise its discretion in favor of permitting a jury trial on all issues, rather than limiting the jury trial to those issues raised in the compulsory counterclaim and requiring a non-jury trial on those issues raised in the answer and complaint. 5 Moore's, supra. It is anomalous to restrict a jury trial to those issues raised in the compulsory counterclaim-a transaction or occurrence that arises out of the subject matter of the opposing party's claim-and require a non-jury trial on the issues arising out of the original complaint.
The second, and we find preferable, line of reasoning holds that a timely demand after a reply to a compulsory counterclaim is timely as to all issues-including those raised in the complaint and answer-and the court's discretionary authority to disregard the waiver of a jury trial is not at issue even if the demand is tardy with respect to the answer. Because the answer and compulsory counterclaim are not wholly separate and distinct from each other, and because they both directly deal with the transaction or occurrence made the basis of the complaint, the issues are not actually determined until the service of the reply. 5 Moore's, supra. Therefore, applying this reasoning to the language in Rule 38(b), the "last pleading" for purposes of a timely jury demand is the reply to a compulsory counterclaim.
Contrary to the dicta in Ex Parte Marcrum, 372 So.2d 313 (Ala.1979), we find that there is a distinction on this issue depending upon whether the counterclaim is compulsory or permissive. When the counterclaim does not arise out of the transaction or occurrence that is the subject matter of the opposing party's claim, a timely jury demand after the reply, but dilatory with respect to the answer, will not revive the right to a jury trial on the issues raised in the complaint as it will with a compulsory counterclaim. 5 Moore's, supra at 318.
*795 We hold that if a demand for a jury trial is made within 30 days after the service of the reply to a compulsory counterclaim the demand is effective to compel a jury trial on all issues raised in the complaint, answer, compulsory counterclaim, and reply thereto. No judicial discretion is invoked; accordingly, the jury trial shall proceed unless otherwise abrogated by the parties or unless the issues raised are those as to which no jury trial would have been granted at law. On the basis of Rule 38(b), ARCP, we reverse and remand this case for a jury trial on the merits. All other issues raised by the parties in their briefs are pretermitted for review.
REVERSED AND REMANDED.
TORBERT, C. J., and ALMON, SHORES and EMBRY, JJ., concur.
