*! version 1.0.0  02/02/93 extrname <chklna2> utility; STB-13: dm13
program define _crcexn6 /* <chklna2> lname fname mname */
	version 3.0
	local lname "`1'"
	local fname "`2'"
	local mname "`3'"

	tempvar bad case
	quietly {
		gen byte `bad'=length(`lname')==1 | /*
			*/ length(`lname')==2 & substr("`lname'",2,1)=="."
		capture assert `bad'==0
		if _rc==0 { exit }

		gen byte `case' = `mname'==""

		exchstr `fname' `lname' if `bad' & `case'==1
		replace `bad'=0 if `bad' & `case'==1
		capture assert `bad'==0
		if _rc==0 { exit }

		exchstr `lname' `fname' if `bad'
		exchstr `fname' `mname' if `bad'
	}
end
exit
/*
	<chklna2> lname fname mname
*/