
812 N.E.2d 55 (2004)
349 Ill.App.3d 197
285 Ill.Dec. 466
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Joseph J. MARINO, Defendant-Appellant.
The People of the State of Illinois, Plaintiff-Appellee,
v.
Joseph J. Marino, Defendant-Appellant.
Nos. 2-03-0122, 2-03-0123.
Appellate Court of Illinois, Second District.
June 15, 2004.
*56 G. Joseph Weller, Deputy Defender (Court-appointed), Steven E. Wiltgen (Court-appointed), Office of the State Appellate Defender, Elgin, for Joseph J. Marino.
Joseph E. Birkett, DuPage County State's Attorney, Wheaton, Martin P. Moltz, Deputy Director, Diane L. Campbell, State's Attorneys Appellate Prosecutor, Elgin, for the People.
Justice CALLUM delivered the opinion of the court:
Defendant, Joseph J. Marino, pleaded guilty to armed robbery (No. 98-CF-1885) (720 ILCS 5/18-2(a) (West 1996)) and aggravated vehicular hijacking (No. 98-CF-1884) (720 ILCS 5/18-4(a)(3) (West 1996)), and was sentenced to concurrent terms of 20 years' imprisonment. The trial court denied his motion to reconsider his sentences and we affirmed. People v. Marino, Nos. 2-02-0124, 2-02-0125, 2-02-0126, cons. (2003) (unpublished order pursuant to Supreme Court Rule 23). He then filed a "Petition for Order Nunc Pro Tunc to Correct the Passing Judgment Order, Alternatively, Petition for Mandamus Relief." The trial court summarily denied the petition and defendant appeals. He contends that, in denying his petition, the court improperly treated it as a postconviction petition. We hold that, because the petition stated a cognizable cause of action, the court erred in summarily denying it. Thus, we reverse and remand.
In his petition, defendant argued that the Unified Code of Corrections (Code of Corrections) (730 ILCS 5/1-1-1 et seq. (2002)) provides that a mandatory supervised release (MSR) term is to be included within, rather than added to, the term of imprisonment. He contended that the practice of applying the MSR term after the term of imprisonment is therefore contrary to the language of the Code of Corrections. He requested the court to enter a writ of mandamus compelling the Department of Corrections (DOC) to either strike his MSR term or apply it within his prison sentence, as opposed to following his prison sentence. The State did not file an answer to the petition or move to dismiss it. The court stated that it was considering the petition a postconviction petition.
At a later hearing, the court stated, "This really isn't a post conviction per se. It'sI don't know what it is." The court ultimately "denied the motion," finding that there was no basis to grant it. Defendant was not present, had no notice of the denial, and had no opportunity to respond. He now appeals, arguing that his petition was for mandamus and that the court erred in denying it sua sponte. He also argues that even if the court had properly treated it as a postconviction petition pursuant to the Post-Conviction Hearing Act *57 (the Act) (725 ILCS 5/122-1 et seq. (West 2002)), it erred in summarily denying the petition beyond 90 days from the date it was filed. We review de novo whether the trial court complied with the applicable statutory procedure. Woods v. Cole, 181 Ill.2d 512, 516, 230 Ill.Dec. 204, 693 N.E.2d 333 (1998).
Mandamus is a remedy used to enforce, as a matter of right, a public officer's performance of his or her public duties where no exercise of discretion on the officer's part is involved. People ex rel. Waller v. McKoski, 195 Ill.2d 393, 398, 254 Ill.Dec. 729, 748 N.E.2d 175 (2001). A writ of mandamus "provides affirmative rather than prohibitory relief [citation] and can be used to compel the undoing of an act." Noyola v. Board of Education of the City of Chicago, 179 Ill.2d 121, 133, 227 Ill.Dec. 744, 688 N.E.2d 81 (1997). Defendant's petition argued that the Code of Corrections does not permit an MSR term to be imposed following a term of imprisonment and requested the court to issue a writ of mandamus compelling the DOC to either strike his MSR term or apply it within his prison sentence. Because defendant's petition properly sought mandamus relief, it was, in form and substance, a mandamus complaint.
In People v. Shellstrom, 345 Ill.App.3d 175, 280 Ill.Dec. 456, 802 N.E.2d 381 (2003), we addressed the issue of the proper procedural disposition of mandamus complaints. We held that the trial court committed reversible error when, instead of following the provisions of the mandamus statute (735 ILCS 5/14-101 et seq. (West 2002)), it treated defendant's mandamus complaint as a postconviction petition and summarily dismissed it pursuant to the Act. Shellstrom, 345 Ill.App.3d at 176, 280 Ill.Dec. 456, 802 N.E.2d 381. Here, because defendant's pleading was a mandamus complaint, the court was required to follow the procedural provisions of the mandamus statute. See Shellstrom, 345 Ill.App.3d at 177, 280 Ill.Dec. 456, 802 N.E.2d 381. Accordingly, to the extent that the court treated defendant's petition as a postconviction petition in summarily denying it, the court erred. Shellstrom, 345 Ill.App.3d at 177, 280 Ill.Dec. 456, 802 N.E.2d 381.
The State argues that the Act nevertheless granted the trial court the authority to treat defendant's petition as a postconviction petition. The Act provides:
"A trial court that has received a petition complaining of a conviction or sentence that fails to specify in the petition or its heading that is filed under this Section need not evaluate the petition to determine whether it could otherwise have stated some grounds for relief under this Article." 725 ILCS 5/122-1(d) (West 2002).
Accordingly, while the trial court need not evaluate a petition that does not invoke the Act to determine if it seeks relief pursuant to the Act, it may do so. However, the court's discretion to evaluate such petitions is not absolute. It cannot, for instance, evaluate and recharacterize as a postconviction petition a petition that properly seeks mandamus relief. Shellstrom, 345 Ill.App.3d at 177, 280 Ill.Dec. 456, 802 N.E.2d 381. Here, because defendant's petition properly sought relief pursuant to the mandamus statute, the trial court did not have the discretion to recharacterize it as a postconviction petition pursuant to section 122-1(d) of the Act.
Thus, we next address whether the court's summary denial was appropriate under the mandamus statute. In any civil action, if the court finds the complaint "insufficient in substance or form" or that it does "not sufficiently define the issues," it may sua sponte strike the complaint, *58 notify the plaintiff that it has done so, and then order the plaintiff to either file a "fuller or more particular statement" or prepare other pleadings. 735 ILCS 5/2-612(a) (West 2002); Shellstrom, 345 Ill.App.3d at 177, 280 Ill.Dec. 456, 802 N.E.2d 381. As this ruling is not dispositive, the court need not give the plaintiff an opportunity to argue against the striking of the complaint. If, on the other hand, the complaint is sufficient in substance and form, yet fails to state a cognizable cause of action, the court may sua sponte dismiss the complaint, as long as it first gives the plaintiff notice of the dismissal and an opportunity to respond. See People v. Winfrey, 347 Ill.App.3d 987, 989-90 283 Ill.Dec. 623, 808 N.E.2d 589 (2004). That is to say, if the court determines that the complaint fails to state a cognizable cause of action, it must notify the plaintiff of its intent to dismiss the complaint sua sponte and its reasons therefor, and then allow the plaintiff an opportunity to respond, at least in writing, to attempt to avoid dismissal on that ground. It is at the court's discretion whether to allow oral argument.[1] However, if the complaint is sufficient in form and substance, and states a cognizable cause of action, then the court generally may not act on the complaint sua sponte. Shellstrom, 345 Ill.App.3d at 177, 280 Ill.Dec. 456, 802 N.E.2d 381.
Here, because defendant filed a complaint properly seeking relief pursuant to the mandamus statute, he stated a cognizable cause of action recognized in this state. Accordingly, the court erred in denying defendant's complaint sua sponte. See Winfrey, 347 Ill.App.3d at 989-90, 283 Ill.Dec. 623, 808 N.E.2d 589.
The State argues that we should follow Mason v. Snyder, 332 Ill.App.3d 834, 266 Ill.Dec. 351, 774 N.E.2d 457 (2002). In Mason, the defendant filed a pro se mandamus complaint. The trial court dismissed it sua sponte. The Appellate Court, Fourth District, held that a trial court may dismiss sua sponte a mandamus complaint, reasoning that a court may dismiss sua sponte a complaint that fails to state a cause of action. Mason, 332 Ill.App.3d at 841, 266 Ill.Dec. 351, 774 N.E.2d 457. In People v. Pearson, 345 Ill.App.3d 191, 195, 280 Ill.Dec. 461, 802 N.E.2d 386 (2003), however, we held that this power does not eliminate the requirement of notice and an opportunity to respond.
The Mason court also reasoned:
"[T]rial courts may evaluate such petitions to determine their sufficiency, particularly when filed by DOC inmates. * * * The potential to overwhelm the courts and the civil justice system by the filing of groundless DOC inmate mandamus petitions is clear and real, and one first step to deal with this situation is to recognize the trial court's authority to evaluate such petitions for their sufficiency." Mason, 332 Ill.App.3d at 840, 266 Ill.Dec. 351, 774 N.E.2d 457.
We rejected this reasoning in Shellstrom, holding:
"While [the difficulty of dealing with the volume of mandamus complaints filed by DOC inmates] is a real concern for trial courts, we should not attempt to remedy this concern by reading into the mandamus statute a summary dismissal procedure that is not there. The procedural framework of mandamus actions is not a policy issue for the courts to *59 decide but, rather, a legislative decision to be made by the General Assembly. Accordingly, it is the province of the legislature, not the judiciary, to amend the statute to allow for summary dismissals.
* * *
The Code [of Civil Procedure], including the mandamus statute, provides a clear procedural framework that applies regardless of the merits of the allegations in the complaint. Accordingly, the fact that a mandamus complaint appears meritless does not excuse compliance with the procedural provisions of the Code [of Civil Procedure]. Additionally, the fact that a mandamus plaintiff is a DOC inmate in no way invests the trial court with the discretion to bypass clear statutory rules." Shellstrom, 345 Ill.App.3d at 178-79, 280 Ill.Dec. 456, 802 N.E.2d 381
We continue to adhere to this reasoning. Although we agree that a summary dismissal procedure like that contained within the Act would ease the congestion of trial courts' dockets, the fact remains that the mandamus statute contains no such procedure. The decision to insert such a procedure rests with the legislature, not with the judiciary. Moreover, we believe that the procedural framework enunciated herein will not impose on the trial courts a burden as severe as that which Mason feared. Under this framework, the trial court maintains the ability to dismiss sua sponte a complaint that fails to state a cognizable cause of action, but such power is limited only in that the court may not do so summarily. We believe that such an approach is well grounded in precedent and strikes an appropriate balance between the complainant's procedural rights and the court's interest in controlling its docket.
The State further argues that even if the trial court erred in dismissing the complaint summarily, the court correctly dismissed the complaint because it is meritless. The State appears to be arguing that the trial court's incorrect treatment of the complaint did not prejudice defendant. However, a trial court's failure to give a nonmovant notice of and an opportunity to respond to a dispositive motion is inherently prejudicial. Shellstrom, 345 Ill.App.3d at 178, 280 Ill.Dec. 456, 802 N.E.2d 381. Therefore, even if defendant's mandamus complaint is meritless, the trial court's error nevertheless prejudiced defendant, who had no notice of and no opportunity to respond to the court's sua sponte dismissal.
The judgment of the circuit court of Du Page County is reversed, and the cause is remanded.
Reversed and remanded.
HUTCHINSON and BYRNE, JJ., concur.
NOTES
[1]  Section 2-620 of the Code of Civil Procedure provides that "[t]he form and contents of motions, notices regarding the same, hearings on motions, and all other matters of procedure relative thereto, shall be according to rules." 735 ILCS 5/2-620 (West 2002). There is no rule within the supreme court rules, nor within the rules of the Eighteenth Judicial Circuit, that requires oral argument on motions.
