
146 Cal.App.3d 12 (1983)
193 Cal. Rptr. 849
THE PEOPLE, Plaintiff and Appellant,
v.
PATRICIA KAY WATSON, Defendant and Respondent.
Docket No. 12186.
Court of Appeals of California, Third District.
August 15, 1983.
*15 COUNSEL
George Deukmejian and John K. Van de Kamp, Attorneys General, Robert H. Philibosian, Chief Assistant Attorney General, Arnold O. Overoye, Assistant Attorney General, Roger E. Venturi and Edmund D. McMurray, Deputy Attorneys General, for Plaintiff and Appellant.
Russell J. Swartz for Defendant and Respondent.
OPINION
PUGLIA, P.J.
Defendant Patricia Kay Watson was charged by information with possession for sale (Health & Saf. Code, § 11378) and sale (Health & Saf. Code, § 11379) of amphetamines. Claiming a lack of compliance with Penal Code section 869, defendant filed written objection at arraignment in the superior court to the reporter's transcript of the preliminary hearing. The court ordered that transcript sticken and dismissed the information pursuant to Penal Code section 995. The People appeal. (Pen. Code, § 1238, subd. (a)(1). All further statutory references are to sections of the Penal Code unless otherwise indicated.)
*16 We shall summarize the salient points of our decision. Section 869 provides that the magistrate, on demand of the prosecutor, the defendant, or his counsel, must cause the testimony of a witness at the preliminary examination to be reduced to writing, which testimony must state, among other things, the witness' place of residence. At issue in this appeal is the consequence of the magistrate's failure to comply with that provision where he has held the defendant to answer for trial in the superior court. After first deciding that the appeal is properly taken, we determine that the requirement of section 869 to which we have alluded is directory only, although it does impose an obligatory duty on the magistrate to order the witness to disclose his place of residence. Accordingly, the magistrate's failure to discharge that obligatory duty does not in itself render the commitment of defendant illegal. Among its other functions, section 869 serves to implement the constitutional right of cross-examination which ordinarily requires an adverse witness, when asked, to disclose his place of residence. However, this constitutional right does not inflexibly compel the witness to respond if disclosure would create a threat to his safety. Here, as proponent of the witness, the People bear the burden of so showing by competent evidence. Although there was no such competent showing here, the defendant's constitutional right of cross-examination was not impaired by the magistrate's refusal to compel the prosecution's chief witness to state his place of residence, because adequate evidence bearing on the witness' credibility was before the magistrate. As a result, defendant was not deprived of a substantial right at the preliminary examination. We will therefore reverse the judgment of dismissal.

I
(1) Preliminarily, we address the propriety of the appeal. As defendant made no formal section 995 motion, she contends the trial court had no authority to treat her written objection to the preliminary hearing transcript as such a motion and to order dismissal thereon; accordingly, defendant contends, the People have no right of appeal from the order of dismissal. The argument fails for several reasons.
First, even assuming the absence of jurisdiction to order dismissal under section 995, the People are not deprived of the right of appeal therefrom if they otherwise would have such a right. (See People v. Smith (1983) 33 Cal.3d 596, 599-600 [189 Cal. Rptr. 862, 659 P.2d 1152].) The right to appeal such a dismissal is conferred by section 1238, subdivision (a)(1).
Second, the trial court had the authority on its own motion to dismiss the information "in furtherance of justice." (§ 1385.) The People may appeal a section 1385 dismissal where, as here, jeopardy has not attached (§ 1238, *17 subd. (a)(8); Bellizzi v. Superior Court (1974) 12 Cal.3d 33, 36 [115 Cal. Rptr. 52, 524 P.2d 148]). Regardless whether the dismissal is grounded on section 995 or section 1385, our review on appeal is the same, calling for an examination of the justification underlying the order. (See People v. Davis (1971) 20 Cal. App.3d 890, 898 [98 Cal. Rptr. 71].) Dismissal pursuant to section 995 rather than on the trial court's own motion under section 1385 was harmless.
Finally, defendant did not object to the dismissal in the trial court and therefore had waived review of the issue on appeal.
We turn to the merits of the appeal.

II
At the beginning of the preliminary examination, defendant moved to have the testimony reduced to writing under section 869. Insofar as relevant that section provides: "The testimony of each witness in cases of homicide must be reduced to writing, as a deposition, by the magistrate, or under his direction, and in other cases upon the demand of the prosecution attorney, or the defendant, or his counsel. The magistrate before whom the examination is had may, in his discretion, order the testimony and proceedings to be taken down in shorthand in all examinations herein mentioned, and for that purpose he may appoint a shorthand reporter. The deposition or testimony of the witness must be authenticated in the following form:
"First  It must state the name of the witness, his place of residence, and his business or profession; except that if the witness is a peace officer, it shall state his name, and the address given in his testimony at the hearing."
At the preliminary hearing Daniel Sharp, an informant, testified that he had purchased amphetamines from defendant. On cross-examination, defense counsel asked Sharp to state his current address. The prosecutor objected on the ground that disclosure of the address would pose a threat to the safety of the witness. Defense counsel insisted that section 869 absolutely requires the address of a witness be included in his testimony.
At the suggestion of the magistrate, the prosecutor made an offer of proof as to why Sharp would be endangered if his address was disclosed. The prosecutor stated that after the drug sale to Sharp by defendant, Sharp received a telephone call from a man whom he knew well; the caller also knew a Lawrence Smith. The caller "indicated" that a "threat to Mr. Sharp and/or his family was being made because of ... the witness's involvement in a case against Lawrence Smith." Defendant Watson and Smith were *18 living together at the time. In addition, on an occasion when Sharp was out of state, "shots were fired at him from an unknown person...." The magistrate ruled that the address need not be disclosed at the preliminary hearing.
In granting the motion to strike the preliminary hearing transcript and dismissing the information, the trial court explained: "Although the [prosecutor] attempted to show the magistrate that the witness' [Sharp's] life was in danger, the Court feels the magistrate should have required a more substantial showing to justify the refusal to reveal the witness' address."
(2a) Section 869, subdivision First, requires the testimony of a witness at a preliminary hearing "must state ... his place of residence."[1] The People characterize this statutory requirement as directory rather than mandatory.
(3a) If official failure to comply with a statutory procedure should have an invalidating effect on subsequent governmental action, the statute is said to be mandatory; if not, it is said to be directory (People v. McGee (1977) 19 Cal.3d 948, 958 [140 Cal. Rptr. 657, 568 P.2d 382]). In distinguishing these categories, the court, "as in all cases of statutory construction and interpretation, must ascertain the legislative intent. In the absence of express language, the intent must be gathered from the terms of the statute construed as a whole, from the nature and character of the act to be done and from the consequences which would follow the doing or failure to do the particular act at the required time. [Citation.] When the object is to subserve some public purpose, the provision may be held directory or mandatory as will best accomplish that purpose [citation], and the courts will look to see whether the provision is of the essence of the thing to be accomplished [citation]." (Pulcifer v. County of Alameda (1946) 29 Cal.2d 258, 262 [175 P.2d 1].)
(2b) That the statute is couched in obligatory language is not decisive. "Many statutory provisions which are `mandatory' in the obligatory sense are accorded only directory effect." (Morris v. County of Marin (1977) 18 Cal.3d 901, 908, fn. 4 [136 Cal. Rptr. 251, 559 P.2d 606].) Considering statutory language requiring that an application "must be filed" within a particular time, the Supreme Court has stated: (3b) "The general use of *19 the word `must' in an act does not ipso facto make the provision mandatory.... The words `shall' and `must' are frequently construed as directory terms" (Skelly Estate Co. v. San Francisco (1937) 9 Cal.2d 28, 33 [69 P.2d 171]). Indeed, section 869's coordinate requirement that a witness' testimony "must state ... his business or profession" has been held to be "directory merely and not mandatory" (People v. O'Shaughnessy (1933) 135 Cal. App. 104, 108 [26 P.2d 847]).
Section 869 comprehensively prescribes the procedures for reporting and transcribing preliminary examination proceedings and preparing, filing and distributing the transcript. The requirement that the residence of a witness be stated is subsidiary to the main statutory purpose, not "of the essence of the thing to be accomplished" (Pulcifer, supra, 29 Cal.2d at p. 262). However, that is not to say it is unimportant.
One purpose for residence disclosure obviously is to afford the party adverse to the proponent (usually the defendant) access to the witness and his residential environment to facilitate investigation into his credibility. Obstruction or unreasonable hindrance of such an opportunity may well trench on defendant's fundamental rights. However, there are other means potentially as effective to protect those rights. Access to an adverse witness can be compelled by the court. As discussed more fully below other evidence, available through discovery or cross-examination, can serve as well to test the credibility of an adverse witness whose residence address is undisclosed. "[T]he availability or unavailability of alternative remedies may have an important bearing on whether a procedure is to be accorded `directory' or `mandatory' effect." (Morris v. County of Marin, supra, 18 Cal.3d at p. 909, fn. 4.) (2c) Because there are alternative means by which a defendant can achieve the same ends as are facilitated by disclosure of a witness' address, frustration of those ends is not necessarily a consequence which follows from a failure to require disclosure (Pulcifer, supra, 29 Cal.2d at p. 262). The requirement of section 869 that a witness' preliminary examination testimony must state his place of residence is directory only. (See People v. O'Shaughnessy, supra, 135 Cal. App. at p. 108.)

III
(4) Despite its directory character, the residence disclosure requirement of section 869 imposes an obligatory duty on the magistrate "upon the demand of the prosecuting attorney, or the defendant, or his counsel." (See People v. Freeny (1974) 37 Cal. App.3d 20, 28 [112 Cal. Rptr. 33].) The decisions suggest that the statutory obligation may be excused where the magistrate is satisfied disclosure would endanger the witness (People v. Gallo (1981) 127 Cal. App.3d 828, 837 [179 Cal. Rptr. 662]; Miller v. Superior *20 Court (1979) 99 Cal. App.3d 381, 386 [159 Cal. Rptr. 456]). We need not decide here the validity of the exception to the statutory duty implied in the cited cases. (5) In seeking to avoid statutorily required disclosure by their witness, the People would necessarily bear the burden of establishing the preliminary fact that his safety would be endangered by disclosure of his place of residence. (See Evid. Code, §§ 400, 401, 405, subd. (a); see also Miller v. Superior Court, supra, at pp. 386-389; People v. Castro (1979) 99 Cal. App.3d 191, 200, fn. 6 [160 Cal. Rptr. 156].) Such a burden is not met by a mere offer of proof that evidence of danger exists; rather it calls for competent evidence from which the magistrate can determine the existence of that preliminary fact. (See ibid.) Here there was no competent evidence before the magistrate that disclosure of the witness Spark's place of residence would pose a danger to him.

IV
(6) An irregularity or defect in a preliminary examination does not necessarily render the ensuing order of commitment illegal, and a defendant is entitled to a dismissal of the information only if he has been deprived of some substantial right. (People v. Pompa-Ortiz (1980) 27 Cal.3d 519, 523 [165 Cal. Rptr. 85, 612 P.2d 941]; Jennings v. Superior Court (1967) 66 Cal.2d 867, 874 [59 Cal. Rptr. 440, 428 P.2d 304]; People v. Rodrigo (1886) 69 Cal. 601, 602 [11 P. 481].) Abridgement of a defendant's Sixth Amendment right to cross-examination denies him a substantial right. (Cf. Rodrigo, supra, at pp. 602-603; People v. Grundell (1888) 75 Cal. 301, 304 [17 P. 214]; People v. O'Shaughnessy, supra, 135 Cal. App. at p. 108.)
(7) "The fundamental right of cross-examination includes eliciting the address of a witness in order that `the witness may be identified with his community so that independent testimony may be sought and offered of his reputation for veracity in his own neighborhood' and that `facts may be brought out tending to discredit the witness by showing that his testimony in chief was untrue or biased.'" (Miller v. Superior Court, supra, 99 Cal. App.3d at p. 385, quoting Alford v. United States (1931) 282 U.S. 687, 691-692 [75 L.Ed. 624, 627, 51 S.Ct. 218]; see also Smith v. Illinois (1968) 390 U.S. 129 [19 L.Ed.2d 956, 88 S.Ct. 748].) "The right to a full and fair preliminary hearing includes these rights." (Miller, supra, at p. 385.) Where, however, there is a showing that disclosure would endanger the personal safety of the witness, the court has discretion to deny disclosure of the information. (People v. Castro, supra, 99 Cal. App.3d at p. 200; Smith v. Illinois, supra, 390 U.S. at pp. 133-134 [19 L.Ed.2d at p. 960], conc. opn. of Justices White and Marshall.)
(8) Notwithstanding the error in refusing to comply with section 869 by compelling the witness Sharp to disclose his residence, defendant was not *21 deprived of a substantial right. The evidence established that Sharp had used, sold and otherwise trafficked in illegal drugs and had received income from those activities; he had incurred a prior felony conviction; over a period of years he had worked with various law enforcement agencies as an informant and had sold information to them; and the law enforcement agency with which he was currently working was aware of his illegal involvement with drugs but had never attempted to make a case against him. Given this evidence, much of it from the witness' own mouth, vindication of defendant's fundamental rights did not depend on a canvass of the witness' own residential neighborhood for character evidence. The magistrate had ample evidence before him to place the witness Sharp in his proper setting and accurately to evaluate his credibility. (See People v. Gallo, supra, 127 Cal. App.3d at p. 836; People v. Castro, supra, 99 Cal. App.3d at pp. 200-204.)
Since defendant was not deprived of a substantial right at the preliminary hearing (see People v. Gallo, supra, 127 Cal. App.3d at p. 838; People v. Benjamin (1975) 52 Cal. App.3d 63, 73, 75 [124 Cal. Rptr. 799]), she is not entitled to dismissal of the information (People v. Pompa-Ortiz, supra, 27 Cal.3d at p. 52).
The judgment of dismissal is reversed.
Evans, J., and Blease, J., concurred.
NOTES
[1]  The People suggest that "place of residence" is not the equivalent of "current address," the former term being a more general reference to the city or locality where a person resides. However, if that were the case there would be no reason for the express exception in favor of peace officers, most of whom presumably reside in the communities where they work but who need only state their business address. (§§ 869; 1328.5; consult also Annot., 85 A.L.R.3d 541, 548, fn.6.)
