
133 Cal.App.3d 344 (1982)
184 Cal. Rptr. 25
THE PEOPLE, Plaintiff and Respondent,
v.
JAMES WASLEY, Defendant and Appellant.
Docket No. 11292.
Court of Appeals of California, Third District.
June 30, 1982.
*346 COUNSEL
Eugene E. White, under appointment by the Court of Appeal, for Defendant and Appellant.
George Deukmejian, Attorney General, Robert H. Philibosian, Chief Assistant Attorney General, Arnold O. Overoye, Assistant Attorney General, Robert D. Marshall and Garrett Beaumont, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
DOZIER, J.[*]
A jury convicted defendant of four counts of lewd acts with a minor under the age of fourteen. (Pen. Code, § 288.) The court found defendant a mentally disordered sex offender (MDSO) who would not benefit from treatment and sentenced him to a term of six years and eight months in prison. On appeal, this court approved the *347 determination of guilt but remanded the case for new MDSO proceedings because the record failed to show defendant personally waived his right to confront and cross-examine the psychiatrists who had submitted mental status reports on him. The questions had been submitted to the trial court by stipulation of counsel without further evidence being taken. (People v. Wasley, 3 Crim. No. 10441, unpublished opinion filed Apr. 28, 1980.)
On remand, the trial court reopened MDSO proceedings and appointed psychiatrists to reexamine defendant. The question of defendant's mental status was again submitted on the written psychiatric reports. This time defendant was fully advised of and waived his rights to an evidentiary hearing. Both examiners concluded that defendant was an MDSO who could now benefit from treatment, and the court so found. Defendant was committed to Atascadero State Hospital for a period not to exceed nine years, the longest term of imprisonment which could have been imposed for the offenses of which he was convicted. (Welf. & Inst. Code, § 6316.1, subd. (a).)
In this appeal, defendant (1) challenges the imposition of a longer "sentence" on remand, and (2) claims entitlement to conduct credits for the periods both before and during his commitment. He also contends (3) he was again improperly advised of his rights and was not served with copies of court orders. We shall affirm.

ISSUE I


Does an invalid sentence to prison set the time for which an MDSO may be committed to the state hospital on subsequent commitment proceedings?
(1) The focus of defendant's complaint as to the length of his sentence is the discrepancy between the six and two-thirds' year prison sentence and the not to exceed nine-year state hospital commitment. He contends that the previous sentence limits the latter commitment.
In 3 Criminal No. 10441, we vacated the sentence imposed and remanded with instructions to the trial court to reopen civil MDSO proceedings and proceed therewith according to law. The status quo prior to sentencing was thus restored. (See In re Sutherland (1972) 6 Cal.3d 666, 672 [100 Cal. Rptr. 129, 493 P.2d 857]) and the unauthorized sentence set aside (People v. Hickey (1980) 109 Cal. App.3d 426, *348 435 [167 Cal. Rptr. 256], and cases there cited.) "[A] defendant who successfully attacks a judgment which is in excess of the court's jurisdiction is not necessarily entitled to claim the protection of that invalid judgment as an absolute limitation upon what the court may do thereafter." (People v. Serrato (1973) 9 Cal.3d 753, 765 [109 Cal. Rptr. 65, 512 P.2d 289].)
Following our direction after defendant's successful appeal on the waiver point, the court reopened MDSO proceedings, made appropriate findings, and committed defendant as prescribed by Welfare and Institutions Code section 6316.1, subdivision (a).
Section 6316.1 reads as follows: "(a) In the case of any person found to be a mentally disordered sex offender who committed a felony on or after July 1, 1977, the court shall state in the commitment order the maximum term of commitment, and the person may not be kept in actual custody longer than the maximum term of commitment, except as provided in Section 6316.2. For the purposes of this section, `maximum term of commitment' shall mean the longest term of imprisonment which could have been imposed for the offense or offenses of which the defendant was convicted, including the upper term of the base offense and any additional terms for enhancements and consecutive sentences which could have been imposed less any applicable credits as defined by Section 2900.5 of the Penal Code and disregarding any credits which could have been earned under Sections 2930 to 2932, inclusive, of the Penal Code." (Italics added.)
By this section the Legislature has instructed the court when fixing the term to which an MDSO may be committed to a state hospital to use the maximum term to which the defendant could have been sent to prison. The court is not to exercise its discretion as to lower, middle and upper term as it would if sentencing the defendant to prison but to always use the upper term (plus applicable enhancements and consecutive sentences).
The fact that in the prior invalid sentencing the court did exercise its discretion and sentenced the defendant to prison for less than the maximum period possible cannot excuse the court from following the legislative mandate when an appellate court has vacated that judgment as procedurally premature and has sent the case back for what turned out to be commitment in a state hospital.
*349 The reason lies not only in the incongruity of the defendant seeking to take advantage of a judgment which he proved on appeal the court did not have the authority at that stage of the procedure to make (People v. Hickey, supra, 109 Cal. App.3d 426) but also in the critical difference between a prison sentence for punishment and a state hospital commitment for treatment.
The purpose of the commitment is treatment, not punishment. (People v. Saffell (1979) 25 Cal.3d 223, 229-230 [157 Cal. Rptr. 897, 599 P.2d 92]; cf. Pen. Code, § 1170, subd. (a).) An MDSO is not confined for the criminal offense but as a result of the status determination. (Ibid.) The automatic use of the upper term prescribed for the offense of which an MDSO was convicted is a constitutionally valid method of implementing the state's compelling interest in identifying and providing medical attention to those individuals amenable to treatment who commit sexually motivated criminal acts. (Id., at pp. 230-233.) The treatment process for an individual may require either less or more institutional time than a prison term for the same offense. (Ibid.; see Welf. & Inst. Code, §§ 6316.2, 6325.1.)
An invalidated prison term is irrelevant to treatment and cannot control in this situation.[1]
Because of the difference between hospital treatment and prison punishment, there is also no violation of the equal protection clause under the specious argument that the defendant is sentenced to a longer term after a successful appeal, a result forbidden in successive prison sentences.


*350 ISSUE II


Is an MDSO entitled to conduct credits, in addition to time served credits, for the time spent in state hospital commitment and any precommitment time in jail or prison?
(2) Defendant also contends that because of the posture of the case on remand, conduct credits for the time he spent in jail and prison and for the time he will spend in the state hospital must be applied to shorten his commitment term. Defendant misapprehends the differences between the statutory schemes for punishment and for treatment and the effect of our prior decision in this case.
Given the disparity of the statutory schemes for treatment and for punishment, conduct credits applicable to prison terms have no application to MDSO commitments. It is established that such credits are inappropriate in the MDSO treatment setting. (People v. Saffell, supra, 25 Cal.3d at pp. 233-235; People v. Sage (1980) 26 Cal.3d 498, 506-507 [165 Cal. Rptr. 280, 611 P.2d 874].)
Thus, defendant is not entitled to conduct credit during the time he has spent at Atascadero. Mentally disordered sex offenders are not statutorily or constitutionally entitled to conduct credits because the concept of conduct credits, designed to award "good time" credit for fixed criminal sentences, has no place in medical commitments. (People v. Saffell, supra.) The fact that conduct credits have no place in MDSO commitments is reflected in Welfare and Institutions Code section 6316.1, subdivision (a), which states that the maximum commitment term for mentally disordered sex offenders shall be computed "disregarding any credits which could have been earned under Sections 2930 to 2932, inclusive, of the Penal Code." (The conduct credits sections.)
As to credit for time actually served in jail prior to sentencing and in prison after the invalid sentencing, both Welfare and Institutions Code section 6316.1, subdivision (a) and Penal Code section 2900.5 provide for such credit. The trial court gave the defendant 784 days' credit for time served.
However, the trial court did not give the defendant credit for additional conduct credit during the 784 days he would have been entitled to if he was now being sent to prison.
*351 No statute creates a right to such conduct credits to the defendant. The final clause of Welfare and Institutions Code section 6316.1, subdivision (a) expressly states that the court is to disregard such Penal Code sections 2930-2932 conduct credits.
People v. Smith (1981) 120 Cal. App.3d 817 [175 Cal. Rptr. 54], involving persons committed to a state hospital under Penal Code section 1026, subdivision (a), considers at length the question of whether such a denial violates the equal protection clause because of the disparity between those jail or prison detainees who end up in prison and those who end up in the state hospital.
Faced with basically the same equal protection and due process arguments from amicus curiae (including citations of People v. Sage, supra, 26 Cal.3d 498) as are made to this court here, Justice Brown, in a unanimous decision in Smith, supra, held that the comparison was to be made not between those defendants who went ultimately to prison and those who went to the hospital but between those persons committed to a hospital who had previously been detained in jail or prison and those who had not. Should one class of hospital-committed defendants be awarded good time credits and the other not?
In order to avoid an equal protection problem, the justice held that no distinction should be made between these classes and thus denial of precommitment good time credit to persons committed to state hospitals does not violate equal protection whether they have previously been in jail or prison or not.
The question is a close one depending on what classes the court chooses to compare. However, our colleagues in the Fifth District thoroughly analyzed the problem and came to a rational conclusion. Unless we are convinced that they erred, we should give deference to their ratiocination and preserve harmony among the districts. We are not so convinced.
Nor presumably was the California Supreme Court, as a hearing in Smith was denied on September 10, 1981.
The first prerequisite for a valid equal protection argument is a showing that the state has adopted a classification that affects two or more similarly situated groups in an unequal manner.
*352 In our view MDSOs not amenable to treatment or non-MDSOs are sent to state prison for punishment. There are important differences, not only in mental condition, but in the circumstances of confinement between the hospital and prison populations. Therefore, MDSOs ameable to treatment and in the hospital may be treated differently than the prison groups without violating equal protection principles. (See People v. Saffell, supra, 25 Cal.3d 223.) If we were to accept defendant's analysis, we would create a discrepancy among MDSOs amenable to treatment based on the fact of irrelevant behavior in pretrial detention, an outcome precluded by People v. Sage, supra, 26 Cal.3d 498.
We reject the People's "recognition" that MDSOs are entitled to conduct credits for precommitment jail time. The People cite Sage, supra, and People v. Rance (1980) 106 Cal. App.3d 245, 256 [164 Cal. Rptr. 822], for this proposition. Sage does not address the point and Rance contains no analysis of it. The better view is in People v. Smith, supra, 120 Cal. App.3d at pp. 822-826. Noting that the holding in Sage was grounded on equal protection analysis based on the distinction between the detainee/felon and the felon who serves no presentence (People v. Sage, supra), the Smith court determined presentence conduct credits for Penal Code section 1026 committed persons "would turn Sage on its head" by creating an impermissible disparity whereby only those previously detained would have a reduced hospital term. The analysis is equally applicable to MDSO commitments.[2]
In establishing the MDSO procedures, the Legislature chose to abandon determinate sentencing and good time credits in favor of the principle of indeterminate commitments. The treatment goal was a permissible state purpose and the means used were rationally related to it.
Because MDSOs committed to the hospital are not similarly situated with defendants sent to prison, there is no equal protection requirement that they be awarded preconviction good conduct credits on the same basis. On the contrary, equal protection requires that those in the hospital *353 be treated equally whether or not they happened to have the opportunity to earn preconviction good conduct credits.
The Legislature expressly adopted this policy in Welfare and Institutions Code section 6316.1, subdivision (a), supra, and its decision is certainly not so arbitrary or capricious that the courts should presume to substitute their views of the appropriate policy decision.

ISSUE III

Was defendant adequately advised of his rights and was he properly served with court orders?
The record belies defendant's remaining contentions. It shows he was fully advised of his rights under Welfare and Institutions Code section 6305 and, after some initial confusion as to the origin of the MDSO allegation, informed the court that he understood them.
The clerk's transcript filed on appeal in this case does not show that defendant was served with a copy of the order fixing his MDSO hearing or with the later commitment order. We augmented the record on our own motion and are satisfied that service was properly effected.

CONCLUSION
Defendant was not, as he claims, deprived of equal protection or due process of law by the application of the MDSO statutes on remand. The statutes were correctly applied and are constitutionally valid. The application allows him the benefits of treatment while he remains amenable to it. He was not injured as a result of his initial appeal and none of his rights were thereby abrogated.
The judgment is affirmed.
Evans, Acting P.J., concurred.
Carr, J., concurred in the result.
A petition for a rehearing was denied July 26, 1982, and appellant's petition for a hearing by the Supreme Court was denied September 1, 1982.
NOTES
[*]   Assigned by the Chairperson of the Judicial Council.
[1]  The situation in People v. Superior Court (Garcia) (1982) 131 Cal. App.3d 256 [182 Cal. Rptr. 426], bears a close resemblance to the present case. In Garcia, defendant pled guilty to first degree murder after the district attorney agreed not to charge special circumstances. (Pen. Code, § 190.2.) Defendant's presentence motion to withdraw his plea was denied, and he was sentenced to life imprisonment. That judgment was reversed on appeal, and the trial court was directed to allow defendant the opportunity to withdraw his guilty plea and to substitute a plea of not guilty. (P. 258.)

On remand, the prosecutor filed an amended information alleging three separate special circumstances. Defendant's motion to strike them was granted, and the People petitioned for a writ of mandate. The writ issued on the appellate court's holding that the situation required the restoration of the "status quo ante." (Ibid.)
Similarly, the defendant herein, having secured a reversal of the judgment on the basis that it was entered without a valid waiver, should be "restored to status quo ante." It is incongruous for him to claim any benefits from a judgment he has successfully attacked as in excess of the court's jurisdiction.
[2]  Division Four of the First Appellate District reached the same conclusion after an equal protection analysis with regard to MDSOs in People v. Superior Court (Waitley) 130 Cal. App.3d 39 [180 Cal. Rptr. 790]. The court declined to follow People v. Rance, supra, 106 Cal. App.3d 245. (Id., at p. 43, fn. 4.) It did not discuss the Smith opinion but rather depended on People v. Austin (1981) 30 Cal.3d 155, 166 [178 Cal. Rptr. 312, 636 P.2d 1], which held that equal protection is not violated because youthful offenders sent to the CYA are denied the good time credit for presentence time spent in jail that is awarded to defendants sent to prison.
