
690 N.E.2d 660 (1998)
294 Ill. App.3d 472
228 Ill.Dec. 901
Percy JOHNSON, Plaintiff-Appellee,
v.
Odie WASHINGTON and Lisa Nordstrom, Defendants-Appellants.
No. 3-97-0153.
Appellate Court of Illinois, Third District.
January 28, 1998.
*661 James Ryan, Attorney General, Sally A. Swiss, Assistant Attorney General, Barbara A. Preiner, Solicitor General, Chicago, for Lisa Nordstrom and Odie Washington.
Percy Johnson, East Moline, for Percy Johnson.
Justice BRESLIN delivered the opinion of the court:
The plaintiff, Percy Johnson, pled guilty to multiple charges. He received 12 concurrent terms of imprisonment of varying lengths and one consecutive two-year prison term. The plaintiff was awarded credit for 165 days spent in jail prior to his sentencing. Subsequently, he brought a mandamus action against the defendants, Odie Washington (Director of the Illinois Department of Corrections) and Lisa Nordstrom (Record Office Supervisor of the East Moline Correctional Center). In this action, the plaintiff contended that he was entitled to an additional 165 days' credit against his consecutive sentence. The trial court granted the plaintiff's petition for mandamus. We find that for purposes of awarding credit for pre-sentence custody, the plaintiff's consecutive sentences must be viewed as a single "aggregate sentence." The plaintiff received 165 days of credit toward this aggregate sentence. Thus, he was not entitled to any further credit, and his petition for mandamus should have been denied. Consequently, we reverse the judgment of the trial court.
In November 1992, the circuit court of Cook County entered nine different sentencing orders against the plaintiff. In total, the plaintiff was convicted on eight counts of theft by deception (720 ILCS 5/16-1(a)(2) (West 1992)), three counts of aggravated false personation of a peace officer (720 ILCS 5/32-5.2 (West 1992)), one count of attempted theft by deception (720 ILCS 5/8-4(a), 16-1(a)(2) (West 1992)), and one count of unlawful use of a weapon by a felon (720 ILCS 5/24-1.1 (West 1992)). The sentences for all the convictions, with one exception, were to run concurrently. Those sentences ranged from 14 years to 5 years. The sole exception was a two-year prison term for theft by deception which the court ordered the plaintiff to serve consecutively to the other sentences. Each of the nine sentencing orders provided that the plaintiff should *662 be given credit for 165 days of pre-sentence custody.
In November 1996, the plaintiff filed this action for mandamus. The trial court ruled that the plaintiff was entitled to 165 days' credit against his consecutive sentence because the sentencing order provided for that credit.
The sole issue on appeal is whether the trial court properly granted the plaintiff's petition for mandamus and awarded the plaintiff additional credit for pre-sentence custody.
The writ of mandamus is an extraordinary remedy which may be issued in the court's discretion. Fischer v. Brombolich, 207 Ill.App.3d 1053, 152 Ill.Dec. 908, 566 N.E.2d 785 (1991). Mandamus may lie only when the plaintiff has a clear right to the relief sought, and the defendant has a clear duty to act and clear authority to comply with the writ. Orenic v. Illinois Labor Relations Board, 127 Ill.2d 453, 130 Ill.Dec. 455, 537 N.E.2d 784 (1989).
Section 5-8-7 of the Unified Code of Corrections (Code) governs the calculation of an offender's term of imprisonment. 730 ILCS 5/5-8-7 (West 1992). It provides that the offender must be given credit for time spent in custody as a result of the offense for which the sentence is imposed. 730 ILCS 5/5-8-7(b) (West 1992).
Section 5-8-4(e) of the Code governs the calculation of consecutive sentences. 730 ILCS 5/5-8-4(e) (West 1992). It states that the Department of Corrections (Department) must treat the consecutive sentences as if they are a single term of imprisonment. 730 ILCS 5/5-8-4(e) (West 1992). The Department must add the consecutive terms together to reach the "aggregate sentence." See 730 ILCS 5/5-8-4(e)(1),(3) (West 1992). The offender must be awarded credit against the aggregate sentence for "all time served * * * since the commission of the * * * offenses and as a consequence thereof * * *." 730 ILCS 5/5-8-4(e)(4) (West 1992).
Since both sections 5-8-7(b) and 5-8-4(e)(4) require the Department to award credit for pre-sentence custody, it becomes our task to determine which section should be applied in a given case. To do so, we turn to the rules governing statutory construction.
One of the cardinal rules of statutory construction ordains that sections in pari materia should be considered with reference to one another so that the sections may be given harmonious effect. People v. Scheib, 76 Ill.2d 244, 28 Ill.Dec. 513, 390 N.E.2d 872 (1979). It is also well settled that when both a specific statute and a general statute may be applied to a certain set of circumstances, the specific statute controls. People v. Urban, 196 Ill.App.3d 310, 143 Ill.Dec. 33, 553 N.E.2d 740 (1990).
In light of these guidelines, we note that section 5-8-7(b) is silent as to when it should be applied. Section 5-8-4(e), however, specifically states that it applies when consecutive sentences have been imposed. Thus, it is clear that section 5-8-4(e) is the specific provision and section 5-8-7(b) is the general provision. It follows, then, that when section 5-8-4(e) is applicablewhen consecutive sentences are at issuesection 5-8-4(e) controls the award of pre-sentence credit. At that point, section 5-8-7(b) becomes irrelevant.
This interpretation allows us to read sections 5-8-7(b) and 5-8-4(e) with reference to each other and give the sections harmonious effect. Section 5-8-7(b) continues to govern the award of credit for pre-sentence custody in all instances except when consecutive sentences have been imposed. When consecutive sentences are involved, section 5-8-4(e) controls.
Applying this reasoning to the instant case, we find that-section 5-8-4(e) requires the Department to add the plaintiff's consecutive sentences and award any pre-sentencing credit against the aggregate sentence. Following this direction, the plaintiff's aggregate sentence would be 16 years, and his credit for pre-sentence custody would reduce that term by 165 days. It is important to note that awarding the plaintiff 165 days of credit reduces both the underlying sentence and the consecutive sentence. Thus, all of the plaintiff's sentences have been reduced by the number of days he spent in presentence custody. Neither section 5-8-7(b) *663 nor 5-8-4(e)(4) provides for more than that. Having received the total amount of credit to which he is entitled, it is clear that the plaintiff cannot establish a clear right to the remedy of mandamus, and his petition should have been denied.
The plaintiff contends that the Illinois Supreme Court's decision in People v. Robinson, 172 Ill.2d 452, 217 Ill.Dec. 729, 667 N.E.2d 1305 (1996), controls the decision in case at bar. We find, however, that Robinson is distinguishable because Robinson involved the interpretation of section 5-8-7(b). As we noted earlier, section 5-8-7(b) has no application to the instant case. See Feazell v. Washington, 291 Ill.App.3d 766, 226 Ill. Dec. 56, 684 N.E.2d 1052 (1997), pet. for leave to appeal pending No. 84076; and People v. Plair, 292 Ill.App.3d 396, 226 Ill.Dec. 679, 686 N.E.2d 28 (1997), pet. for leave to appeal pending No. 84387; but see People v. Johnson, 286 Ill.App.3d 597, 222 Ill.Dec. 76, 676 N.E.2d 1040 (1997) leave to appeal denied 173 Ill.2d 536, 226 Ill.Dec. 136, 684 N.E.2d 1339 (1997).
Moreover, we are unpersuaded by the trial court's decision to rely on the sentencing order as an indication that the plaintiff was entitled to an additional 165 days of credit. At the time of the plaintiff's conviction, the trial court entered nine separate sentencing orders. Each of these orders contained a notation that the plaintiff was entitled to 165 days' credit. It is obvious to us that the trial court entered this notation on each order to prevent confusion should any one of the orders be misplaced. Further, we find, given our interpretation of section 5-8-4(e), that the court lacked the authority to award the defendant more than 165 days of credit.
In short, we hold that the plaintiff has received all of the credit to which he was entitled by virtue of his pre-sentence incarceration. Thus, the trial court abused its discretion in granting the plaintiff's petition for mandamus, and its judgment must be reversed.
The judgment of the circuit court of Rock Island County is reversed.
Reversed.
LYTTON, J., concurs.
HOLDRIDGE, J., dissents.
Justice HOLDRIDGE, dissenting:
I respectfully dissent. In People v. Robinson, 172 Ill.2d 452, 217 Ill.Dec. 729, 667 N.E.2d 1305 (1996), our supreme court held that the plain language of section 5-8-7(b) requires that a defendant receive credit against each sentence imposed for an offense for which he was in custody where he was simultaneously in custody on more than one offense. Robinson, 172 Ill.2d at 462-63, 217 Ill.Dec. 729, 667 N.E.2d 1305. Here, there is no indication in the record that defendant was not simultaneously in custody for each of the offenses for which he received consecutive sentences. Therefore, under Robinson, he is entitled to a separate credit against each of those sentences. People v. Johnson, 286 Ill.App.3d 597, 601, 222 Ill.Dec. 76, 676 N.E.2d 1040 (1997) leave to appeal denied 173 Ill.2d 536, 226 Ill.Dec. 136, 684 N.E.2d 1339 (1997).
I am not convinced by the majority's analysis that the controlling authority in Robinson does not apply to this situation. I would, therefore, affirm the trial court, and I dissent on that basis.
