
759 P.2d 1049 (1988)
306 Or. 196
Richard GAGE, Petitioner On Review,
v.
Manfred MAASS, Superintendent, Oregon State Penitentiary, Respondent On Review.
TC 86-C-12030; CA A43049; SC S34329.
Supreme Court of Oregon, In Banc.
Argued and Submitted December 1, 1987.
Decided July 26, 1988.
*1050 Mark J. Geiger, Salem, argued the cause and filed the petition for petitioner on review.
Scott McAlister, Asst. Atty. Gen., Salem, argued the cause for respondent on review.
LENT, Justice.
The immediate issue is whether habeas corpus is the proper means for an imprisoned felon to enforce his right to receive credit for time served in jail prior to his transfer from custody of the sheriff to custody of the Corrections Division pursuant to sentence where the felon has failed to show whether or not the sheriff has certified the time served.[1] We hold that it is not the proper means.
The record also presents questions about proper procedure in habeas corpus proceedings in the two kinds of cases described in Penrod/Brown v. Cupp, 283 Or. 21, 28, 581 P.2d 934 (1978):
"In summary, we conclude that the writ remains available to bring before a court the two kinds of cases we have described: (1) When a petition makes allegations which, if true, show that the prisoner, though validly in custody, is subjected to a further `imprisonment or restraint' of his person that would be unlawful if not justified to the court, and (2) when a petition alleges other deprivations *1051 of a prisoner's legal rights of a kind which, if true, would require immediate judicial scrutiny, if it also appears to the court that no other timely remedy is available to the prisoner."
Proceeding pro se, plaintiff filed a petition for a writ of habeas corpus, alleging:
"The imprisonment, incarceration, custody and restraint to the best of plaintiff's knowledge and belief is unlawful, and the illegality thereof consists of the following: I am being denied credit for 210 days time served which is dening [sic] my liberty interests."
Simultaneously, he filed a motion and affidavit to proceed in forma pauperis and for appointment of counsel. The court allowed both motions. The court ordered that a writ of habeas corpus issue.
A writ was issued October 22, 1986, commanding defendant to have the body of plaintiff before the court on November 5, 1986. The sheriff's return shows service of the writ on October 28, 1986.
A journal entry shows that plaintiff and his appointed counsel appeared before the court on November 7, 1986, as did defendant through his counsel, an Assistant Attorney General. The journal entry states that a return was filed and that a replication was due in two weeks. The entry also noted the case for pretrial conference on January 5, 1987.
Among other things, the return showed that defendant's custody of plaintiff was by virtue of:
"1. Upon conviction of Theft I and subsequent revocation of probation in State v. Gage, Multnomah County Case No. C-8303-31194, a sentence of five (5) years imposed July 18, 1984.
"2. Upon conviction of Robbery I in State v. Gage, Multnomah County Case No. 84-03-31366, a sentence of ten (10) years imposed July 19, 1984.
"3. Upon conviction of Robbery I in State v. Gage, Clackamas County Case No. 84-414, a sentence of ten (10) years imposed October 10, 1984.
"4. Upon conviction of Ex-Convict in Possession of a Firearm in State v. Gage, Multnomah County Case No. C86-05-32248, a sentence of five (5) years imposed June 25, 1986."[2]
By replication filed November 20, 1986, plaintiff alleged that his imprisonment and restraint were illegal because:
"Petitioner has been, and continues to be denied credit for time served prior to delivery to the Oregon State Penitentiary Correctional Institution, in violation of ORS 137.310."[3]
*1052 On December 2, 1986, defendant filed a motion
"* * * for an order dismissing petitioner's Petition for Writ of Habeas Corpus on file herein pursuant to ORCP 21(A)(8) [sic] on the ground that the pleading fails to state ultimate facts sufficient to constitute a claim."
The motion to dismiss was predicated on the failure of the petition to allege that the sheriff had certified to the Corrections Division the number of days served prior to delivery to the Division. That being so, argued defendant, there could be no way in which the Division could give credit under ORS 137.370 for the time spent in the county jail before delivery to the Division.[4]
By order dated January 28, 1987, the court allowed the motion to dismiss and further ordered "that petitioner's Petition for Writ of Habeas Corpus be, and hereby is, dismissed." Accordingly, the court gave judgment for defendant.
Plaintiff timely appealed, and the Court of Appeals affirmed without opinion. Gage v. Maass, 86 Or. App. 363, 739 P.2d 75 (1987).
In the trial court plaintiff questioned the applicability of the Oregon Rules of Civil Procedure (ORCP). ORCP 1 A provides:
"These rules govern procedure and practice in all circuit and district courts of this state * * * for all civil actions and special proceedings whether cognizable as cases at law, in equity, or of statutory origin except where a different procedure is specified by statute or rule. * * *"
In this court both parties assert that the ORCP applies to habeas corpus proceedings, but plaintiff contends that the applicability is circumscribed by ORS 34.680, and defendant contends that although ORS 34.680 governs, there is no conflict between the statute and ORCP 1 A. ORS 34.680 provides:
"The plaintiff may move to strike the return, or the defendant may move to strike any new matter set forth in the replication of the plaintiff, or by proof controvert the same, as upon a direct denial or avoidance. The pleadings shall be made within such time as the court or judge shall direct, and they shall be construed and have the same effect as in an action."
We agree that if there were a conflict between ORS 34.680 and the ORCP, the statute would govern.
Relying on ORCP 21 A(8), defendant moved to dismiss the petition for a writ of habeas corpus. This rule provides:
"[T]he following defenses may at the option of the pleader be made by motion to dismiss: * * * (8) failure to state ultimate facts sufficient to constitute a claim, * * *."
In an ordinary civil proceeding that is initiated by petition, this motion may be employed to test the sufficiency of the petition, but for the reasons set forth below, it is not so employable in habeas corpus proceedings.
ORS 34.370 provides:
"The court or judge to whom the petition [for a writ of habeas corpus] is presented must allow the writ without delay, unless it appears from the petition itself, or from the documents annexed thereto, that the person for whose relief it is intended is by the provisions of ORS 34.310 to 34.730 prohibited from prosecuting the writ. * * *"[5]
*1053 In the order he signed on October 22, 1986, the trial judge found from the allegations of the petition "that grounds exist for this Court to inquire into the legality of the imprisonment or restraint of named Petitioner, presently in the custody of the Respondent * * *." So finding, the trial court ordered issuance of the writ. The writ was issued and served. To the writ defendant made his return, and thereafter plaintiff filed a replication.
When the writ issued, the petition ceased to have any function. As this court stated in State ex rel. Sorensen v. Baird, 201 Or. 240, 247-48, 269 P.2d 535 (1954):
"The function of a petition for a writ of habeas corpus is to secure the issuance of the writ, and when that is issued, the petition has accomplished its purpose. Generally, the petition is not considered as part of the pleadings. Of course, there are cases where, upon stipulation of the parties, the petition is treated as the answer or traverse to the return to the writ, and, in such instances, it does form a part of the pleadings. However, ordinarily, upon the issuance of the writ, the petition becomes functus officio. The return to the writ is the principal pleading and corresponds to the complaint in civil actions. Strict rules of pleading are not usually applied to petitions for writs of habeas corpus, and often the writ is issued upon more or less informal applications. In proper cases, it should never be denied upon mere technicalities of pleading. The petition in the instant case was amply sufficient to demand the issuance of the writ. Quinn v. Hanks, 192 Or 254, 268, 233 P.2d 767; In re Davenport, 114 Or 650, 655, 236 P 758; 39 CJS 625, Habeas corpus; § 80, p 651; § 88."[6]
By the time the motion was filed, the only pleadings were the return and the replication. The motion directed against the petition was not proper and should not have been entertained.[7]
Plaintiff did not, however, resist the motion on this basis. The procedure that was here followed does not bring into question the jurisdiction of either the Court of Appeals or this court. For guidance in future cases, we have noted the error in proceeding in the manner here employed in the trial court, but we are not disposed to have the decision at this level turn on that error because, in all the circumstances, it was harmless error.
We come now to the issue posed at the outset of this opinion. We agree with defendant that although it is the responsibility of the Department of Corrections[8]*1054 under ORS 137.320(3) and 137.370(2)(a) to give credit for time served after arrest for the crime for which sentence was imposed, this responsibility does not arise until the sheriff who may have had the arrestee confined has complied with the sheriff's statutory duty under ORS 137.320. That is what the statutes provide, and we perceive no reason for concluding that they do not mean what they say.
That being so, plaintiff is not entitled at this point to have the Department of Corrections or defendant credit any time served in jail against his sentence.
The foregoing discussion assumes that the sheriff in question has not complied with ORS 137.320(1). If the sheriff has complied, an allegation of that fact and proof thereof would suffice to spark the duty of the Department of Corrections properly to compute the amount of sentence served.
Plaintiff's position has assumed that the sheriff has not complied, but he has argued that his remedy must be by habeas corpus against the person who has him confined because there is no other timely remedy available to him. For this he relies on the language quoted above from Penrod/Brown v. Cupp, supra. Want of a timely remedy alone is not sufficient. That want must be coupled with a need for immediate judicial scrutiny in order for the rule of Penrod/Brown to apply. Plaintiff has not shown a need for that immediate scrutiny. Perhaps if he could show that he would be entitled to actual release from the penitentiary by showing that he deserved the claimed credit of 210 days, that would be sufficient to require immediate judicial scrutiny and demonstrate the want of other timely remedy.
Without here deciding his right to prevail, we note that injunction, declaratory judgment or mandamus proceedings might be vehicles for plaintiff to cause the sheriff to perform the duty mandated by ORS 137.320(1) if the sheriff has not already done so.[9] We realize that an indigent inmate faces difficulties in prosecuting those kinds of proceedings and often turns to habeas corpus because that is the only form of proceeding in which he is entitled to the services of a lawyer. See Penrod/Brown v. Cupp, supra, 283 Or. at 27, n. 8, 581 P.2d 934. That does not permit the courts, however, to grant the relief plaintiff seeks in this proceeding on this record.
The decision of the Court of Appeals and the judgment of the trial court are affirmed.
NOTES
[1]  At the time this plaintiff received a sentence of imprisonment for conviction of a felony, ORS 137.124 provided that the convict must be sentenced to the legal and physical custody of the "Corrections Division." Since then the Corrections Division has been replaced by the "Department of Corrections." See ORS 137.124 (amended by Or Laws 1987, ch 320, § 30); ORS 179.010 (amended by Or Laws 1987, ch 320, § 106, and Or Laws 1987, ch 321, § 11). The Oregon State Penitentiary, of which defendant is superintendent, is the "Department of Corrections institution for the imprisonment of male persons committed to the custody of the Department of Corrections," ORS 421.605, and is the institution in which plaintiff is confined.
[2]  In answer to a question posed by this court, plaintiff implicitly acknowledged that if he were given credit for the 210 days, he would not be entitled to immediate release from defendant's custody because of the length of time yet to be served under the sentences described in the return. He stated that "plaintiff is asking that he be released from the additional restraint against him by reason of the defendant's failure to give him credit for time served."
[3]  ORS 137.310 provides:

"(1) When a judgment has been pronounced, a certified copy of the entry thereof in the register shall be forthwith furnished by the clerk to the officer whose duty it is to execute the judgment; and no other warrant or authority is necessary to justify or require its execution.
"(2) The defendant may be arrested and detained in any county in the state by any peace officer and held for the authorities from the county to which the execution is directed. Time spent by the defendant in such detention shall be credited towards the term specified in the judgment."
It appears that this statute is not applicable to plaintiff's claim. Indeed, on appeal to the Court of Appeals, plaintiff argued that ORS 137.320 was the applicable statute. Pertinent parts of that section were:
"(1) When a judgment includes commitment to the legal and physical custody of the Corrections Division, the sheriff shall deliver the defendant, together with a copy of the entry of judgment and a statement signed by the sheriff of the number of days the defendant was imprisoned prior to delivery, to the superintendent of the penal or correctional institution to which the defendant is initially assigned pursuant to ORS 137.124.
"* * *
"(3) Upon receipt of the information described in subsection (1) or (2) of this section, the Corrections Division shall establish a case file and compute the defendant's sentence in accordance with the provisions of ORS 137.370.
"* * *."
[4]  ORS 137.370 provided:

"(1) When a person is sentenced to imprisonment in the custody of the Corrections Division, the term of confinement therein commences from the day the person is delivered to the custody of an officer of the Corrections Division for the purpose of serving the sentence executed, regardless of whether the sentence is to be served in a state or federal institution.
"(2) Except as provided in subsection (3) of this section, when a person is sentenced to imprisonment in the custody of the Corrections Division, for the purpose of computing the amount of sentence served the term of confinement includes only:
"(a) The time that the person is confined by any authority after the arrest for the crime for which sentence is imposed; * * *
"* * *."
[5]  ORS 34.310 to 34.730 are the entire set of sections pertaining to habeas corpus. Defendant has not contended that plaintiff is prohibited by these sections from prosecuting the writ.
[6]  The reference to "traverse" is to the "replication" authorized by ORS 34.670 and the statutes of this state ever since the Deady Civil Code, section 618.

We agree that, especially in the case of a layperson proceeding pro se, strict rules of pleading should not be used to test petitions in determining whether to issue a writ. On the other hand, once the writ is issued, the statutes require a highly formalized procedure, including production of the body. The procedure authorized in federal court by 28 USCA § 2243 has appeal in those cases where a court or judge to whom a petition is presented may have serious doubt whether to issue a writ. In lieu of issuing a writ, the federal court or judge may issue an order directing the respondent to show cause why a writ should not be granted. We commend to the legislature consideration of amendment of ORS 34.370 to allow that alternative.
[7]  In a memorandum to this court, defendant suggested that any new matter in a replication can be stricken under ORS 34.680, and the text of the statute supports that suggestion. Because we believe that that is probably not what the statute intends, however, we note the following. Prior to amendment in 1979 (Or Laws 1979, ch 284, § 74), ORS 34.680 provided that the defendant in habeas corpus could demur to any new matter in the replication. The substitution of "move to strike" for demur appears to have been nothing more than an amendment adopted throughout the civil code to bring the rest of the code into line with the new Oregon Rules of Civil Procedure, which had eliminated the demurrer from the lexicon of civil pleading. We do not have to decide here whether the motion now authorized by ORS 34.680 serves any function not formerly served by demurrer, but we note the possibility.
[8]  Even though defendant is employed in the Department of Corrections, plaintiff has not contended that it is defendant's personal responsibility to make the computation of sentence served.
[9]  Again, without deciding who might prevail, we believe that sheriffs and their legal advisers might consider the possibility of actions for damages for failure to perform the statutory duty. At least, the cost of defense might make compliance the lesser of two loads.
