
374 N.W.2d 670 (1985)
Charles ELLIOTT, Appellant,
v.
IOWA DEPARTMENT OF PUBLIC SAFETY; Iowa Department of Transportation; and State of Iowa, Appellees.
No. 84-1193.
Supreme Court of Iowa.
October 16, 1985.
Ronald A. Baybayan, Des Moines, for appellant.
Thomas J. Miller, Atty. Gen., and David A. Ferree, Asst. Atty. Gen., Ames, for appellees.
Considered by REYNOLDSON, C.J., and UHLENHOPP, McCORMICK, McGIVERIN and SCHULTZ, JJ.
McGIVERIN, Justice.
Plaintiff Charles Elliott brought this declaratory judgment action to obtain a ruling on whether he was eligible to continue receiving longevity pay, to which he had been previously entitled as a highway patrol officer, after he transferred from employment with the Department of Public Safety to assume other duties with the Iowa State Highway Commission. Defendants Department of Public Safety, Department of Transportation and State of Iowa moved to dismiss the action for failure to state a claim upon which relief can be granted. Their motion was sustained and plaintiff's petition was dismissed by the district court. Plaintiff appealed and we transferred the case to the court of appeals. *671 That court reversed the district court ruling and held plaintiff was entitled to longevity pay with interest. We granted defendants' application for further review. We now vacate the decision of the court of appeals and affirm the judgment of the district court.
I. Background facts and proceedings. The facts of this case are not in dispute because the well-pleaded facts in plaintiff's petition are regarded as true for the purpose of considering defendants' motion to dismiss. The issue raised by the parties concerns matters of statutory construction.
Plaintiff, a highway patrol officer, was employed by the department of public safety from August 1951 through July 15, 1973. During the course of his employment, he became entitled to receive longevity pay which amounted to $100 per month at the time of his change of employment because of his more than twenty years of service on the highway patrol. See Iowa Code § 80.8 (1973).
On July 15, 1973, plaintiff left his position with the highway patrol, and on July 16 he became an employee of the Iowa state highway commission, now known as the department of transportation. See Iowa Code ch. 307 (1985). When plaintiff assumed his new position, he stopped receiving longevity benefits that he had been paid by the department of public safety prior to the change, although his sick pay and vacation benefits remained intact. Iowa Code § 79.1 (1973); 1 Op.Att'y Gen. 304 (1974).
Plaintiff filed a petition in district court on March 30, 1984, seeking a declaratory judgment, Iowa R.Civ.P. 261, regarding his entitlement to longevity pay from July 1973 until his retirement on September 8, 1983, from employment with the department of transportation.
Defendants filed a motion to dismiss plaintiff's petition, pursuant to Iowa R.Civ.P. 104(b), for failure to state a claim upon which relief could be granted. Defendants contended that Iowa Code section 307.13 (1973), now Iowa Code section 307A.8 (1985), expressly prohibited payment of such benefits to employees of the highway commission hired after July 1, 1971. Plaintiff resisted the motion. After hearing, at which both parties argued the merits of the controversy, the court ruled in favor of defendants and dismissed the case.
Plaintiff appealed and we transferred the case to the court of appeals. That court reversed the district court's ruling and held plaintiff was entitled to longevity pay with interest. We granted defendants' application for further review. Iowa R.App.P. 402.
The controlling issue is whether the entitlement to longevity pay earned by plaintiff as a highway patrolman in the public safety department was transferable when he commenced employment with the state highway commission or whether Iowa Code section 307.13 prohibits such payments.
The district court has discretion only under certain limited conditions, as set forth in Wright v. Thompson, 254 Iowa 342, 350, 117 N.W.2d 520, 525 (1962), to sustain a motion under Iowa R.Civ.P. 104(b) to dismiss a declaratory judgment action. We need not address that problem in this case, however, because here the district court in fact ruled on the merits of the controversy with the implied consent and participation of the parties. Further, plaintiff's petition set out all the relevant statutes applicable to the action and the facts in the petition which gave rise to his claim were not in dispute. On appeal the parties only argued the merits of the case. We shall proceed accordingly.
II. Transferability of longevity pay benefits. Initially, we consider plaintiff's contention that, because he was continuously employed by the state, his lateral movement from the department of public safety to the highway commission should not have extinguished his longevity benefits. He argues that although Iowa Code section 307.13 prohibits the payment of longevity benefits to highway commission employees hired after July 1, 1971, the purpose of a "grandfather clause" in the statute is to reward long time state employees, *672 like himself, and that he comes within its exception.
We do not resort to rules of statutory construction when the terms of a statute are unambiguous. Willis v. City of Des Moines, 357 N.W.2d 567, 570 (Iowa 1984). However, if the language is not clear, we can resort to general rules of statutory construction to determine the legislative intent. See State v. Foster, 356 N.W.2d 548, 550 (Iowa 1984). We attempt to place on the statute "a reasonable or liberal construction which will best effect its purpose rather than one which will defeat it." Id. (quoting Chicago & North Western Railway v. City of Osage, 176 N.W.2d 788, 792 (Iowa 1970)).
Keeping these general principles in mind, we examine the relevant statutory provisions which govern this appeal.
The department of public safety was authorized to pay longevity benefits to officers of the highway patrol pursuant to Iowa Code section 80.8 (1973) which provides in part:
The compensation of the members of the highway patrol shall be fixed according to grades as to rank and length of service by the commissioner with the approval of the governor. The members of the highway patrol shall be paid additional compensation in accordance with the following formula: [sets forth formula for longevity pay].
However, Iowa Code section 307.13 (1973) reads as follows:
No employee of the state highway commission subject to the provisions of chapter 19A who is hired on or after July 1, 1971, shall be entitled to longevity pay. The provisions of this section shall not apply to any employee of the state highway commission subject to chapter 19A who has been employed prior to July 1, 1971, and whose employment continues after June 30, 1971. Any employee of the state highway commission subject to chapter 19A whose employment is terminated on or after July 1, 1971, shall, if re-employed by the state highway commission, forfeit any right he may have to longevity pay.
The payment of longevity benefits to members of the highway patrol in the department of public safety is expressly authorized by section 80.8, while section 307.13 forbids longevity pay to any highway commission employee hired on or after July 1, 1971.
Section 307.13 contains a carefully tailored exception in its second sentence. In order to receive longevity pay from the state highway commission, two conditions must be met. First, the person must have been employed by the state highway commission prior to July 1, 1971, and continue in such employment after June 30, 1971. Second, this employee must have been subject to the state merit system. See Iowa Code ch. 19A.
Plaintiff does not meet either of these two conditions, and to fall within the "grandfather clause" of section 307.13 and thus be entitled to longevity pay from the state highway commission, both requirements must be satisfied. Plaintiff was employed by the highway commission on July 16, 1973, after the July 1, 1971, statutory deadline. As a member of the highway patrol employed by the public safety department, he was exempt from the operation of the state merit system. Iowa Code § 19A.3(15).
Therefore, plaintiff may not claim the protection of the "grandfather clause" in the second sentence of section 307.13 because he is not within the limited class of highway commission employees defined in that provision.
It appears that section 307.13 clearly and unambiguously forbids payment of longevity benefits to a highway commission employee such as plaintiff, although he was previously entitled to such benefits while serving with another state agency, the public safety department.
Assuming, arguendo, that section 307.13 is not clear and that we need to ascertain the legislative intent behind its enactment, we note that where certain exceptions are set forth in a statute, it is presumed the legislature intended that no others be created. Iowa Farmers Purchasing Association, Inc. v. Huff, 260 *673 N.W.2d 824, 827 (Iowa 1977). The exception allowing the payment of longevity benefits to employees in section 307.13 is narrowly drawn. Under the third sentence of section 307.13, the exception does not apply to those persons who formerly were employees of the highway commission and entitled to longevity pay during a previous period of employment, terminated employment, and later return to work. This statutory language does not support plaintiff's argument that the purpose behind the "grandfather clause," or second sentence, in the statute was to reward long time state employees regardless of their prior department of employment. Instead, it appears that the legislative intent was to limit or preclude the payment of longevity benefits in the highway commission department.
Therefore, because of an express statutory prohibition on the payment of longevity benefits to Iowa highway commission employees, such as plaintiff, hired after July 1, 1971, we conclude the district court correctly ruled in favor of defendants.
The decision of the court of appeals is vacated and the ruling of the district court is affirmed.
DECISION OF COURT OF APPEALS VACATED; DISTRICT COURT JUDGMENT AFFIRMED.
