
875 A.2d 1209 (2005)
Carlos AVILES, Petitioner
v.
PENNSYLVANIA DEPARTMENT OF CORRECTIONS, Respondent.
Commonwealth Court of Pennsylvania.
Submitted on Briefs March 18, 2005.
Decided June 2, 2005.
*1210 Carlos Aviles, petitioner, pro se.
Timothy A. Holmes, Asst. Counsel, Leslie Anne Miller, General Counsel, and Michael A. Farnan, Chief Counsel, Camp Hill, for respondent.
BEFORE: COLINS, President Judge, LEADBETTER, Judge, and SIMPSON, Judge.
OPINION BY Judge SIMPSON.[1]
This case concerns a petition for review in the nature of mandamus filed in our original jurisdiction by inmate Carlos Aviles, representing himself. Aviles asks this Court to direct the Pennsylvania Department of Corrections (DOC) to credit him for 873 days' time served. DOC challenges the legal sufficiency of the petition, asserting Aviles does not have a clear right to the credit he seeks.
The credit issue involves several of Aviles' many sentences from Philadelphia. Relying on the petition, we note that the first pertinent sentence was entered in 1995 after a guilty plea to a felony drug offense. Judge Rayford A. Means imposed a "split sentence" of three to 23 months' imprisonment and a consecutive term of one year probation (original sentence).
Thereafter, Judge Means ordered Aviles paroled effective July 12, 1995. Ex. 5. The order also recalculated Aviles' maximum sentence date to March 12, 1997. After that date, Aviles began serving the probation portion of his original sentence.
In January 1999, Judge Means found a violation of probation (VOP). He revoked probation and imposed a new split sentence of 11½ to 23 months' imprisonment, and a consecutive term of five years' probation (first VOP sentence). On November 8, 2000, Aviles was released again on probation after serving the full 23 months of the imprisonment component of the sentence. Ex. 6.[2]
*1211 In January 2003, Aviles again "appeared before Judge Means who found him in violation of his probation and sentenced [him] to not [less] than three years nor [more] than 6 years under the supervision of [DOC]" (second VOP sentence). Pet. at ¶ 15. Judge Means' order included "credit for time served" and directed the sentence run concurrently with any sentence "now being served." Pet. at ¶ 16, Ex. 8.
Aviles avers he received no credit on his second VOP sentence for certain time served, including the 82-day period from January 18 through April 12, 1995 (pre-sentence custody on original drug charges); the 91-day period from April 12 through July 12, 1995 (incarceration on original sentence); and the 23 month (700 day) period from December 8, 1998 through November 8, 2000 (incarceration on first VOP sentence). Believing he was entitled to this credit, Aviles filed a grievance with the Philadelphia Probation Department. Aviles was informed he was not entitled to credit because his second VOP sentence did not exceed the statutory maximum for the original offense. See Pet. at ¶ 20, Ex. 9.
Shortly thereafter, Aviles filed this mandamus action against DOC. In it, he asks this Court to direct DOC to credit his second VOP sentence with the 873 days he previously served. After we ordered the matter be treated as a petition for review in our original jurisdiction, DOC filed a preliminary objection in the nature of a demurrer.[3]
A proceeding in mandamus is an extraordinary action at common law, designed to compel the performance of a ministerial act or mandatory duty. Coady v. Vaughn, 564 Pa. 604, 770 A.2d 287 (2001). We may issue a writ of mandamus only where the petitioner has a clear legal right to enforce the performance of a ministerial act or mandatory duty, the defendant has a corresponding duty to perform the act and the petitioner has no other adequate or appropriate remedy. Id. The purpose of mandamus is not to establish legal rights, but to enforce those rights already established beyond peradventure. Africa v. Horn, 701 A.2d 273 (Pa.Cmwlth. 1997).
DOC asserts Aviles' petition fails to state a claim for relief because he lacks a clear right to the credit he seeks. Relying on Commonwealth v. Bowser, 783 A.2d 348 (Pa.Super.2001), petition for allowance of appeal denied, 568 Pa. 733, 798 A.2d 1286 (2002), DOC asserts Aviles already received credit for time served on his original sentence and his first VOP sentence, and he is not entitled to double credit.
Aviles relies on our decision in McCray v. Dep't of Corr., 807 A.2d 938 (Pa.Cmwlth. 2002) and the dissenting opinion in Bowser. As in those opinions, he seeks an order affording him the requested credit. If credit is not afforded, he contends, he will receive "duplicate punishment" in violation of the Double Jeopardy Clause of the Fifth Amendment to the United States Constitution, which protects against multiple punishments for the same offense.
The Pennsylvania Supreme Court very recently clarified the law in this area. *1212 McCray v. Dep't of Corr., ___ Pa. ___, 872 A.2d 1127 (2005). In doing so, it reversed our decision in McCray, and it discussed with approval the Superior Court's majority decision in Bowser. Essentially, the Supreme Court held that there is no clear right to mandamus credit relief where the combined total confinement components of original and VOP sentences do not exceed the legal maximum for the crimes. To understand the Supreme Court's ruling and how it resolves the current case, further discussion of cases in this area is warranted.
First, in Commonwealth v. Williams, 443 Pa.Super. 479, 662 A.2d 658 (1995), petition for allowance of appeal denied, 544 Pa. 607, 674 A.2d 1071 (1996), Williams received a split sentence of 11½ to 23 months' imprisonment, followed by three years' probation. He served 23 months in prison and was placed on probation. On violation, Williams' probation was revoked, and the court imposed a VOP sentence of three-and-one-half to seven years' imprisonment, the maximum sentence allowable on the original offense. Williams challenged the legality of the sentence. The Superior Court agreed, concluding that the initial 23 months' confinement added to the VOP sentence of up to seven years' confinement exceeded the statutory seven year maximum for the crime. To cure the illegal sentence, the Superior Court granted time-served credit against the VOP sentence.
Thereafter, in Bowser, the defendant received a split sentence of 11½ to 23 months in prison and a consecutive term of one year probation. After serving approximately 11½ months, the defendant was placed on probation. On violation, his probation was revoked, and the court imposed a VOP sentence of one to three years. The defendant requested credit on his VOP sentence for the 11½ months previously served. On appeal from the sentencing court's denial of credit, the Superior Court, speaking through Judge (now Justice) Eakin, held the defendant was not entitled to double credit, stating:
Having received credit for the time in jail on the first component of the sentence, [the defendant] did not spend the last half of the 23-month incarcerative portion of the sentence in jail. Probation began after that credit. Credit has been given once; had no credit been given, he would not have been paroled [as early as he was] ... and his probation would not have begun for some months thereafter. We see no reason to award duplicate credit in the second component of the sentence....

Williams does not control our case. [The defendant's] revocation sentence (one to three years), combined with the time to which he has previously been sentenced (six to 23 months), does not equal the maximum amount of time to which he can be sentenced (seven years). Accordingly, [the defendant's] sentence is not illegal and Williams does not apply.
Bowser, 783 A.2d at 350.[4]
More recently, this Court decided McCray. There, McCray ultimately received a sentence of time served to 23 months, credit for time served, the immediate grant of parole, and 10 years' probation. *1213 After violation, McCray's probation was revoked, and he received a VOP sentence. McCray filed a mandamus action in this Court seeking credit on his VOP sentence for the time served on the original sentence. This Court rejected the majority holding of Bowser, and ordered credit.
As previously noted, however, our Supreme Court reversed. The Court held the grant of mandamus was inappropriate because McCray lacked a clear right to the credit sought. In so holding, the Court reaffirmed the Superior Court majority holding in Bowser. Because the VOP sentence, when combined with the original sentence, did not exceed the legal maximum for the crimes, the Court distinguished Williams.
Similar to the situation in McCray, Aviles lacks a clear right to the credit he seeks. The trial court originally convicted Aviles on a drug charge punishable by up to 15 years in prison. See Section 13(f)(1) of the Controlled Substance, Drug, Device and Cosmetic Act.[5] The original sentence contained a total confinement component of up to 23 months. Thereafter, the first VOP sentence contained a total confinement component of up to 23 months. Then, the second VOP sentence contained a total confinement component of up to six years. The combined total confinement components of all his sentences for this crime are less than 10 years, well within the statutory maximum. As in McCray and Bowser, concerns about the imposition of an illegal sentence are simply not present here. As in McCray, Aviles lacks a clear right to the credit he seeks.
Aviles' claims that he did not receive the requested credits are inconsistent with other averments and the exhibits attached to his petition. These establish that the probation components of his sentences were consecutive to the total confinement portions of his sentences. Release on a consecutive probation component only occurs when the preceding total confinement portion of the sentence is satisfied. In turn, to satisfy the total confinement portion of a sentence Aviles must receive credit for time served.
This is most clearly seen with the first VOP sentence, where Aviles served 23 months (700 days) and thereby satisfied the maximum total confinement portion of the sentence. Aviles seeks this time credited again toward the consecutive probation component of the sentence. Upon Aviles' violation, this component became the basis for his second VOP sentence.
As the Superior Court concluded in Bowser, there is no reason to award duplicate credit in both the total confinement and probation components of a split sentence. See McCray, ___ Pa. at ___, 872 A.2d at 1136 (Castile, J. concurring) ("[A] VOP judge adequately `credits' a defendant for `time spent in custody' so long as he does not impose a VOP sentence which, when combined with the initial sentence, exceeds the statutory maximum.") At the very least, the exhibits attached to the petition and the courts' opinions in McCray and Bowser render Aviles' right to relief far from clear.
We note that this result is consistent with results reached by federal courts addressing split sentences. See United States v. Kendis, 883 F.2d 209 (3d Cir.1989) (in probation revocation setting, when convicted defendant receives less than maximum possible sentence, it is presumed trial court credited him with time already served unless the record shows otherwise) (citing Granger v. United States, 688 F.2d 1296 (9th Cir.1982); Ochoa v. Lennon, 750 F.2d 1345 (5th Cir.), *1214 cert. denied, 474 U.S. 979, 106 S.Ct. 382, 88 L.Ed.2d 335 (1985); Davis v. United States, 790 F.2d 716 (8th Cir.1986)).
Further, an original jurisdiction petition against DOC is not an appropriate remedy to cure an illegal sentence, such as a sentence which allegedly imposes double jeopardy. Our Supreme Court holds a challenge to the legality of a sentence is properly raised before the sentencing court or on direct appeal to the Superior Court. McCray; accord, Bowser. More particularly, a defendant may raise such a challenge by way of an objection at the sentencing hearing, McCray (defendant may express concern over credit issue by raising objection before sentencing court), on post-sentence motions, see Pa.R.Crim.P. 720 (directing defendant file written post-sentence motion within 10 days after imposition of sentence), on direct appeal to the Superior Court, Commonwealth v. Hollawell, 413 Pa.Super. 42, 604 A.2d 723 (1992), or by way of a petition under the Post Conviction Relief Act (PCRA), 42 Pa.C.S. §§ 9541-9546, see Commonwealth v. Beck, 848 A.2d 987 (Pa.Super.2004) (challenge to trial court's failure to award credit cognizable under the PCRA). See also McCray, ___ Pa. at ___, 872 A.2d at 1134 (Castille, J. concurring) ("Because [McCray] failed to challenge his sentence, despite an opportunity to do so before the sentencing court and/or on direct appeal, his exclusive potential collateral remedy sounded under the PCRA.")
Notably, in Bowser, the inmate raised his claim for credit with the sentencing court. Here, however, Aviles does not aver he raised the credit issue with the sentencing court or through the direct appeal process. By failing to do so, Aviles deprived a very patient Judge Means of the opportunity to clarify his sentence. McCray. Thus, Aviles did not use an available and appropriate remedy for a sentence supposedly causing duplicative punishment for the same offense. For this alternate reason, mandamus is not available here.
Accordingly, we sustain DOC's preliminary objection in the nature of a demurrer, and we dismiss Aviles' mandamus petition.

ORDER
AND NOW, this 2nd day of June, 2005, the preliminary objection in the nature of a demurrer filed by the Pennsylvania Department of Corrections is SUSTAINED, and the petition for review filed by Carlos Aviles is DISMISSED.
President Judge COLINS dissents.
NOTES
[1]  This case was reassigned to the author on April 21, 2005.
[2]  In 2002, Aviles absconded. Pet. at ¶ 12. At about the same time, he was arrested on new drug charges. Aviles subsequently pled guilty to the charges, and in June 2002, a different judge sentenced him to two concurrent sentences of one-and-a-half to three years' imprisonment in a state institution. Pet. at ¶ 14, Ex. 7.
[3]  In ruling on a demurrer, we must accept as true all well-pled material allegations in the petition for review, as well as all inferences reasonably deducible from the allegations. To sustain a demurrer, it must appear with certainty the law will not permit recovery; any doubt must be resolved by a refusal to sustain the demurrer. Kretchmar v. Commonwealth, 831 A.2d 793 (Pa.Cmwlth.2003), petition for allowance of appeal denied, 577 Pa. 728, 847 A.2d 1289 (2004).
[4]  Citing Section 9760 of the Sentencing Code, 42 Pa.C.S. § 9760 (defendant shall be given credit for all time spent in custody under a prior sentence if he is later reprosecuted and resentenced for the same offense), Judge Olszewski dissented. To refuse credit, he opined, "would be to impose two separate sentences... for a single crime, a sentence that would not have been available at the time of the original sentence." Id. at 352 (Olszewski, J., dissenting).
[5]  Act of April 14, 1972, P.L. 233, as amended, 35 P.S. § 780-113(f)(1).
