Ivan Davidson has petitioned this court for a writ of habeas corpus. He alleges in his petition that he is imprisoned and restrained of his liberty at the State Penitentiary at Bismarck, Burleigh County, North Dakota; that his application for habeas corpus has been denied by the District Court of Burleigh County; that the cause or pretense of such confinement or restraint is that he is held under a sentence by the District Court of Cass County for the “crime of conviction of three or more felonies prior to his conviction of rape in the first degree on Jan. 7,1948,” and that the imprisonment is illegal as there is no such crime either at common law or by statute. An order to show cause was issued upon said petition. The warden made his return attaching thereto a copy of an order denominated “sentence” and a commitment issued out of the District .Court in and for the County of Cass, State of North Dakota, on the 16th day of January 1948 by virtue of which he was holding and restraining the petitioner. A hearing was had. Upon that hearing the attorney general filed the transcript and files of the proceedings on sentence.
The scope of the inquiry upon an application for a writ of habeas corpus and the rules which must be applied in determining whether a writ of habeas corpus should issue is thoroughly discussed by Judge Christianson for the court in the case of Ryan v. Nygaard, 70 ND 687, 694, 297 NW 694, 700. The conclusion is reached that the writ of habeas corpus cannot be utilized as a substitute for an appeal or writ of error; that the inquiry is limited to questions of jurisdiction. State ex rel Smith v. Lee, 53 ND 86, 205 NW 314; Cook v. State, 54 ND 178, 208 NW 977; In re Cook, 54 ND 193, 209 NW 231.
*143“ ‘To have jurisdiction is to have the power to inquire into the facts and apply the law’ .... A court has jurisdiction of the cause when the laws of the sovereignty in which the tribunal exists grants it power over the subject -matter and to adjudge .concerning the general question involved. Bouvier’s Law Dict., Hunt v. Hunt, 72 NY 217, 28 Am Rep 129 . . . when a court has jurisdiction of a cause and of the parties, it does not lose jurisdiction because it makes a mistake in determining either the facts or the law or both. Jurisdiction does not depend upon the correctness of the decision made.” Reichert v. Turner, 62 ND 152, 157, 242 NW 308.
Attacks on a judgment by habeas corpus are collateral. A judgment cannot be impeached for error or irregularity anterior to a judgment unless they amount to- a lack of jurisdiction. Jurisdiction is ordinarily defined as the power to hear and determine. No mere error or irregularity in its exercise can ordinarily render a judgment null. See Secs 1546, 1548, 1554, 3 Freeman on Judgments, pages 3172, 3179, and 3193. See also Mazakahomni, Petitioner v. State of North Dakota, 75 ND 73, 25 NW 2d 172.
. “Unless a judgment is an absolute nullity, imprisonment under it cannot be unlawful; and it is not a nullity, though erroneous, if the court has. general jurisdiction, and, until reversed, cannot be disregarded.” 15 Am Jur Judgment and Sentence, Sec 442, p 102.
“Upon habeas corpus the court ordinarily will inquire no further than to determine whether the court had jurisdiction. The jurisdictional inquiry will extend to the question of the jurisdiction of the court over the person and the subject matter, and to its power to make a particular order or judgment entered in the proceedings.” In re Solberg, 52 ND 518, 203 NW 898.
It appears that on Dec. 22, 1947, a criminal information was filed against the petitioner charging him with committing the crime of rape in the first degree. To that information he pleaded not guilty. A trial was had before a jury in Cass County and on January 7, 1948, petitioner was found guilty of rape in the first degree. No question is raised of the court’s jurisdiction of the *144petitioner and of the rape prosecution. The petitioner was represented by counsel throughout all the proceedings.
On January 16, 1948, before sentence was passed upon his conviction for rape the state’s attorney by leave of the court filed an information against the petitioner under the habitual criminal statute, Sec 12-0623 NDRC 1943, which provides that: “If at any time before judgment and sentence, ... it shall appear that one convicted of a felony, previously has been convicted of crimes as set forth in Sections . . . 12-0621 (3 or more times), the state’s attorney of the county in which .such conviction was had shall file an information with the court in which such conviction was had accusing such person of the previous convictions.”
In that information the state’s attorney accused the petitioner of: “Committing the crime of conviction of three or more felonies prior to his conviction of rape in the first degree on January 7,1948 and charges that heretofore, to wit: On the 7th day of January 1948, in the County of Cass and State of North Dakota, the said defendant was duly convicted of the crime of rape in the first degree; that prior thereto, the said defendant was duly convicted on the 21st day of June 1944 in'the District Court of Cass County, North Dakota of the crime of burglary in the third degree and was sentenced to the State Penitentiary' at Bismarck for a term of from three to five years; that prior thereto and on or about the 25th day of October 1939, the, said defendant was duly convicted of the crime of burglary in the District Court Griggs County, North Dakota, and was sentenced to the ‘State Penitentiary at' Bismarck for a term of ten years; that prior thereto and on or about the 25th day of October, 1939, the said defendant was duly convicted of the crime of grand larceny and was duly sentenced to the State Penitentiary at Bismarck for ‘a term of three years, to run concurrently with the prior sentence imposed on the same date; that prior thereto and on the 20th day of June 1935, the said defendant was duly convicted in Wolf Point, Montana of the crime of burglary and was duly sentenced to the State Penitentiary at Deer Lodge Montana for a term of five years; that prior thereto and on or about the 21st day of April Í932, the said defendant was duly convicted in *145the District Court of Foster County, North Dakota of the crime of burglary in the third degree and was duly sentenced to the State Penitentiary at Bismarck for a term of three to five years; that prior thereto the said defendant was on or about the 6th day of June 1931 duly convicted of the crime of burglary in the third degree in the District Court of Griggs County, North Dakota and was duly sentenced to a term in the State Penitentiary at Bismarck of one year.
Error is claimed because the state’s attorney in the caption or formal part of that information accused the petitioner of “committing the crime of conviction of three or more felonies. . . It is true that phrase names no crime. It, however, is not a material part of the information. In Ex parte Bailey, 60 Okla Cr 278, 64 Pac2d 278, it is held that “The fact thát the information designated the offense as the crime of ‘being an habitual criminal’ is immaterial as the offense charged depends upon the facts alleged.” The statute, Sec 12-0623 NDRC 1943, requires the state’s attorney to file an information “accusing such person of previous convictions.” In the body'of the information the state’s attorney set the previous convictions out in detail. That is the material part of the information. “The body or charge of an information is the substantial part thereof. It sets forth the offense and determines the character of the charge.” 42 CJS Indictments and Informations, Sec 81, p 942. See also State v. Findling, 123 Minn 413, 144 NW 142, 25 Am Jur Habitual Criminal, Sec 26, p 273.
This court has passed upon this matter in State v. Bossart, 62 ND 11, 17, 241 NW 78. The formal part of the information charged the defendant with grand larceny. The jury found him guilty of grand larceny. A. new trial was granted because the charging part of the information did not charge grand larceny. The charging part alleged that the goods stolen were of the value of $20.00. This court held:
“This is the important part of the information and it only charges petit larceny. ‘The caption (or formal part) of an indictment or information need not state or describe the offense charged, and if it does so, any misstatement therein or variance *146from the indictment will he immaterial.’ (Citing 31 CJ 609, Sec 90 and numerous other cases.) It follows as a matter of course that defendants could only be tried for and convicted of petit larceny as charged in the information.”
The information alleges the facts of the previous convictions. That was the gist of the information. The misnomer in the formal part is immaterial. The requirements of the statute were fulfilled. The information was sufficient to give the court jurisdiction of the proceedings under the habitual criminal act, Sections 12-0621 and 12-0623 NDE.C 1943, in connection with the present conviction of the crime of rape.
The transcript of the proceedings upon sentence shows that after the filing of that information the proper arraignment of the petitioner was had. He was asked his true name by the state’s attorney. He was advised by the court that: “You have the right, if you wish it, to a trial on this charge, and you have the right to have the charges made in this information proved by the state, or you may enter a plea at this time of either guilty or not guilty to each one of these charges as made in the information. In other words, you .may admit or deny and if you deny them it is up to the state to prove them. I also inform you that if these charges are proved the penalty which can be imposed can be no greater than the penalty under the crime for which you . were convicted in this county on the 7th day of January of this year.”
The petitioner’s counsel then asked the court whether the petitioner,, if he pleaded “guilty to the habitual criminal act,” could be later sentenced on the first degree rape charge. The court answered: “If he admits these charges that are made here and is sentenced upon this information that precludes a sentence upon the conviction of first degree rape, provided that the court has proper jurisdiction of this proceeding and that the sentence imposed is within the limits of the law. In other words, he is sentenced now upon this, if he admits it, rather than upon the rape charge but I simply informed him the maximum penalty under either is the same.” The petitioner then pleaded guilty.
It will be remembered that this last information alleged as *147its basis for bringing tbe prior convictions before the court that the petitioner had been convicted of rape in the first degree. On this conviction no sentence had been passed. That was still pending before the trial court. The trial court still had jurisdiction of the rape charge and what he had said in discussion with counsel prior to the passing of sentence did not divest him of that jurisdiction. Furthermore, the most reasonable interpretation that can be placed upon that discussion is that he was continuing to exercise jurisdiction over the rape charge and was including punishment for it in the sentence he was about to pass. Otherwise, the petitioner could have been sentenced later on the rape charge which the court said was precluded by the sentence he was going to pass. That that is what the court intended is further borne out by the proceedings taken by the court thereafter. What he did as well as what he said and all the circumstances surrounding the passing of the sentence must be considered in determining the court’s jurisdiction.
Before the sentence was passed the petitioner was asked if there was any legal cause why sentence should not be imposed. The defendant answered, “No”. Sec 29-2615 NDBC 1943, provides that: “If no sufficient cause is alleged or appears to the court why judgment should not be pronounced, it thereupon must be rendered.” In accordance therewith the court pronounced sentence upon the petitioner, which, with the material parts of the court’s introductory remarks, is as follows:
“The Court : Mr. Davidson, it is not my purpose at this time to lecture you or preach any sermon. The record largely speaks for itself. The passing of sentence in criminal actions has different elements connected with it,, one being the punishment for the actual offense committed, the other the hope of humanity that by incarcerating people who are guilty of crime they may see the errors of their ways and reform. From your record it would appear that your previous confinements to the prison have not effected that. . . . The crime of which you were convicted on January 7th. was one which is most abhorrent to society, an attack upon a young girl, who has the right to be secure in her person and the enjoyment of life. And the fact that you had no reasonable explanation of why you were-picked *148up at approximately midnight on the night of the crime, that you were in such condition that some explanation had to be made, and you had none to offeT, and that the scientific testimony in the case shows beyond any reasonable doubt that you were guilty of it; in view of your past record, and in view of that crime, there is nothing for me to do but to accept the recommendation of the state’s attorney and impose the sentence I am going to impose.
“And it is the sentence that you, Ivan Wilford Davidson, be, confined to the state penitentiary, at Bismarck, North Dakota, at hard labor, for the balance of your natural life.”
See 29-2623 NDRC 1943, provides that: “When judgment upon the conviction is rendered the clerk must enter the same upon the minutes. . . .” In accordance therewith the record shows that the clerk entered the following upon his minutes: “It is the sentence of this court that you, Ivan Wilford Davidson, be confined to the state penitentiary, at Bismarck, North Dakota, for life.” After that a purported, written copy denominated “sentence” was signed as follows:
“Now, on this 16th. day of January A.D. 1948, the State’s Attorney in and for the County of Cass, State of North Dakota, and the defendant, Ivaii Wilford Davidson come into court, and this being the day fixed by the court for the pronouncing of judgment upon conviction of the defendant, above named, of the crime of conviction of three or more felonies prior to his conviction of rape in the first degree on Jan. 7, 1948, as charged in the information heretofore filed against said defendant, in this court; and the defendant being informed by the court of the nature of the information and of his plea of “guilty” and the-verdict, and being asked whether or not he has any legal cause to show why judgment should not be pronounced against him, and none being shown, the court does adjudge, and the sentence of the court is that you, Ivan Wilford Davidson, be imprisoned in the Penitentiary, at Bismarck, in said state, .for the term' of life imprisonment at hard labor commencing at twelve o’clock, noon, of this day, and that you stand committed until the sen*149tence be complied with or until discharged by due process of law.
By the court,
John C. Pallock, Judge
Attest: Theo L. Hanson,
Clerk.”
That is the process that was delivered to the warden. No appeal was taken. The petitioner claims that because this written copy, denominated “Sentence” recites that “This being the day fixed by the court for the pronouncing of judgment upon conviction of the defendant above named of the crime of conviction of three or more felonies prior to his conviction of rape in the first degree on Jan. 7, 1948, as charged in the information heretofore filed, . . .” the sentence passed is on a non-existent crime and void. That instrument, however, is not the sentence in the instant case.
The procedure for sentencing under our laws is provided by Sections 29-2601 to 29-2615 NDBC 1943, inclusive. Under Sec 29-2615 sentence is pronounced orally in open court. There is no provision for any other way of passing sentence. . The clerk must enter the same upon the minutes. Sec 29-2623. To execute said judgment a certified copy of the entry upon the minutes is furnished the executing officer, See 29-2701, and delivered to the warden if judgment is to the penitentiary, Sec 29-2705. The proceedings under these sections provide the method of the sentencing and of the execution of the judgment. The oral sentence pronounced, Sec 29-2615, is the judgment of the court and prevails over any change made in .the written copy.
This court so held. In re Perry, 70 ND 599, 297 NW 132, the trial court pronounced a sentence of a fine of $50.00 and 60 days in jail. In the written judgment thereafter signed by the court the following provision was added: “Upon failure to pay said fine you shall serve an additional day in said Stark County jail for every $2.00 of • said fine remaining unpaid.” This court held: “That the judgment ¡pronounced orally and not the written judgment subsequently entered by the court fixes the sentence.” The punishment inserted in the written judgment for non-payment of the fine was held void. That applies to the additional language used in the copy of sentence in the case at bar.
As before stated the sentence orally pronounced and hereto*150fore quoted is the judgment in the case at bar. It does not in so many words name the crime upon which it was passed. It otherwise fixes the terms thereof. The question arises what was the crime for which it was imposed. That has to be determined from the whole record of the proceedings.
“A sentence, as any other judgment, is construed in its entirety according to the usual canons of construction and so as to give effect to the intent of the sentencing court.” 24 CJS Construction of Sentence, Sec 1585, p 114. See also Fredericks v. Snook, Circuit Court of Appeals, Fifth District, 8 Fed2d 966; Hambrick v. State, 80 Fla 672, 86 So 623.
In Watson v. Lawson et al, 166 Cal 235, 135 Pac 961, the court held: “Where the language of a judgment is in any degree uncertain the court may properly refer to the circumstances surrounding the rendition thereof and to the condition of the cause in which it has been entered, and consider- it in regard to the law regulating the rights of the parties.” See also People ex rel Sammons v. Hill, Warden, 345 Ill 103, 177 NE 723; Casey v. State, 19 Ala App 317, 97 So 165; People v. Barnnovich, 16 Cal App 427, 117 Pac 572; 1 Bishop New Criminal Procedure, Sec 1348, p 823.
In the case of Pointer v. U. S. 151 US 419, 14 Sup Ct 410, 38 L Ed 208, an objection was made because the final judgment did not name the crime for which the sentence was passed. The court said:
“The specific objection to the sentence is that it does not state the offense of which the defendant was found guilty, or that the defendant was guilty of any named crime. This objection is technical, rather tha-nv substantial. . . . While the record of a criminal case must state what will affirmatively- show the offense, the steps, without which the sentence cannot be good, and the sentence itself, ‘all parts of the record are to be interpreted together, effect being given to all, if possible, and a deficiency at one place may be supplied by what appears in another.’ ” See also State v. Cook, 92 Iowa 484, 61 NW 185.
In Ex parte Gibson, 31 Cal 620, 91 Am Dec 546, the petitioner asked for a writ of habeas corpus on the ground that the process under which he was held was defective in the. matter of the sentence required by the law, and therefore void, The process *151held by the warden was held void bnt the attorney general then presented a transcript of the proceedings and the final judgment rendered by the court under which he claimed-petitioner should be held. That judgment was: “That you, William P. Gibson, be taken by the sheriff of Calaveras County to the state prison of the State of California, and there be confined for the period of ten years from the date of your conviction.” The objection raised to that judgment was that it did not state the offense of which he was convicted; and in view of that omission, it was claimed that it was void, and therefore, furnished no legal warrant for the detention of the prisoner. This objection was founded upon the terms of Sec 462 of the California Criminal Practice Act, (See 1207 Deering’s 1931 Penal Code) which require a clerk, in entering a judgment of conviction, “To state briefly the offense for which the conviction has been had.” That provisiones embodied verbatim in our Sec. 29-2623 -NDRC 1943. The court set forth some of the requirements that should, according to law be stated in the judgment, but said:
“But while all this ought regularly and properly to appear in the entry of judgment it does not follow that the omission of some of them or any of them, will render the judgment erroneous, much less void. . . . Whether this judgment, then, is absolutely void or not is merely a question of jurisdiction. If it appears that the court had jurisdiction of the subject matter and the person of the defendant . . . the judgment is not void, however erroneous it may be, unless it is so uncertain in its terms as to be void on that ground. But no question of the latter character is made in this case.”
Indefiniteness of the terms of the sentence is not raised in the case at bar. Neither is there any question that the trial court had jurisdiction to sentence upon the crime of rape in the first degree of which the petitioner had just been convicted and which was pending before him for sentence. The trial court acted fully within his power. A life sentence could be given for either rape in the first degree or under the habitual criminal act. The court in Ex parte Gibson, supra, finally said: ■ “The judgment in this case may be erroneous in not stating more definitely the offense of which the prisoner was convicted, but I am satisfied that it is not void. My conclusion is, that the process now in the *152hands of the warden of the state prison is sufficient to justify the detention of the prisoner until the expiration of the ten years' for which he was sentenced.”
In the case of Convey v. Haynes, 230 Iowa 485, 298 NW 647, a writ of habeas corpus was sought on the ground that the court, after receiving a plea of guilty of murder, had failed to ascertain by examination of Witnesses the degree of murder as provided by Sec 12913 of the Iowa Code, 1939, which provides: “The court must, by examination of witnesses, determine the degree, and . . . must enter judgment and pass sentence accordingly.” The court held that there was jurisdiction in the district court; that jurisdiction was not lost by that error in procedure and that the judgment rendered could not be reviewed in a habeas Corpus proceeding. To the same effect is McCormick v. Hallowell, 215 Iowa 638, 246 NW 612.
In the case of Goodman v. Kunkel, Warden, Circuit Court of Appeals, Seventh Circuit, 72 Fed Rep 2d 334, the petitioner sought a writ of habeas corpus to obtain his discharge from the state prison. He had been convicted upon an indictment charging him in Count 1 of feloniously breaking into and entering a dwelling in the night-time with intent to steal goods and chattels, in Count 2 of feloniously stealing goods and' chattels, etc., and in Count 3 with having been convicted, sentenced and imprisoned in penal institutions three times and setting out the record of said convictions. The jury found him guilty on the burglary count and “that the defendant is an habitual criminal.” The court failed to sentence him under his conviction of burglary but rendered a life sentence under the habitual criminal act. That act, Sec 2340 of the Indiana Statute (Burns’ 1926) provided that: “If the trial jury, in their verdict, find these facts to be true, and convict such defendant of the third felony, the trial court, after passing sentence of imprisonment for a specific term. (Italics ours) as prescribed by the statute, shall proceed to sentence the defendant to imprisonment for his or her life.” It Was contended by the petitioner that his conviction under Count 3 was void; that finding him to be an habitual criminal was not conviction under Count 3 wherein only the former convictions were alleged and “that the sentence of. the court fails to follow the statute, in that it did not senténce him for the *153specific crime alleged in Count T; that, therefore, the court was without jurisdiction or power to impose the sentence which it did impose and the judgment and sentence are void. . . .” The court held that the habitual criminal statute did not create a new or independent crime and that finding the prisoner to be “an habitual criminal” did not comply with the requirements of the Indiana Criminal Statute. It also found that the court failed to comply with Sec. 2340, supra, in not passing the statutory sentence on a burglary conviction, “but imposed the sole sentence of life imprisonment — a sentence which the specific offense of which the appellant was sentenced does not carry.” But the court held, citing many Indiana cases, that these irregularities were the basis for only a collateral attack on the judgment and not grounds for granting a writ of habeas corpus. And the court held the trial court was not deprived of jurisdiction by such irregularities.
It will be noticed that in the above case the irregularities of the trial court in the sentencing were similar to those in the case at bar. In both cases the trial courts failed to sentence separately and distinctly upon the principal crime as the statute required. In both cases only one sentence was passed. In both cases the sentence was irregularly passed in connection with the habitual criminal act.
The petitioner relies on the case of Ex parte Watt, (SD) 44 NW2d 119. That also was upon a petition for writ of habeas corpus. The facts, however, distinguish that case from the one at bar. In that case the petitioner had been charged under the information in Count 1 with grand larceny, and in Count 2 with burglary in the third degree. He pleaded guilty to both counts. Then a second information was filed charging him with being an habitual criminal and alleging his convictions of four prior felonies, to which informationhe'entered a plea of guilty. Thereupon the court sentenced him on Count 1 to be imprisoned in the state penitentiary for five years and on Count 2 for ten years, after that he sentenced him, separately, “upon the information charging him as being an habitual criminal to life imprisonment.”
*154In Ex parte Watt the trial court passed sentence upon the petitioner on the substantive offenses alleged in Count 1 and Count 2 of the information under the statute providing the punishment for those particular crimes. The court exhausted his power and jurisdiction to pass any further sentence for those crimes. The petitioner .served- his time under these sentences. The court attempted to pass a third sentence upon the petitioner, not to' augment the punishment for the crimes for -which he had been already sentenced, but for the crime of being, “an habitual criminal.” ■ There being no such crime the court held the sentence attemptéd to be passed upon it was beyond -the jurisdiction of the trial court and void. The facts with regard to the sentencing in the case at bar are different so this holding is not in point. Considering the record and circumstances as they appear from .the files and transcript filed on the hearing, in the -light of'these authorities, it is clear that the trial court in the instant case had jurisdiction of the prosecution and conviction of the petitioner for the crime of rape; that he had jurisdiction of the proceedings filed under the habitual criminal act; -that the information filed under that act set .out not only "the six prior convictions but also, as a basis for the application of the habitual criminal act, linked it to the conviction of rape in the first degree on which no sentence had been passed but of which the court still had jurisdiction; that the petitioner was duly arraigned and informed of his rights under that information and admitted the charges therein; that there was then pending before the court the conviction of 'petitioner for rape in the first degree on which no sentence had been passed 'and his record of six prior convictions ;-thát prior to sentence the' attorneys for both the defendant and the state addressed the court in which addresses both of them referred to the petitioner’s conviction of the crime of rape; "that the trial court in pronouncing the oral sentence as heretofore set forth stressed the crime of rape and said that “In view of your past record and in view of this crime” (the rape) he .was going to impose the sentence he did impose. All these circumstances indicate that the intention of the trial court-was to impose -a sentence for the crime of rape taking into considera*155tion the prior convictions in determining the length of that sentence.
“An interpretation will not be adopted which is inconsistent with the court’s jurisdiction. In construing any portion of the language of a judgment, while it should be taken in its ordinary legal meaning it must be considered in connection with its context and the judgment as a whole, and the circumstances surrounding the making of the judgment — the conditions of the cause in which it was rendered.” Freeman on Judgments, Vol 1, Par 76, p 133.
“Every presumption must be indulged in support of the judgment. Error or the abuse of discretion in the exercise of jurisdiction does not constitute the want of jurisdiction.” People v. Kaiser, 135 NY Supp 274, 281.
“Whenever a judgment is susceptible of two interpretations one of which is within the power of the judge the other is not, the first must be preferred.” Copley v. William Robertson, Trustee, 23 La Rep 155, 6 La Ann 181.
Applying the foregoing rules of construction to the facts in this case it seems clear that the interpretation that should be given to the sentence imposed is that it was a sentence for the crime of rape in the first degree as augmented under the provisions of the habitual criminal act. The sentence was within the jurisdiction and power of the trial court. It is not void. Any irregularities in the procedure are not matters that can be considered on a petition for habeas corpus.
The application for a writ of habeas corpus is hereby denied.
Sathre, J., concurs.