
607 N.E.2d 1251 (1992)
154 Ill.2d 193
180 Ill.Dec. 738
The PEOPLE of the State of Illinois ex rel. Thomas BAKER, Petitioner,
v.
Henry COWLIN, Circuit Judge of the 19th Judicial Circuit, et al., Respondents.
No. 73250.
Supreme Court of Illinois.
December 4, 1992.
Rehearing Denied February 1, 1993.
Thomas F. Baker, State's Atty., Woodstock, and Norbert J. Goetten, William L. Browers and Cynthia N. Schneider, of the Office of the State's Attys. App. Pros., Elgin, for petitioner.
Roland W. Burris, Atty. Gen., Springfield (Rosalyn B. Kaplan, Sol. Gen., and Deborah L. Ahlstrand, Asst. Atty. Gen., Chicago, of counsel), for respondent Hon. Henry L. Cowlin.
Phyllis J. Perko, Harlovic & Perko, West Dundee, for respondent Thomas Whitt.
Sheldon L. Banks, Chicago, for respondent Brad Bartnick.
Justice FREEMAN delivered the opinion of the court:
The parties do not dispute the pertinent facts. Following unrelated trials in the circuit court of McHenry County, defendants, *1252 Brad Bartnick and Thomas Whitt, were each convicted of, inter alia, delivering over 5 grams of cocaine, in violation of what was section 401(b)(2) of the Illinois Controlled Substances Act (Act), as amended by Public Act 86-604 (Ill.Rev.Stat.1989, ch. 56½, par. 1401(b)(2) (amended by Pub. Act 86-604, eff. Jan. 1, 1990)).
On August 12, 1991, the trial judge sentenced Bartnick to a probation term of 40 months with 90 days in jail, 100 hours of public service within 18 months, drug addiction evaluation and counseling, fines and costs.
The prosecutor asked the trial judge to reconsider Bartnick's sentence. Relying on section 5-5-3(c)(2)(D) of the Unified Code of Corrections (Code) (Ill.Rev.Stat.1989, ch. 38, par. 1005-5-3(c)(2)(D)), the State argued that the delivery of more than 5 grams of cocaine was a nonprobationable offense. Although Whitt had not yet been sentenced, the State also sought a ruling that Whitt must receive a prison sentence.
On October 4, 1991, the trial judge ruled that the offenses that Bartnick and Whitt committed were probationable. On October 25, 1991, the trial judge sentenced Whitt to a probation term of 36 months, 100 hours of public service, periodic examinations for drug use, fines and costs.
The State's Attorney of McHenry County now petitions this court for a writ of mandamus or, alternatively, for a supervisory order. (134 Ill.2d Rules 381, 383.) Petitioner seeks an order to direct the trial judge to expunge the sentences of probation and to impose sentences that include imprisonment. We allowed petitioner leave to file the petition. (134 Ill.2d R. 381(a).) We now grant the petition.

OPINION

I. Availability of Remedy
We note at the outset defendants' contention that mandamus, or a supervisory order, is an improper remedy. Defendants are correct that an extraordinary remedy such as mandamus is not available as a matter of right to correct an alleged error of a lower court. (People ex rel. Foreman v. Nash (1987), 118 Ill.2d 90, 96-97, 112 Ill.Dec. 714, 514 N.E.2d 180, quoting People ex rel. Barrett v. Shurtleff (1933), 353 Ill. 248, 259-60, 187 N.E. 271.) Rather, mandamus is traditionally used to compel, as a matter of public right, a lower court to perform purely ministerial duties where no exercise of discretion is involved. Foreman, 118 Ill.2d at 96, 112 Ill.Dec. 714, 514 N.E.2d 180, quoting Madden v. Cronson (1986), 114 Ill.2d 504, 514, 103 Ill.Dec. 729, 501 N.E.2d 1267.
However, it is quite settled "that the sentencing provisions of the Unified Code of Corrections [citation] are mandatory and mandamus will lie to compel compliance with them." (People ex rel. Daley v. Limperis (1981), 86 Ill.2d 459, 466, 56 Ill.Dec. 666, 427 N.E.2d 1212.) We conclude that mandamus is an available remedy.

II. Statutory Interpretation
We now turn to the merits of the petition. Section 5-5-3(c)(2)(D) of the Code states:
"(2) A period of probation, a term of periodic imprisonment or conditional discharge shall not be imposed for the following offenses. The court shall sentence the offender to not less than the minimum term of imprisonment set forth in this Code for the following offenses, and may order a fine or restitution or both in conjunction with such term of imprisonment:
* * * * * *
(D) A violation of * * * subdivision (c)(2) of Section 401 of [the] Act which relates to more than 5 grams of a substance containing cocaine or an analog thereof." (Emphasis added.) Ill. Rev. Stat. 1989, ch. 38, par. 1005-5-3(c)(2)(D).
However, the trial judge determined that defendants had violated what was section 401(b)(2) of the Act, as amended by Public Act 86-604. (Ill.Rev.Stat.1989, ch. 56½, par. 1401(b)(2) (as amended by Pub. Act 86-604, eff. Jan. 1, 1990).) The trial judge reasoned that since defendants violated section 401(b)(2) of the Act, and the Code *1253 mandates imprisonment expressly for a violation of section 401(c)(2), defendants' offenses were, therefore, probationable.
Petitioner asks us to construe these statutory provisions. The general legal principles are familiar. The primary rule of statutory construction, to which all other rules are subordinate, is to ascertain and give effect to the true intent of the legislature. In determining the legislative intent, a court should first consider the statutory language. Where the statutory language is clear, it will be given effect without resort to other aids for construction. However, where the language is ambiguous, it is appropriate to examine the legislative history. People v. Boykin (1983), 94 Ill.2d 138, 141, 68 Ill.Dec. 321, 445 N.E.2d 1174 (and cases cited therein).
We conclude that the language of section 5-5-3(c)(2)(D) of the Code and section 401 of the Act, as it appeared at the time of the offenses, was ambiguous. Section 5-5-3(c)(2)(D) refers to a violation of section 401(c)(2) "which relates to more than 5 grams of a substance containing cocaine or an analog thereof." (Ill.Rev. Stat.1989, ch. 38, par. 1005-5-3(c)(2)(D).) However, it is undisputed that, at the time of the offenses, defendants did not violate section 401(c)(2) of the Act, but rather section 401(b)(2) of the Act, as amended by Public Act 86-604. (Ill.Rev.Stat. 1989, ch. 56½, par. 1401(b)(2) (as amended by Pub. Act 86-604, eff. Jan. 1, 1990).) Also, section 401(c) of the Act, as amended by Public Act 86-604, does not refer to "a substance containing cocaine or an analog thereof" and does not contain a subsection (2).
We agree with petitioner that section 5-5-3(c)(2) of the Code was ambiguous "in that it appeared to incorporate by reference a statutory subsection that did not exist, and where [it appeared that] the section that did exist was wholly inapplicable on its own terms." Since at the time of the offenses these statutory provisions were ambiguous, it is appropriate to examine their legislative history.
In People v. Shephard (1992), 152 Ill.2d 489, 178 Ill.Dec. 724, 605 N.E.2d 518, we recently explained the legislative history of section 401 of the Act as follows:
"[W]e conclude that a conflict exists between section 401 as amended by Public Acts 86-266 and 86-442, and section 401 as amended by Public Act 86-604. [Citation.] Public Acts 86-266 and 86-442 added to section 401 a new and different subsection (b) than had previously existed in section 401 and re-lettered the former subsections (b) through (g) thereof as subsections (c) through (h). The new subsection (b) added to section 401 by Public Acts 86-266 and 86-442 merely established fines for certain violations of subsection (a). The new section 401(c)(2), which was the former section 401(b)(2), provided essentially that a violation of section 401 through, inter alia, the possession with intent to deliver between 1 and 15 grams of any substance containing cocaine was a Class 1 felony. [Citations.]
In contrast to Public Acts 86-266 and 86-442, Public Act 86-604 amended only, in part, the language of sections 401(a)(7) and (b)(7) as those subsections read prior to the changes made by Public Acts 86-266 and 86-442. In so doing, Public Act 86-604 repeated the remaining provisions of section 401 as they read prior to the changes made by Public Acts 86-266 and 86-442. Consequently, Public Act 86-604 did not add a new subsection (b) to section 401 and did not re-letter subsections (b) through (g) of section 401 as they read prior to the changes made by Public Acts 86-266 and 86-442. [Citation.]" Shephard, 152 Ill.2d at 495-96, 178 Ill.Dec. at 727-28, 605 N.E.2d at 521-22.
In Shephard, we concluded that the changes to section 401 made by Public Acts 86-266 and 86-442 conflicted with the changes to that section made by Public Act 86-604. (Shephard, 152 Ill.2d at 497-98, 178 Ill.Dec. at 728, 605 N.E.2d at 522). In the present case, this conflict causes a problem in implementing section 5-5-3(c)(2)(D) of the Code.
*1254 Defendants argue that we are not empowered to change the express statutory language of section 5-5-3(c)(2)(D). Rather, defendants argue that we are limited to interpreting the statute's effect as written. However, it is settled that if the legislative intent can be determined from a statute, statutory language can be modified, altered, or supplied so as to avoid any repugnancy or inconsistency with the legislative intent. People v. Parker (1988), 123 Ill.2d 204, 210-11, 121 Ill.Dec. 941, 526 N.E.2d 135 (and cases cited therein).
Applying this principle to the present case, we conclude that the legislature intended that section 5-5-3(c)(2)(D) of the Code makes violations of section 401(b)(2) of the Act, as amended by Public Act 86-604, nonprobationable. Although section 5-5-3(c)(2)(D) of the Code cites section 401(c)(2) of the Act, the section also refers specifically to a violation "which relates to more than 5 grams of a substance containing cocaine or an analog thereof." (Emphasis added.) (Ill.Rev.Stat.1989, ch. 38, par. 1005-5-3(c)(2)(D).) Prior to Public Act 86-604, section 401(b)(2) of the Act did relate to "cocaine, or an analog thereof," which was probationable. (Ill.Rev.Stat. 1989, ch. 56½, par. 1401(b)(2) (amended by Pub.Act 86-266, eff. Jan. 1, 1990; 86-442, eff. Jan. 1, 1990).) As we explained above, Public Act 86-604 redesignated this provision section 401(b)(2). Ill.Rev.Stat.1989, ch. 56½, par. 1401(b)(2) (amended by Pub.Act. 86-604, eff. Jan. 1, 1990).
However, the specific reference in section 5-5-3(c)(2)(D) to "a substance containing cocaine or an analog thereof expresses the legislature's intent that a violation of section 401 of the Act involving more than 5 grams of cocaine is nonprobationable. This clear expression of legislative intent controls regardless of whether the offense is designated subsection (b)(2) or (c)(2) of section 401 of the Act.
Our conclusion is further supported by the recent amendment of section 401 of the Act by Public Act 87-754, effective September 29, 1991. (Pub.Act. 87-754, eff. Sept. 29, 1991; 1991 Ill.Laws 3943.) In Shephard, we noted as follows:
"When confronted with problems that arise when the legislature passes two or more bills at the same session which pertain to the same subject or amend the same statute, the ultimate question is the intent of the legislature, as in all cases of statutory construction. The entire legislative record, including acts passed at subsequent sessions, is open to ascertain the legislative intent. Once ascertained, it will be given effect. People ex rel. Dickey v. Southern Ry. Co. (1959), 17 Ill.2d 550, 554-55, 162 N.E.2d 417." Shephard, 152 Ill.2d at 497, 178 Ill.Dec. at 728, 605 N.E.2d at 522.
Accord Parker, 123 Ill.2d at 211, 121 Ill. Dec. 941, 526 N.E.2d 135.
In Shephard, we noted that Public Act 87-754 amended section 401, as amended by Public Acts 86-266 and 86-442, consistently with the amendment by Public Act 86-604, and thereafter deleted Public Act 86-604. (Shephard, 152 Ill.2d at 497-98, 178 Ill.Dec. at 728, 605 N.E.2d at 522). As a result of this amendment, the offense involving cocaine returned to subsection (c)(2) and now corresponds to section 5-5-3(c)(2)(D) of the Code. We hold that section 5-5-3(c)(2)(D) renders the offenses of which defendants were convicted nonprobationable.

III. Conclusion
Since the offenses of which defendants were convicted were nonprobationable, the trial judge lacked the discretion to sentence defendants to probation. Therefore, a writ of mandamus is awarded to require the trial judge to expunge defendants' sentences of probation and to impose sentences that include imprisonment. See People ex rel. Hanrahan v. Wilson (1971), 48 Ill.2d 30, 35-36, 268 N.E.2d 23.
Writ awarded.
