
146 So.2d 308 (1962)
Curtis H. RODGERS, Circuit Clerk,
v.
M. C. MEREDITH, Sheriff.
4 Div. 22.
Supreme Court of Alabama.
October 25, 1962.
*309 Ewell N. Clark, Florala, for appellant.
Abner R. Powell, Jr., Andalusia, for appellee.
COLEMAN, Justice.
This is an appeal by plaintiff from a judgment denying a petition for mandamus to require the sheriff to make the reports in writing provided for by § 138, Title 45, Code 1940, which recites as follows:
"When a prisoner is committed to the county jail, it is the duty of the sheriff of such county, in person or by deputy, to report in writing to the clerk of the circuit court of such county, within ten days next succeeding the commitment, the name of such prisoner, the day of his entering such jail, and by what authority, and upon what charge committed; and when a prisoner is discharged from, or otherwise leaves such jail, the sheriff shall report to such clerk, within two days next succeeding, the name of such prisoner and by what authority and when he so left or was discharged."
*310 Plaintiff is the circuit clerk; defendant is the sheriff. Defendant's demurrer to the petition was overruled, whereupon defendant answered and testimony was taken. Judgment was rendered denying mandamus and plaintiff assigns this action of the court as error.
As we understand the briefs, decision on this appeal depends on the answers to two questions, i. e., (1) Is § 138 mandatory; and (2) Is the petition properly brought in the name of the clerk as plaintiff?
The parties agree that if the statute is not mandatory, but is merely directory and permits the sheriff to make the reports or not at will, then mandamus was correctly denied and the second question is not reached. We understand further that it is not disputed that if the statute is mandatory and the petition is brought in the name of the proper party, then the court erred in denying mandamus; but, although the statute be mandatory, if the petition be not brought in the name of the proper party, then mandamus was correctly denied.
Plaintiff asserts that the statute is mandatory. Defendant takes the contrary view.
"In Alabama Pine Co. v. Merchants' & Farmers' Bank of Aliceville, 215 Ala. 66, 67, 109 So. 358, 359, correct observation is made that:
"`There is no universal rule by which directory provisions in a statute may, in all circumstances, be distinguished from those which are mandatory. In the determination of this question, as of every other question of statutory construction, the prime object is to ascertain the legislative intention as disclosed by all the terms and provisions of the act in relation to the subject of legislation and the general object intended to be accomplished.
"`"Generally speaking, those provisions which do not relate to the essence of the thing to be done and as to which compliance is a matter of convenience rather than substance are directory, while the provisions which relate to the essence of the thing to be done; that is, to matters of substance, are mandatory." 25 R.C.L. 767, § 14.'
"Again in May v. Head, 210 Ala. 112, 96 So. 869, 870, Mr. Justice Sayre says:
"`The court has no authority to look for the legislative intention in anything but the legislative language; that language may be explained; it cannot be detracted from or added to. The office of interpretation is not to improve the statute; it is to expound it; and the court knows nothing of the intention of an act, except from the words in which it is expressed, applied to the facts existing at the time. Endlich on Interp. of Stat. §§ 7, 8.'" Board of Education of Jefferson County v. State, 222 Ala. 70, 74, 75, 131 So. 239, 243.
Defendant asserts that the words of the statute, i. e., "it is the duty," are directory merely citing, Dorchester County Com'rs v. Meekins, 50 Md. 28, where the court held that a constitutional provision providing that "it shall be the duty of the General Assembly" to enact laws into articles and sections is merely directory so that a law enacted without observing the constitutional directions was not, for that reason, invalid.
In at least one case this court has held that a statute which commences, "It is the duty," imposed a mandatory duty which could be enforced by the writ of mandamus when it was applied for by a party entitled thereto. § 198, Title 13, Code 1940; Jackson v. Mobley, 157 Ala. 408, 47 So. 590. The words, "it is the duty," in § 138, Title 45, are no obstacle to giving that statute mandatory effect, notwithstanding the holding in Dorchester County Com'rs v. Meekins, supra, to opposite result.
Defendant argues that because no penalty is imposed for noncompliance with § 138, Title 45, the statute is not mandatory, *311 citing 50 Am.Jur. 49, Statutes, § 27. Defendant argues in brief as follows:
"The authority cited in proposition five holds that if a statute involved carries a penalty for failure to comply with such statute then such statute is considered as being mandatory. The logic behind this rule is simple. The legislature intended that the duties of the statute should be mandatory and provided a specific penalty in the event the requirements of the statute were not met. By inverse logic it would likewise appear that if the legislature provides no penalty for failure to comply with a statute then such statute is considered to be directory only. In the statute involved in this case (Title 45, Section 138) the legislature prescribed a directory duty of the Sheriff. The legislature did not set any penalty for failure to comply with the statute. * * *"
This court has said:
"The genesis of the statute here involved * * * may be looked to in aid of its construction." Baggett v. Jackson, 244 Ala. 404, 405, 13 So.2d 572, 573; Acme Freight Lines v. City of Dothan, 242 Ala. 468, 6 So.2d 595.
Looking to the origin of § 138, Title 45, we are of opinion that it was mandatory when first enacted. It appears as Section 1 of Act No. 11, approved February 22, 1881; Acts 1880-81, page 9, which recites in pertinent part as follows:
"SECTION 1. Be it enacted by the General Assembly of Alabama, That when a prisoner is committed to any jail of this State, it shall be the duty of the sheriff, in person, or by deputy, to report in writing to the clerk of the city or circuit court of the county in which such jail is, within ten days next succeeding such commitment, the name of such prisoner, the day of his entering such jail, and by what authority, and upon what charge committed, and whenever a prisoner is discharged from, or otherwise leaves such jail, the sheriff shall so report to such clerk, within two days next succeeding, the name of such prisoner, and by what authority and when he so left, or was discharged.
"SEC. 2. Be it further enacted, That it shall be the duty of the clerk to lay such reports before the court of county commissioners of such county, at each regular term thereof.
"SEC. 3. Be it further enacted, That each account due a sheriff for feeding prisoners shall be made out by him in duplicate, and sworn to, and must show the name of each prisoner, the date of his commitment and discharge, release or escape, the crime with which charged, the judgment rendered, the date of the issue of the execution, if against the prisoner for costs, and the date and nature of the return, and if any prisoner therein named has escaped, it shall be so stated. He shall present to the court of county commissioners of the county in which such jail is, at each regular term thereof, such duplicate account for fees falling due since the last term thereof. It shall be the duty of such court to examine carefully into the correctness of such account, comparing it with the reports filed by the clerk, and summoning and examining witnesses in regard to the same, if in the judgment of the court it is necessary. If the court finds such account correct, it shall endorse such finding upon each copy thereof; if incorrect in any particular, it shall state it in its endorsement, such particular. * * *
* * * * * *
"SEC. 5. Be it further enacted, That it shall not be lawful for the Auditor to issue his warrant for the payment of any account of sheriffs for feeding prisoners without the presentation of such account so endorsed by the court of county commissioners.

*312 "SEC. 6. Be it further enacted, That any sheriff failing to comply with the provisions of this act, as to any prisoner in his custody, shall receive no pay for feeding such prisoner. Any sheriff failing to keep the book and make entry therein, as provided by this act, shall be guilty of a misdemeanor. Any sheriff who shall knowingly receive from this State for feeding a prisoner, or prisoners, any sum of money to which he is not lawfully entitled shall be punished as if he had stolen the same."
It will be noted that the act provided that:
1. Report of entry and discharge of prisoners be reported to clerk;
2. Clerk shall lay reports before court of county commissioners;
3. Court of county commissioners shall compare account presented by sheriff with reports filed by clerk and shall endorse account as correct or incorrect;
4. Sheriff shall not be paid for feeding prisoners without presentation of endorsed account;
5. Sheriff failing to comply with act, as to any prisoner, shall receive no pay for feeding such prisoner;
6. Sheriff failing to keep the book of account is guilty of a misdemeanor;
7. Any sheriff knowingly receiving payment to which he is not entitled shall be punished as if he had stolen the money so received.
The Act of 1881 certainly provided a penalty for failure to file the reports with the clerk. We think that Section 1 of the 1881 Act was clearly mandatory.
Section 1 of the 1881 Act was codified as § 4555 of the Code of 1886. The remaining sections of the act appear to have been omitted from the Code. The original purpose of Section 1 of the 1881 Act is clear. What purpose it is now to serve may not be so clear. We are not prepared to say, however, that the legislature cannot continue a mandatory duty imposed on the sheriff merely because the present purpose is not so clearly apparent as it formerly was.
As stated above, the court "knows nothing of the intention of an act, except from the words in which it is expressed, applied to the facts existing at the time." 222 Ala. at page 75, 131 So. at page 243.
When § 138, Title 45, was first enacted it was clearly mandatory because of the words employed and the facts existing at the time. It has been brought forward in five successive codes without material change. Our problem is to ascertain the intent of the lawmakers when they placed § 138, Title 45, in the presently effective Code of 1940.
It is within the power of the legislature, by reasonable regulation, to prescribe the duties of sheriff, provided no constitutional limitation is broken. No such limitation appears here. This power of the legislature is not questioned.
"* * * Directions given by a sovereign in regard to a matter over which his power is conceded would, according to the ordinary use of language, be held to involve, as its correlative, obedience. Sedg. St. & Const. Law, p. 318, note. * * *" State ex rel. Mize v. McElroy, 44 La.Ann. 796, 11 So. 133, 135, 16 L.R.A. 278, 32 Am. St.Rep. 355.
We think the intent of the legislature with reference to the mandatory or directory character of § 138, Title 45, can best be ascertained by applying the rules of construction which have been stated as follows:
"* * * It is our duty to carry into effect the intention of the legislature, to be gathered from their language. In Thompson v. The State, 20 Ala. 54, this *313 court said, `the inartificial manner in which many of our statutes are framed, the inaptness of expressions frequently used, and the want of perspicuity and precision not unfrequently met with, often require the court to look less at the letter or words of the statute, than at the context, the subject-matter, the consequences and effects, and the reason and spirit of the law, in endeavoring to arrive at the will of the law-giver.' And in Smith v. Smith, 19 [Wis.] Wise, 522, and Bishop v. Schneider, 46 Mo. 472, the several courts considered the effect of abridging and embodying statutes in a code, and consulted the original statutes, their date, and even their judicial interpretation, in arriving at a proper construction of the legislative intent. In each case, though the statutes had been changed in phraseology and in arrangement, they gave effect to them as framed by the legislature. * * *" Steele v. State, 61 Ala. 213, 218.
"When the effect of condensing, embodying and arranging statutes in a Code, is to create ambiguity or doubt as to their proper construction, the court will refer to, and consult the original acts, in connection with their history, and also of the sections proximate in arrangement, with which they are supposed to be correlative, in order to ascertain the legislative intent. Although a difference in phraseology and arrangement may be made by the codifiers, this does not necessarily work a change of construction. Unless the alteration of the original act is of such character as to manifest a clear intent to make a change in the construction and operation, effect will be given to the statute as originally framed by the General Assembly. Steele v. State, 61 Ala. 213; Landford v. Dunklin, 71 Ala. 594." East Tenn. V. & G. R. R. Co. v. Hughes, 76 Ala. 590, 592.
"* * * And it has been said, that `it has long been a cardinal and controlling maxim that, where a law antecedently to a revision of the statutes is settled, either by clear expressions in the statutes or adjudications on them, the mere change of phraseology shall not be deemed or construed a change of the law, unless such phraseology evidently purport an intention in the legislature to work a change.' Sedg. St. & Const. Law (2d Ed.) 365. The maxim has been applied in the construction of the Code. In Landford v. Dunklin, 71 Ala. [594] 609, it was said: `The statute, as embodied in the Code, is changed in phraseology. Words are omitted which were found in the former statute, but there is no indication of a legislative intent to change or to modify the former statute; certainly not to vary the effect of the administration committed to the sheriff or coroner. No rule of statutory construction rests upon better reasoning than that in the revision of statutes alteration of phraseology, the omission or addition of words, will not necessarily change the operation or construction of former statutes. The language of the statute as revised, or the legislative intent to change the former statute, must be clear, before it can be pronounced that there is a change of such statute in construction and operation.' * * *." Jackson County v. Derrick et al., 117 Ala. 348, 360, 361, 23 So. 193, 196, 197.
See also: Gunter v. State, 83 Ala. 96, 3 So. 600; Zaner v. State, 90 Ala. 651, 8 So. 698; Miller v. State ex rel. Peck, 249 Ala. 14, 21, 29 So.2d 411, 172 A.L.R. 1356.
In the instant case there is but slight change in Section 1 of the 1881 Act as it has been carried forward into the successive codes. We have undertaken to show that the provision of the 1881 Act, which made it the duty of the sheriff to file with the clerk the reports as to jail prisoners, was mandatory in the original statute, and not directory. The language of the Code utterly fails to express the legislative intent *314 to change the original operation and construction of what is now § 138, Title 45.
To hold otherwise, we would be forced to say that language which meant one thing in 1881 had an opposite meaning in 1886 and thereafter. We would be forced to say that the same statutory provision, which did not permit the sheriff, at his discretion to fail to report in 1881, did permit him to fail so to report in 1886, and now. We will not ascribe to the legislature the expression of one intent at one time and an opposite intent at another time by using the same language at both times. To so hold would be unreasonable and destroy the stability of the law. Because the original statute of 1881 was mandatory and has been codified without showing an intent to change its mandatory character, the codified statute, § 138, Title 45, Code 1940, is also mandatory.
We come to the second question, i. e., Is the petition properly brought in the name of the clerk, either individually, as appears to be the case, or in his capacity as clerk of the circuit court? The parties seem to treat the petition as being brought by him in his capacity as clerk, and we will so treat it.
Plaintiff argues that the statute is for the benefit of the clerk because § 201, Title 13, requires him, upon request, to furnish the chief justice "with all information as to * * * the number of prisoners in jail," and the reports made by the sheriff in compliance with § 138, Title 45, would assist the clerk in furnishing such information to the chief justice. For two reasons, we do not think that § 138 was enacted to help the clerk comply with § 201, Title 13. The first reason is that § 138, Title 45, appeared in the code many years before the forerunner of § 201, Title 13, was enacted in 1915; and the second reason is that the reports required by § 201, Title 13, are as to "the number of prisoners in jail" and not as to the number of prisoners reported by the sheriff to be in jail.
Plaintiff says also that § 138, Title 45, is to assist him in setting cases for trial as required by § 316, Title 15. We do not agree. The progenitor of § 316, Title 15, appears to be an act approved in 1877, some years before the enactment of Section 1 of the Act of 1881, supra. The second reason stated above as to § 201, Title 13, applies here also.
We are of opinion that § 138, Title 45, confers no private right on plaintiff, either individually or as clerk.
"* * * It is now the settled rule in Alabama that a mandamus proceeding to compel a public officer to perform a legal duty in which the public has an interest, as distinguished from an official duty affecting a private interest merely, is properly brought in the name of the State on the relation of one or more persons interested in the performance of such duty to the public; but if the matter concerns the sovereign rights of the State, it must be instituted on the relation of the Attorney General, the law officer of the State. Marshall County Board of Education v. State ex rel. Williams, 252 Ala. 547, 42 So.2d 24; Gray v. State ex rel. Garrison, 231 Ala. 229, 164 So. 293, and cases cited. * * *" Kendrick v. State, 256 Ala. 206, 213, 54 So.2d 442, 447.
Appellee states in brief:
"* * * Thus we have a statute in which the Clerk has no personal interest, since the law does not require him to take any action on the report or do anything with the report in his capacity as Circuit Clerk. We then come to the inescapable conclusion that the only remaining group who could possibly have any interest in the provisions of this statute would be the public."
We hold that the duty here placed on the sheriff by § 138, Title 45, is a legal duty in which the public has an interest, as *315 distinguished from an official duty affecting a private interest merely. Under the settled rule, petition for mandamus to compel a public officer to perform such duty is properly brought in the name of the state on the relation of one or more persons interested in the performance of that duty. The instant petition was not so brought.
By demurrer, the defendant raised the objection that the petition shows that plaintiff is not entitled to maintain this action as clerk of the circuit court. The court overruled the demurrer. Defendant has cross-assigned this ruling as error.
The court erred in overruling this ground of demurrer. Kendrick v. State, supra. Defendant recognizes, of course, that, as to him, the error is without injury, because he prevailed in the final judgment.
We cannot, however, merely hold that mandamus was correctly denied because the petition was not properly brought, and so dismiss this point without further consideration. Orderly procedure and fair play forbid that a court be permitted to overrule a demurrer, and yet have its final judgment upheld because the demurrer ought to have been sustained, all without giving the party whose pleading is bad an opportunity to amend. Especially is this true in the light of §§ 238, 239, 1072, Title 7, Code 1940.
The right of amendment is to be liberally indulged; City of Bessemer v. Brantley, 258 Ala. 675, 65 So.2d 160; but there must not be an entire change of parties; Spurling v. Fillingim, 244 Ala. 172, 12 So.2d 740. The statute does not permit striking the sole party plaintiff and substituting another in his place. Leaird v. Moore, 27 Ala. 326; Pickens v. Oliver, 32 Ala. 626. In a case where mandamus was awarded, this court said:
"The amendment to the petition was properly allowed. It did not work an entire change of parties. * * *" Fountain v. State, ex rel. Hybart, 211 Ala. 586, 589, 100 So. 892, 894.
The implication is that the amendment would not be allowed if it did work an entire change of parties.
In the case at bar, then, if plaintiff be afforded an opportunity to amend as to the party plaintiff, he cannot properly substitute the state on his relation for himself without offending the rule. Accordingly, the judgment denying the writ is due to be affirmed because the plaintiff is not entitled to maintain the action and cannot amend the complaint so as to entitle him to do so.
It necessarily follows, however, that the judgment here is not res judicata so as to bar another action properly brought in the name of the state on the relation of a person having a proper interest, because the state on such relation is not a party to the instant action.
Affirmed.
LIVINGSTON, C. J., and SIMPSON and GOODWYN, JJ., concur.
