
287 So.2d 914 (1973)
In re Matthew Marshall MORGAN, Jr.
v.
STATE of Alabama.
Ex parte Matthew Marshall Morgan, Jr.
SC 543.
Supreme Court of Alabama.
December 13, 1973.
Roy D. McCord and J. Terry Huffstutler, Jr., Gadsden, for petitioner.
William J. Baxley, Atty. Gen., and Otis J. Goodwyn, Asst. Atty. Gen., for the State.
FAULKNER, Justice.
Matthew Morgan, a youth of 19 years of age, was tried by a jury of Marshall County Circuit Court on an indictment charging him with the unlawful sale of 4 grams of marijuana. He was found guilty. Morgan was afforded an election by the trial judge, to be sentenced under the old Controlled Substance law or the new Controlled Substance law. He elected to be sentenced under the new law and was sentenced to three years in the State penitentiary by the trial judge. His conviction and sentence *915 were affirmed by the Alabama Court of Criminal Appeals.
Morgan was indicted in October, 1971, and tried on November 16 and 17, 1971. He was sentenced on November 17, 1971. His motion for new trial was denied December 20, 1971. He appealed to the Court of Criminal Appeals on December 29, 1971.
While Morgan's case was on appeal, the legislature of Alabama passed the Youthful Offender Act, which became effective February 10, 1972. He filed a petition for a writ of certiorari in this court to the Court of Criminal Appeals, alleging in substance that he is entitled to be treated as a youthful offender and should be punished under the provisions of the Youthful Offender Act.
Act 335, Alabama Legislature, Third Special Session, 1971, known as the Youthful Offender Act, has been codified as Tit. 15, § 266(1) (2) (3) (4) (5) (6), Code of Alabama, 1940, Recompiled 1958.
Section 266(1) provides that "a person charged with a crime which was committed in his minority but was not disposed of in juvenile court and which involves moral turpitude or is subject to a sentence of commitment for one year or more shall and, if charged with a lesser crime, may be investigated and examined by the court to determine whether he should be tried as a youthful offender, provided he consents to such examination and to trial without a jury where trial by jury would otherwise be available to him."
The Act therefore charges the trial judge with the duty to refer any person under 21 years of age, whose case has not been disposed of in the juvenile court and who is charged with a crime involving moral turpitude or is subject to a sentence of confinement for one year or more, to a probation officer to make such investigation requested by the court. Referral in such event is not discretionary, but mandatory, on the part of the trial judge. After the investigation, if the youth consents to examination by the court and trial without a jury, and the court so decides, no further action is taken on the indictment or information unless ordered by the court. After investigation and examination, it is within the discretion of the trial judge whether the youth shall be tried as a youthful offender. The duty is upon the trial judge to call the Act to the attention of the youthful offender, just as much as it is the duty of the trial judge to explain to a defendant his constitutional rights when he enters a plea of guilty.
In the case before us the Act was not effective until February 10, 1972, and the Act is not retroactive. After appeal the trial court lost jurisdiction. We cannot see how the trial judge could call the Act to the attention of Morgan when it was not law at the time of trial. The Alabama Court of Criminal Appeals held in Armstrong v. State and Fowler v. State, 49 Ala.App. 720, 275 So.2d 698 (1972), cert, denied 290 Ala. 256, 275 So.2d 702, that the defendants were not entitled to raise for the first time on appeal that the trial court committed reversible error in not affording them the benefits of the Youthful Offender Act. The function of a writ of certiorari extends only to questions of jurisdiction of a subordinate tribunal, and the regularity of its proceedings. It is to correct errors on the face of the record. See 4 Ala.Dig., and 14 C.J.S. Certiorari § 1 et seq. There is no error on the face of the record.
Affirmed.
MERRILL, HARWOOD, MADDOX and JONES, JJ., concur.
