LEXXM3 ;ISL/KER - Convert Text to Mix Case (3) ;12/19/2014
;;2.0;General Lexicon Utilities;**80,86**;Sep 23, 1996;Build 1
;
; Global Variables
; None
;
; External References
; None
;
; Local Variables NEWed or KILLed Elsewhere
; LEXCTL,LEXIN,LEXPRE,LEXUSE,UIN Newed in LEXXM
; Y set and returned to LEXXM
;
T3 ; 3 Characters
N XU,CHR,REM,PRE,USE,NUM,TRL,P1,P2 S PRE=$G(LEXPRE),UIN=$G(UIN),USE=$G(LEXUSE) S XU=$$UP(X),CHR=$E(XU,1),REM=$E(XU,2,3),NUM=$E(XU,1),TRL=$E(XU,2,3)
; Exceptions
S P1=$E(XU,1,($L(XU)-2)),P2=$E(XU,($L(XU)-1),$L(XU)) I "^CC^ML^GM^"[("^"_P2_"^"),$E(P1,$L(P1))?1N S Y=$$LO(XU) Q
S:REM="ST"&($G(CHR)=1) Y="1st" S:REM="ND"&($G(CHR)=2) Y="2nd" S:REM="RD"&($G(CHR)=3) Y="3rd" S:REM="TH"&(+($G(CHR))>3) Y=CHR_"th" Q:$L($G(Y))
S:$E(XU,1)?1U&($E(XU,3)?1N) Y=XU Q:$L($G(Y)) S:$E(XU,1)?1U&($E(XU,2)?1N) Y=XU Q:$L($G(Y)) S:$E(XU,1)?1N&($E(XU,3)?1U) Y=XU Q:$L($G(Y))
S NUM=$E(XU,1),TRL=$E(XU,2,3) I +NUM=NUM,((TRL="TH")!(TRL="ST")!(TRL="RD")) S Y=$$LO(XU) Q:$L($G(Y))
S:XU="PTO"&(UIN["POWER TAKE-OFF"!(USE["POWER TAKE-OFF")) Y=XU Q:$L($G(Y))
S:XU="PTO"&(UIN["POWER TAKE OFF"!(USE["POWER TAKE OFF")) Y=XU Q:$L($G(Y))
S:XU="TAC"&(UIN["TRIGEMINAL AUTONOMIC CEPHALGIAS"!(USE["TRIGEMINAL AUTONOMIC CEPHALGIAS")) Y=XU Q:$L($G(Y))
S:XU="HIT"&(UIN["HEPARIN INDUCED THROMBOCYTOPENIA"!(USE["HEPARIN INDUCED THROMBOCYTOPENIA")) Y=XU Q:$L($G(Y))
S:XU="MEN"&(UIN["MULTIPLE ENDOCRINE NEOPLASIA"!(USE["MULTIPLE ENDOCRINE NEOPLASIA")) Y=XU Q:$L($G(Y))
S:XU="ADD"&(UIN["ADD-ON") Y=$$LO(XU) S:XU="ADD"&(UIN["ADD ON") Y=$$LO(XU) S:XU="ADD"&(UIN["DEFICIT") Y=XU Q:$L($G(Y))
S:XU="ALT"&((UIN["AMINOTRANSFERASE")!(UIN["FACTOR")!(UIN["PLATELET")!(UIN["PF4")!(UIN["SGPT")!(UIN["SERUM")!(UIN["ARGON LASER T")!(UIN["MEASUREMENT")) Y=XU Q:$L($G(Y))
S:XU="TAB"&((UIN["TYPHOID")!(UIN["TEMPORAL ARTERY")) Y=XU Q:$L($G(Y))
S:XU="RIG"&((UIN["FLEX")!(UIN["TEMPORAL ARTERY")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="ALL"&((USE["ACUTE LYMPHOBLASTIC LEUKEMIA")) Y=XU Q:$L($G(Y))
S:XU="HER"&(UIN["HER-") Y=XU Q:$L($G(Y))
S:XU="YAG"&(UIN["LASER") Y=XU Q:$L($G(Y))
S:XU="BUN"&(UIN["UREA NITRO") Y=XU Q:$L($G(Y))
S:XU="PAD"&((UIN["PERIPHERAL")!(UIN["ARTERIAL")) Y=XU Q:$L($G(Y))
S:XU="MEG"&((UIN["MAGNETOENCEPHALOGRAPHY")) Y=XU Q:$L($G(Y))
S:XU="ALT"&((PRE["NORMAL")!(PRE["ELEVATED")) Y=XU Q:$L($G(Y))
S:XU="TAG"&((UIN["GLYCOPROTIEN")!(UIN["72")!(UIN["TAG-")!(UIN["-TAG")!(UIN["(TAG")!(UIN["TAG 12")) Y=XU Q:$L($G(Y))
S:XU="HAI"&((UIN["INHIBITION")) Y=XU Q:$L($G(Y))
S:XU="AMP"&((UIN["ADENOSINE")!(UIN["MONOPHOSPHATE")!(UIN["CYCL")!(UIN["ACUTE")!(UIN["MASSIVE")!(UIN["PULMONARY")) Y=XU Q:$L($G(Y))
S:XU="AMP"&((UIN["PYROPHORYLASE")!(UIN["NUCLEOSIDASE")!(UIN["DEAMINASE")!(UIN["ACETYL")!(UIN["HEPTAMINOL")!(UIN["PROTEIN")) Y=XU Q:$L($G(Y))
S:XU="AMP"&((UIN["POLYPHOSPHATE")!(UIN["PHOSPHOTRANSFERASE")!(UIN["DIALDEHYDE")!(UIN["ETHYL")) Y=XU Q:$L($G(Y))
S:XU="AMP"&((UIN["-AMP")!(UIN["AMP-")!(PRE["PLASTIC")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="BAL"&((UIN["BAL DIL")!(UIN["BAL TIS")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="TIS"&((PRE["BAL")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="TEM"&((UIN["TEM W")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="ABL"&((PRE="")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="REP"&((UIN["REP DEV")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="DET"&((UIN["DET RET")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="ANA"&((PRE["SANTA")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="RET"&((PRE="C")) Y=XU Q:$L($G(Y))
S:XU="CAT"&((UIN["CRY")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="ASP"&((UIN["ANTI")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="DES"&((UIN["ANTI")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="EST"&((UIN["-EST")!(UIN["ELECTRO")) Y=XU Q:$L($G(Y))
S:XU="DES"&((UIN["SPHINCTER")!(UIN["DYSEQUIL")!(UIN["DIETHYLS")) Y=XU Q:$L($G(Y))
S:XU="DES"&((UIN["GAMMA")!(UIN["-DES")!(UIN["DES-")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="TAP"&((UIN["TAP-WATER")) Y="Tap" Q:$L($G(Y))
S:XU="TAP"&((UIN["TRYPSINOGEN")!(UIN["ACTIVATION")!(UIN["PEPTIDE")!(UIN[" COLI")!(UIN["CHEMO")!(UIN["TAP-")) Y=XU Q:$L($G(Y))
S:XU="TAP"&((UIN["TAP 0")!(UIN["TAP 2")!(UIN["PROTEIN")!(UIN["GENE")!(UIN["ANTIGEN")) Y=XU Q:$L($G(Y))
S:XU="PAD"&($G(LEXCTL)["(PAD)") Y=XU S:XU="CAT"&($G(LEXIN)["ANIMAL") Y=$$MX(XU) Q:$L($G(Y))
S:XU="TWO"&($G(UIN)["DIMENSION") Y=$$MX(XU) Q:$L($G(Y))
S:XU="CAP"&($G(LEXIN)["KNEE") Y=$$MX(XU) Q:$L($G(Y))
S:XU="END"&(($G(LEXIN)["END-")!($G(LEXIN)["END BULBS")!($G(LEXIN)["END POINT")) Y=$$MX(XU) Q:$L($G(Y))
S:XU="FAM"&((UIN["PROTOCOL")!(UIN="FAM")!(UIN["FUNCTIONAL")) Y=XU Q:$L($G(Y))
I XU="WHO" D Q:$L($G(Y))
. I $G(UIN)="WHO" S Y=XU Q
. S:$G(UIN)["WRIST"&($G(UIN)["ORTHO") Y=XU Q:$L($G(Y))
. I $G(UIN)["WHO CLASS"!($G(UIN)["WHO)")!($G(UIN)["GRADE")!($G(UIN)["WHO SYSTEM")!($G(UIN)["SCALE") S Y=XU Q
. I $G(UIN)["WHO ORAL"!($G(UIN)["FINDING)")!($G(UIN)["STATUS")!($G(UIN)["WHO TUMOR")!($G(UIN)["WHO TUMOUR")!($G(UIN)["WHO CNS") S Y=XU Q
. I $G(UIN)["WORLD HEALTH"!($G(UIN)["WHO-ART") S Y=XU Q
. S Y="who"
; Special Case
S:XU="PO2" Y="pO2" S:XU="DDI" Y="ddI" S:XU="BRZ" Y="BrZ" Q:$L($G(Y))
S:XU="COA" Y="CoA" S:XU="COM" Y="CoM" S:XU="EIF" Y="eIF" Q:$L($G(Y))
S:XU="HPR" Y="HPr" S:XU="IGA" Y="IgA" S:XU="IGD" Y="IgD" Q:$L($G(Y))
S:XU="IGE" Y="IgE" S:XU="IGG" Y="IgG" S:XU="IGM" Y="IgM" Q:$L($G(Y))
S:XU="KDA" Y="kDa" S:XU="MEC" Y="MeC" S:XU="MEO" Y="MeO" Q:$L($G(Y))
S:XU="NAC" Y="NAc" S:XU="NIA" Y="NIa" S:XU="OET" Y="OEt" Q:$L($G(Y))
S:XU="PNA" Y="pNA" S:XU="SMB" Y="SmB" S:XU="VPG" Y="VPg" Q:$L($G(Y))
S:XU="MCI" Y="mCi" S:XU="LPH" Y="LpH" Q:$L($G(Y))
S:XU="1ST" Y="1st" S:XU="2ND" Y="2nd" S:XU="3RD" Y="3rd" Q:$L($G(Y))
S:XU="4TH" Y="4th" S:XU="5TH" Y="6th" S:XU="7TH" Y="8th" Q:$L($G(Y))
S:XU="9TH" Y="9th" Q:$L($G(Y))
; Lower Case
I "^ALL^AMP^AND^ANY^ARE^BIS^BUT^CAN^CIS^DES^DID^DUE^END^"[("^"_XU_"^") S Y=$$LO(XU) Q
I "^ETC^FAR^FOR^GMS^HAD^HAS^HER^HIM^HIS^HOW^ITS^LOW^LPM^"[("^"_XU_"^") S Y=$$LO(XU) Q
I "^MAY^MCG^MED^MIN^NEW^NON^NOT^NOW^ONE^OUR^OUT^OWN^OXO^"[("^"_XU_"^") S Y=$$LO(XU) Q
I "^P53^PER^PRE^PRO^PSI^PUT^SET^SIX^TEN^THE^TOO^TWO^USE^"[("^"_XU_"^") S Y=$$LO(XU) Q
I "^VIA^W/O^WAS^WHO^"[("^"_XU_"^") S Y=$$LO(XU) Q
; Mixed Case
I "^APR^AUG^BAY^DIR^FAC^FEB^HOT^JAN^JCT^JUL^JUN^LAS^LOS^"[("^"_XU_"^") S Y=$$MX(XU) Q
I "^MAR^MAY^MED^MTN^NEW^NOV^OCT^OUT^SAN^SEP^SKY^"[("^"_XU_"^") S Y=$$MX(XU) Q
; Upper Case
I CHR?1N!("^A^B^C^"[("^"_CHR_"^")) D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uppercase
Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
MX(X) ; Mix Case
Q $TR($E(X,1),"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")_$TR($E(X,2,$L(X)),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
TRIM(X) ; Trim Spaces
S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
N LEXCTL,LEXIN,LEXPRE,LEXUSE,UIN,Y
Q X
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLEXXM3 11302 printed Dec 13, 2024@02:10:25 Page 2
LEXXM3 ;ISL/KER - Convert Text to Mix Case (3) ;12/19/2014
+1 ;;2.0;General Lexicon Utilities;**80,86**;Sep 23, 1996;Build 1
+2 ;
+3 ; Global Variables
+4 ; None
+5 ;
+6 ; External References
+7 ; None
+8 ;
+9 ; Local Variables NEWed or KILLed Elsewhere
+10 ; LEXCTL,LEXIN,LEXPRE,LEXUSE,UIN Newed in LEXXM
+11 ; Y set and returned to LEXXM
+12 ;
T3 ; 3 Characters
+1 NEW XU,CHR,REM,PRE,USE,NUM,TRL,P1,P2
SET PRE=$GET(LEXPRE)
SET UIN=$GET(UIN)
SET USE=$GET(LEXUSE)
SET XU=$$UP(X)
SET CHR=$EXTRACT(XU,1)
SET REM=$EXTRACT(XU,2,3)
SET NUM=$EXTRACT(XU,1)
SET TRL=$EXTRACT(XU,2,3)
+2 ; Exceptions
+3 SET P1=$EXTRACT(XU,1,($LENGTH(XU)-2))
SET P2=$EXTRACT(XU,($LENGTH(XU)-1),$LENGTH(XU))
IF "^CC^ML^GM^"[("^"_P2_"^")
IF $EXTRACT(P1,$LENGTH(P1))?1N
SET Y=$$LO(XU)
QUIT
+4 if REM="ST"&($GET(CHR)=1)
SET Y="1st"
if REM="ND"&($GET(CHR)=2)
SET Y="2nd"
if REM="RD"&($GET(CHR)=3)
SET Y="3rd"
if REM="TH"&(+($GET(CHR))>3)
SET Y=CHR_"th"
if $LENGTH($GET(Y))
QUIT
+5 if $EXTRACT(XU,1)?1U&($EXTRACT(XU,3)?1N)
SET Y=XU
if $LENGTH($GET(Y))
QUIT
if $EXTRACT(XU,1)?1U&($EXTRACT(XU,2)?1N)
SET Y=XU
if $LENGTH($GET(Y))
QUIT
if $EXTRACT(XU,1)?1N&($EXTRACT(XU,3)?1U)
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+6 SET NUM=$EXTRACT(XU,1)
SET TRL=$EXTRACT(XU,2,3)
IF +NUM=NUM
IF ((TRL="TH")!(TRL="ST")!(TRL="RD"))
SET Y=$$LO(XU)
if $LENGTH($GET(Y))
QUIT
+7 if XU="PTO"&(UIN["POWER TAKE-OFF"!(USE["POWER TAKE-OFF"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+8 if XU="PTO"&(UIN["POWER TAKE OFF"!(USE["POWER TAKE OFF"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+9 if XU="TAC"&(UIN["TRIGEMINAL AUTONOMIC CEPHALGIAS"!(USE["TRIGEMINAL AUTONOMIC CEPHALGIAS"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+10 if XU="HIT"&(UIN["HEPARIN INDUCED THROMBOCYTOPENIA"!(USE["HEPARIN INDUCED THROMBOCYTOPENIA"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+11 if XU="MEN"&(UIN["MULTIPLE ENDOCRINE NEOPLASIA"!(USE["MULTIPLE ENDOCRINE NEOPLASIA"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+12 if XU="ADD"&(UIN["ADD-ON")
SET Y=$$LO(XU)
if XU="ADD"&(UIN["ADD ON")
SET Y=$$LO(XU)
if XU="ADD"&(UIN["DEFICIT")
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+13 if XU="ALT"&((UIN["AMINOTRANSFERASE")!(UIN["FACTOR")!(UIN["PLATELET")!(UIN["PF4")!(UIN["SGPT")!(UIN["SERUM")!(UIN["ARGON LASER T")!(UIN["MEASUREMENT"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+14 if XU="TAB"&((UIN["TYPHOID")!(UIN["TEMPORAL ARTERY"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+15 if XU="RIG"&((UIN["FLEX")!(UIN["TEMPORAL ARTERY"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+16 if XU="ALL"&((USE["ACUTE LYMPHOBLASTIC LEUKEMIA"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+17 if XU="HER"&(UIN["HER-")
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+18 if XU="YAG"&(UIN["LASER")
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+19 if XU="BUN"&(UIN["UREA NITRO")
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+20 if XU="PAD"&((UIN["PERIPHERAL")!(UIN["ARTERIAL"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+21 if XU="MEG"&((UIN["MAGNETOENCEPHALOGRAPHY"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+22 if XU="ALT"&((PRE["NORMAL")!(PRE["ELEVATED"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+23 if XU="TAG"&((UIN["GLYCOPROTIEN")!(UIN["72")!(UIN["TAG-")!(UIN["-TAG")!(UIN["(TAG")!(UIN["TAG 12"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+24 if XU="HAI"&((UIN["INHIBITION"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+25 if XU="AMP"&((UIN["ADENOSINE")!(UIN["MONOPHOSPHATE")!(UIN["CYCL")!(UIN["ACUTE")!(UIN["MASSIVE")!(UIN["PULMONARY"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+26 if XU="AMP"&((UIN["PYROPHORYLASE")!(UIN["NUCLEOSIDASE")!(UIN["DEAMINASE")!(UIN["ACETYL")!(UIN["HEPTAMINOL")!(UIN["PROTEIN"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+27 if XU="AMP"&((UIN["POLYPHOSPHATE")!(UIN["PHOSPHOTRANSFERASE")!(UIN["DIALDEHYDE")!(UIN["ETHYL"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+28 if XU="AMP"&((UIN["-AMP")!(UIN["AMP-")!(PRE["PLASTIC"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+29 if XU="BAL"&((UIN["BAL DIL")!(UIN["BAL TIS"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+30 if XU="TIS"&((PRE["BAL"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+31 if XU="TEM"&((UIN["TEM W"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+32 if XU="ABL"&((PRE=""))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+33 if XU="REP"&((UIN["REP DEV"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+34 if XU="DET"&((UIN["DET RET"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+35 if XU="ANA"&((PRE["SANTA"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+36 if XU="RET"&((PRE="C"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+37 if XU="CAT"&((UIN["CRY"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+38 if XU="ASP"&((UIN["ANTI"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+39 if XU="DES"&((UIN["ANTI"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+40 if XU="EST"&((UIN["-EST")!(UIN["ELECTRO"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+41 if XU="DES"&((UIN["SPHINCTER")!(UIN["DYSEQUIL")!(UIN["DIETHYLS"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+42 if XU="DES"&((UIN["GAMMA")!(UIN["-DES")!(UIN["DES-"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+43 if XU="TAP"&((UIN["TAP-WATER"))
SET Y="Tap"
if $LENGTH($GET(Y))
QUIT
+44 if XU="TAP"&((UIN["TRYPSINOGEN")!(UIN["ACTIVATION")!(UIN["PEPTIDE")!(UIN[" COLI")!(UIN["CHEMO")!(UIN["TAP-"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+45 if XU="TAP"&((UIN["TAP 0")!(UIN["TAP 2")!(UIN["PROTEIN")!(UIN["GENE")!(UIN["ANTIGEN"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+46 if XU="PAD"&($GET(LEXCTL)["(PAD)")
SET Y=XU
if XU="CAT"&($GET(LEXIN)["ANIMAL")
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+47 if XU="TWO"&($GET(UIN)["DIMENSION")
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+48 if XU="CAP"&($GET(LEXIN)["KNEE")
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+49 if XU="END"&(($GET(LEXIN)["END-")!($GET(LEXIN)["END BULBS")!($GET(LEXIN)["END POINT"))
SET Y=$$MX(XU)
if $LENGTH($GET(Y))
QUIT
+50 if XU="FAM"&((UIN["PROTOCOL")!(UIN="FAM")!(UIN["FUNCTIONAL"))
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+51 IF XU="WHO"
Begin DoDot:1
+52 IF $GET(UIN)="WHO"
SET Y=XU
QUIT
+53 if $GET(UIN)["WRIST"&($GET(UIN)["ORTHO")
SET Y=XU
if $LENGTH($GET(Y))
QUIT
+54 IF $GET(UIN)["WHO CLASS"!($GET(UIN)["WHO)")!($GET(UIN)["GRADE")!($GET(UIN)["WHO SYSTEM")!($GET(UIN)["SCALE")
SET Y=XU
QUIT
+55 IF $GET(UIN)["WHO ORAL"!($GET(UIN)["FINDING)")!($GET(UIN)["STATUS")!($GET(UIN)["WHO TUMOR")!($GET(UIN)["WHO TUMOUR")!($GET(UIN)["WHO CNS")
SET Y=XU
QUIT
+56 IF $GET(UIN)["WORLD HEALTH"!($GET(UIN)["WHO-ART")
SET Y=XU
QUIT
+57 SET Y="who"
End DoDot:1
if $LENGTH($GET(Y))
QUIT
+58 ; Special Case
+59 if XU="PO2"
SET Y="pO2"
if XU="DDI"
SET Y="ddI"
if XU="BRZ"
SET Y="BrZ"
if $LENGTH($GET(Y))
QUIT
+60 if XU="COA"
SET Y="CoA"
if XU="COM"
SET Y="CoM"
if XU="EIF"
SET Y="eIF"
if $LENGTH($GET(Y))
QUIT
+61 if XU="HPR"
SET Y="HPr"
if XU="IGA"
SET Y="IgA"
if XU="IGD"
SET Y="IgD"
if $LENGTH($GET(Y))
QUIT
+62 if XU="IGE"
SET Y="IgE"
if XU="IGG"
SET Y="IgG"
if XU="IGM"
SET Y="IgM"
if $LENGTH($GET(Y))
QUIT
+63 if XU="KDA"
SET Y="kDa"
if XU="MEC"
SET Y="MeC"
if XU="MEO"
SET Y="MeO"
if $LENGTH($GET(Y))
QUIT
+64 if XU="NAC"
SET Y="NAc"
if XU="NIA"
SET Y="NIa"
if XU="OET"
SET Y="OEt"
if $LENGTH($GET(Y))
QUIT
+65 if XU="PNA"
SET Y="pNA"
if XU="SMB"
SET Y="SmB"
if XU="VPG"
SET Y="VPg"
if $LENGTH($GET(Y))
QUIT
+66 if XU="MCI"
SET Y="mCi"
if XU="LPH"
SET Y="LpH"
if $LENGTH($GET(Y))
QUIT
+67 if XU="1ST"
SET Y="1st"
if XU="2ND"
SET Y="2nd"
if XU="3RD"
SET Y="3rd"
if $LENGTH($GET(Y))
QUIT
+68 if XU="4TH"
SET Y="4th"
if XU="5TH"
SET Y="6th"
if XU="7TH"
SET Y="8th"
if $LENGTH($GET(Y))
QUIT
+69 if XU="9TH"
SET Y="9th"
if $LENGTH($GET(Y))
QUIT
+70 ; Lower Case
+71 IF "^ALL^AMP^AND^ANY^ARE^BIS^BUT^CAN^CIS^DES^DID^DUE^END^"[("^"_XU_"^")
SET Y=$$LO(XU)
QUIT
+72 IF "^ETC^FAR^FOR^GMS^HAD^HAS^HER^HIM^HIS^HOW^ITS^LOW^LPM^"[("^"_XU_"^")
SET Y=$$LO(XU)
QUIT
+73 IF "^MAY^MCG^MED^MIN^NEW^NON^NOT^NOW^ONE^OUR^OUT^OWN^OXO^"[("^"_XU_"^")
SET Y=$$LO(XU)
QUIT
+74 IF "^P53^PER^PRE^PRO^PSI^PUT^SET^SIX^TEN^THE^TOO^TWO^USE^"[("^"_XU_"^")
SET Y=$$LO(XU)
QUIT
+75 IF "^VIA^W/O^WAS^WHO^"[("^"_XU_"^")
SET Y=$$LO(XU)
QUIT
+76 ; Mixed Case
+77 IF "^APR^AUG^BAY^DIR^FAC^FEB^HOT^JAN^JCT^JUL^JUN^LAS^LOS^"[("^"_XU_"^")
SET Y=$$MX(XU)
QUIT
+78 IF "^MAR^MAY^MED^MTN^NEW^NOV^OCT^OUT^SAN^SEP^SKY^"[("^"_XU_"^")
SET Y=$$MX(XU)
QUIT
+79 ; Upper Case
+80 IF CHR?1N!("^A^B^C^"[("^"_CHR_"^"))
Begin DoDot:1
+81 IF "^AAA^AAC^AAF^AAT^ABA^ABC^ABI^ABL^ABO^ABP^ACE^ACP^ACS^"[("^"_XU_"^")
SET Y=XU
QUIT
+82 IF "^ADA^ADC^ADH^ADL^ADP^ADR^ADT^ADV^ADX^AFB^AFM^AFO^AFP^"[("^"_XU_"^")
SET Y=XU
QUIT
+83 IF "^AFX^AHG^AII^AKD^ALA^ALS^AMC^AMD^AMP^ANA^ANF^ANP^ANS^"[("^"_XU_"^")
SET Y=XU
QUIT
+84 IF "^AOE^APC^APP^APV^ARB^ARF^ASA^ASC^AST^ATF^ATP^ATX^AVP^"[("^"_XU_"^")
SET Y=XU
QUIT
+85 I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"^")
SET Y=XU
QUIT
+134 IF "^YSA^ZDG^ZTA^"[("^"_XU_"^")
SET Y=XU
QUIT
End DoDot:1
if $LENGTH($GET(Y))
QUIT
+135 QUIT
+136 ;
LO(X) ; Lower Case
+1 QUIT $TRANSLATE(X,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
UP(X) ; Uppercase
+1 QUIT $TRANSLATE(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
MX(X) ; Mix Case
+1 QUIT $TRANSLATE($EXTRACT(X,1),"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")_$TRANSLATE($EXTRACT(X,2,$LENGTH(X)),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
TRIM(X) ; Trim Spaces
+1 SET X=$GET(X)
FOR
if $EXTRACT(X,1)'=" "
QUIT
SET X=$EXTRACT(X,2,$LENGTH(X))
+2 FOR
if $EXTRACT(X,$LENGTH(X))'=" "
QUIT
SET X=$EXTRACT(X,1,($LENGTH(X)-1))
+3 NEW LEXCTL,LEXIN,LEXPRE,LEXUSE,UIN,Y
+4 QUIT X