ONCSCHMX ;HINES OIFO/RTK - AJCC ID, XX and other special code ;08/28/19
;;2.2;ONCOLOGY;**10,12,13,17**;Jul 31, 2013;Build 6
;
Q
CHKAJID ;Special code for some Schemas-AJCC ID/Chapter values including 'XX'
N ONCJFG,ONC3926 S ONCJFG=0
S ONCHIST=$$HIST^ONCFUNC(D0)
S ONCTPCD=$P(TOPCOD,".",1)_$P(TOPCOD,".",2) ;remove the "."
S HST14=$E(ONCHIST,1,4),ONCT3=$E(ONCTPCD,2,5)
S ONC3926=$P($G(^ONCO(165.5,D0,"SSD4")),U,21) ; Schema Discriminator 1
S ONC3927=$P($G(^ONCO(165.5,D0,"SSD4")),U,22) ; Schema Discriminator 2
D ^ONCSCHMA I ONCSCMA=0 W !!,"Unable to calculate the AJCC ID Value",! Q
S ONCJFG=0
;
;
;00060 Cervical LN & Unknown Primary 6/XX
I ONCSCMA="00060" D I ONCJFG=1 Q
.I ((HST14>7999)&(HST14<8006))!((HST14>8010)&(HST14<8046))!(HST14=8050)!((HST14>8052)&(HST14<8061))!((HST14>8074)&(HST14<8082))!((HST14>8084)&(HST14<8121))!((HST14>8121)&(HST14<8132))!((HST14>8140)&(HST14<8147)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8147)&(HST14<8192))!((HST14>8200)&(HST14<8301))!((HST14>8310)&(HST14<8421))!((HST14>8439)&(HST14<8445))!((HST14>8450)&(HST14<8475))!((HST14>8480)&(HST14<8525)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8529)&(HST14<8544))!((HST14>8550)&(HST14<8562))!((HST14>8569)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00090 Nasopharynx 9/XX
I ONCSCMA="00090" D I ONCJFG=1 Q
.I ((HST14>8000)&(HST14<8006))!((HST14>8010)&(HST14<8016))!((HST14>8020)&(HST14<8052))!((HST14>8052)&(HST14<8061))!((HST14>8073)&(HST14<8083)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8083)&(HST14<8132))!((HST14>8140)&(HST14<8192))!((HST14>8200)&(HST14<8701))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00111 Oropharynx (p16-) 11.1/XX
I ONCSCMA="00111" D I ONCJFG=1 Q
.I (ONCTPCD="C104")&((HST14=8051)!(HST14=8052)!(HST14=8070)!(HST14=8074)!(HST14=8075)!(HST14=8082)!(HST14=8083)!(HST14=8086)!(HST14=8560)) S ONCAJID="XX",ONCJFG=1 Q
.I "C019^C024^C051^C052^C090^C091^C098^C099^C100^C102^C103^C104^C108^C109^C111"[ONCTPCD D
..I ((HST14>7999)&(HST14<8051))!((HST14>8052)&(HST14<8061))!((HST14>8070)&(HST14<8074))!((HST14>8075)&(HST14<8082))!((HST14>8083)&(HST14<8086))!((HST14>8089)&(HST14<8553)) S ONCAJID="XX",ONCJFG=1 Q
..I ((HST14>8560)&(HST14<8701))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
..I (HST14=8051)!(HST14=8052)!(HST14=8070)!(HST14=8074)!(HST14=8075)!(HST14=8082)!(HST14=8083)!(HST14=8086)!(HST14=8560) S ONCAJID="11.1",ONCJFG=1 Q
;
;00100 Oropharynx (p16+) 10/XX
I ONCSCMA="00100" D I ONCJFG=1 Q
.I (ONCTPCD="C104")&((HST14=8070)!(HST14=8072)!(HST14=8083)!(HST14=8085)) S ONCAJID="XX",ONCJFG=1 Q
.I "C019^C024^C051^C052^C090^C091^C098^C099^C100^C102^C103^C104^C108^C109^C111"[ONCTPCD D
..I ($E(ONCHIST,5)=2)&((HST14=8070)!(HST14=8072)!(HST14=8083)!(HST14=8085)) S ONCAJID="XX",ONCJFG=1 Q
..I ((HST14>7999)&(HST14<8061))!(HST14=8071)!((HST14>8072)&(HST14<8083))!(HST14=8084)!((HST14>8085)&(HST14<8701))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00112 Hypopharynx 11.2/XX
I ONCSCMA="00112" D I ONCJFG=1 Q
.I ((HST14>7999)&(HST14<8051))!((HST14>8052)&(HST14<8061))!((HST14>8070)&(HST14<8074))!((HST14>8075)&(HST14<8082))!((HST14>8083)&(HST14<8086))!((HST14>8089)&(HST14<8553)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8560)&(HST14<8701))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00140 Melanoma of Head & Neck 14/XX
I ONCSCMA="00140" D I ONCJFG=1 Q
.I ((ONCT3>2)&(ONCT3<6))!((ONCT3>7)&(ONCT3<10))!((ONCT3>18)&(ONCT3<70))!((ONCT3>89)&(ONCT3<92))!((ONCT3>97)&(ONCT3<104))!((ONCT3>107)&(ONCT3<149))!(ONCT3=300)!(ONCT3=310)!(ONCT3=311)!((ONCT3>319)&(ONCT3<323))!(ONCT3=328)!(ONCT3=329) D
..I ($E(ONCHIST,5)=2) D I ONCJFG=1 Q
...I ((HST14=8720)!(HST14=8721)!(HST14=8722)!(HST14=8730)!(HST14=8745)!(HST14=8746)!(HST14=8770)!(HST14=8771)!(HST14=8772)) S ONCAJID="XX",ONCJFG=1 Q
.I "C104^C301^C312^C313^C318^C319^C323"[ONCTPCD D I ONCJFG=1 Q
..I (HST14=8720)!(HST14=8721)!(HST14=8722)!(HST14=8730)!(HST14=8745)!(HST14=8746)!(HST14=8770)!(HST14=8771)!(HST14=8772) S ONCAJID="XX",ONCJFG=1 Q
.I ((ONCT3>2)&(ONCT3<6))!((ONCT3>7)&(ONCT3<10))!((ONCT3>18)&(ONCT3<70))!((ONCT3>89)&(ONCT3<149))!((ONCT3>299)&(ONCT3<330)) D I ONCJFG=1 Q
..I ((HST14>8722)&(HST14<8729))!((HST14>8739)&(HST14<8745))!((HST14>8749)&(HST14<8763))!((HST14>8772)&(HST14<8791)) S ONCAJID="XX",ONCJFG=1 Q
;
;00161 Esophagus (Squamous) 16.1/XX
I (ONCSCMA="00161") D I ONCJFG=1 Q
.I (HST14=8020)!(HST14=8051)!(HST14=8070)!(HST14=8074)!(HST14=8077)!(HST14=8083)!(HST14=8560) S ONCAJID=16.1,ONCAJCHP=16.1,ONCJFG=1 Q
.I (HST14=8050)!(HST14=8052)!(HST14=8053)!(HST14=8054) S ONCAJID="XX",ONCJFG=1 Q
;
;00169 Esophagus (excluding Squamous) 16.2/16.3/XX
I (ONCSCMA="00169") D I ONCJFG=1 Q
.I "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD D
..I (HST14=8240)!(HST14=8249) S ONCAJID=16.3,ONCAJCHP=16.3,ONCJFG=1 Q
..I (HST14=8150)!(HST14=8151)!(HST14=8152)!(HST14=8153)!(HST14=8155)!(HST14=8156)!(HST14=8158)!(HST14=8241)!(HST14=8242)!(HST14=8683) S ONCAJID="XX",ONCJFG=1 Q
.I "C150^C151^C152^C153^C154^C155^C158^C159^C160"[ONCTPCD D
..I (HST14=8000)!(HST14=8010)!(HST14=8013)!(HST14=8041)!(HST14=8071)!(HST14=8145)!(HST14=8246)!(HST14=8255) S ONCAJID=16.3,ONCAJCHP=16.3,ONCJFG=1 Q
..I ((HST14=8020)&(ONC3927=2))!(HST14=8140)!(HST14=8148)!(HST14=8200)!(HST14=8244)!(HST14=8430) S ONCAJID=16.2,ONCAJCHP=16.2,ONCJFG=1 Q
..I ((HST14>8000)&(HST14<8006))!((HST14>8010)&(HST14<8013))!((HST14>8013)&(HST14<8015))!((HST14>8020)&(HST14<8041))!(HST14=8060)!((HST14>8071)&(HST14<8074))!((HST14>8074)&(HST14<8077))!((HST14>8077)&(HST14<8083)) S ONCAJID="XX",ONCJFG=1 Q
..I ((HST14>8083)&(HST14<8132))!((HST14>8140)&(HST14<8145))!(HST14=8146)!(HST14=8147)!(HST14=8149)!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8192))!((HST14>8200)&(HST14<8232))!(HST14=8243)!(HST14=8245) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8041)&(HST14<8047))!(HST14=8247)!(HST14=8248) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8249)&(HST14<8255))!((HST14>8255)&(HST14<8421))!((HST14>8439)&(HST14<8553))!((HST14>8560)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00180 Small Intestine 18.1/18.2/XX
I ONCSCMA="00180" D I ONCJFG=1 Q
.I "C170^C171^C172^C178^C179"[ONCTPCD D
..I (HST14=8000)!(HST14=8013)!(HST14=8020)!(HST14=8041)!(HST14=8070)!(HST14=8148)!(HST14=8244)!(HST14=8255)!(HST14=8510)!(HST14=8560) S ONCAJID=18.2,ONCJFG=1 Q
.I ONCTPCD="C173" D
..I (HST14=8000)!(HST14=8010)!(HST14=8013)!(HST14=8020)!(HST14=8041)!(HST14=8070)!(HST14=8140)!(HST14=8148)!(HST14=8210) S ONCAJID="XX",ONCJFG=1 Q
..I (HST14=8244)!(HST14=8255)!(HST14=8261)!(HST14=8263)!(HST14=8480)!(HST14=8481)!(HST14=8490)!(HST14=8510)!(HST14=8560) S ONCAJID="XX",ONCJFG=1 Q
.I "C170^C171^C172^C173^C178^C179"[ONCTPCD D
..I ((HST14>7999)&(HST14<8006))!(HST14=8011)!(HST14=8012)!(HST14=8014)!(HST14=8015)!((HST14>8020)&(HST14<8041))!((HST14>8041)&(HST14<8061))!((HST14>8070)&(HST14<8132)) S ONCAJID="XX",ONCJFG=1 Q
..I ((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8148))!(HST14=8149) S ONCAJID="XX",ONCJFG=1 Q
..I (HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8205))!((HST14>8210)&(HST14<8213))!((HST14>8213)&(HST14<8232))!(HST14=8243) S ONCAJID="XX",ONCJFG=1 Q
..I ((HST14>8244)&(HST14<8249))!((HST14>8249)&(HST14<8255))!((HST14>8255)&(HST14<8261))!(HST14=8262) S ONCAJID="XX",ONCJFG=1 Q
..I ((HST14>8263)&(HST14<8475))!(HST14=8482)!((HST14>8499)&(HST14<8510))!((HST14>8511)&(HST14<8553))!((HST14>8560)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00220 Liver 22/XX
I ONCSCMA="00220" D I ONCJFG=1 Q
.I ($E(ONCHIST,5)=2)&((HST14>8169)&(HST14<8175)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>7999)&(HST14<8164))!((HST14>8174)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00230 Bile Ducts Intrahepatic 23/XX
I ONCSCMA="00230" D I ONCJFG=1 Q
.I ((HST14>7999)&(HST14<8013))!((HST14>8013)&(HST14<8041))!((HST14>8041)&(HST14<8148))!((HST14>8148)&(HST14<8159))!((HST14>8161)&(HST14<8176)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8189)&(HST14<8246))!((HST14>8246)&(HST14<8464))!((HST14>8470)&(HST14<8503))!((HST14>8503)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00241/00242/00250 Gallbladder/Cystic Duct/Bile Duct Perihilar 24/25/XX
I (ONCSCMA="00241")!(ONCSCMA="00242")!(ONCSCMA="00250") D I ONCJFG=1 Q
.I ((HST14>7999)&(HST14<8006))!(HST14=8011)!(HST14=8012)!(HST14=8014)!(HST14=8015)!((HST14>8020)&(HST14<8041))!((HST14>8041)&(HST14<8061)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8070)&(HST14<8132))!((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8148)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8148)&(HST14<8246))!((HST14>8246)&(HST14<8301))!((HST14>8310)&(HST14<8464))!((HST14>8470)&(HST14<8475))!((HST14>8503)&(HST14<8553))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
.I (HST14=8481)!(HST14=8482)!(HST14=8500)!(HST14=8501)!(HST14=8502)!((HST14>8560)&(HST14<8701))!((HST14>8719)&(HST14<8791)) S ONCAJID="XX",ONCJFG=1 Q
;
;00260 Bile Ducts Distal 26/XX
I ONCSCMA="00260" D I ONCJFG=1 Q
.I ((HST14>8000)&(HST14<8006))!(HST14=8011)!(HST14=8012)!(HST14=8014)!(HST14=8015)!((HST14>8020)&(HST14<8041))!((HST14>8041)&(HST14<8061))!((HST14>8070)&(HST14<8132)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8148))!((HST14>8148)&(HST14<8159))!(HST14=8161) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8162)&(HST14<8244))!(HST14=8245)!((HST14>8246)&(HST14<8301))!((HST14>8310)&(HST14<8464))!((HST14>8470)&(HST14<8475))!((HST14>8503)&(HST14<8553))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
.I (HST14=8481)!(HST14=8482)!(HST14=8501)!(HST14=8502)!((HST14>8560)&(HST14<8701))!((HST14>8719)&(HST14<8791)) S ONCAJID="XX",ONCJFG=1 Q
;
;00360 Lung 36/XX
I ONCSCMA="00360" D I ONCJFG=1 Q
.I ((HST14>8000)&(HST14<8006))!(HST14=8011)!((HST14>8013)&(HST14<8022))!(HST14=8030)!((HST14>8033)&(HST14<8036))!((HST14>8042)&(HST14<8045))!((HST14>8045)&(HST14<8061)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8072)&(HST14<8082))!((HST14>8083)&(HST14<8132))!((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8192)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8200)&(HST14<8222))!(HST14=8231)!((HST14>8240)&(HST14<8246))!(HST14=8247)!(HST14=8248)!(HST14=8251)!((HST14>8260)&(HST14<8265))!((HST14>8269)&(HST14<8333)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8333)&(HST14<8421))!((HST14>8439)&(HST14<8475))!((HST14>8481)&(HST14<8551))!(HST14=8552)!(HST14=8561)!((HST14>8569)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
;00430 GIST 43.1/43.2/XX
I ((ONCT3>149)&(ONCT3<160))!((ONCT3>169)&(ONCT3<173))!((ONCT3>177)&(ONCT3<210))!(ONCT3=480)!(ONCT3=482)!(ONCT3=488) D I ONCJFG=1 Q
.I $E(ONCHIST,5)'=2 D
..I (HST14=8936)&(ONC3926="") S ONCAJID=43.2,ONCAJCHP=43.2,ONCJFG=1 Q
I ONCTPCD="C481" D I ONCJFG=1 Q
.I $E(ONCHIST,5)'=2 D
..I (HST14=8936)&((ONC3926=1)!(ONC3926=9)) S ONCAJID=43.2,ONCAJCHP=43.2,ONCJFG=1 Q
I ONCTPCD="C173" D I ONCJFG=1 Q
.I (HST14=8936)&(ONC3926="") S ONCAJID="XX",ONCJFG=1 Q
I ONCTPCD="C481" D I ONCJFG=1 Q
.I (HST14=8935)&((ONC3926=1)!(ONC3926=2)!(ONC3926=9)) S ONCAJID="XX",ONCJFG=1 Q
.I (HST14=8936)&($E(ONCHIST,5)=2)&((ONC3926=1)!(ONC3926=2)!(ONC3926=9)) S ONCAJID="XX",ONCJFG=1 Q
I ((ONCT3>149)&(ONCT3<173))!((ONCT3>177)&(ONCT3<210))!(ONCT3=480)!(ONCT3=482)!(ONCT3=488) D I ONCJFG=1 Q
.I (HST14=8936)&($E(ONCHIST,5)=2)&(ONC3926="") S ONCAJID="XX",ONCJFG=1 Q
I ((ONCT3>149)&(ONCT3<210))!(ONCT3=480)!(ONCT3=481)!(ONCT3=482)!(ONCT3=488) D I ONCJFG=1 Q
.I (HST14=8935)&(ONC3926="") S ONCAJID="XX",ONCJFG=1 Q
I (ONCT3="000")!((ONCT3>0)&(ONCT3<149))!((ONCT3>209)&(ONCT3<480))!((ONCT3>489)&(ONCT3<540))!((ONCT3>570)&(ONCT3<700))!((ONCT3>738)&(ONCT3<751))!((ONCT3>753)&(ONCT3<810)) D I ONCJFG=1 Q
.I ((HST14=8935)!(HST14=8936))&(ONC3926="") S ONCAJID="XX",ONCJFG=1 Q
I ((ONCT3>699)&(ONCT3<730))!((ONCT3>750)&(ONCT3<754)) D I ONCJFG=1 Q
.I ((HST14=8935)!(HST14=8936))&($E(ONCHIST,5)=3)&(ONC3926="") S ONCAJID="XX",ONCJFG=1 Q
;
;00470 Melanoma of the Skin 47/XX
I ONCSCMA="00470" D I ONCJFG=1 Q
.I (HST14=8722)!((HST14>8724)&(HST14<8729))!(HST14=8740)!(HST14=8741)!((HST14>8745)&(HST14<8761))!(HST14=8762)!(HST14=8773)!(HST14=8774)!(HST14=8790) S ONCAJID="XX",ONCJFG=1 Q
;
;00480 Breast 48.1/48.2/XX
I "C500^C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD D I ONCJFG=1 Q
.I $E(ONCHIST,5)=2 D
..I (HST14=8000)!(HST14=8010)!(HST14=8022)!(HST14=8032)!(HST14=8035)!(HST14=8041)!(HST14=8070)!(HST14=8140)!(HST14=8200)!(HST14=8211)!(HST14=8246)!(HST14=8255)!(HST14=8290)!(HST14=8314)!(HST14=8315)!(HST14=8401) S ONCAJID="XX",ONCJFG=1 Q
..I (HST14=8410)!(HST14=8430)!(HST14=8480)!(HST14=8502)!(HST14=8510)!(HST14=8513)!((HST14>8519)&(HST14<8526))!(HST14=8530)!(HST14=8540)!(HST14=8541)!(HST14=8550)!((HST14>8569)&(HST14<8573))!(HST14=8574) S ONCAJID="XX",ONCJFG=1 Q
..I (HST14=8575)!(HST14=8982)!(HST14=8983) S ONCAJID="XX",ONCJFG=1 Q
I "C500^C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD D I ONCJFG=1 Q
.I $E(ONCHIST,5)=2 D
..I (HST14=8201)!(HST14=8500)!(HST14=8501)!(HST14=8503)!(HST14=8504)!(HST14=8507)!(HST14=8509)!(HST14=8543) S ONCAJID=48.1,ONCJFG=1
I "C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD D I ONCJFG=1 Q
.I ((HST14>8719)&(HST14<8791)) S ONCAJID="XX",ONCJFG=1
;
;00580 Prostate 58/XX
I ONCSCMA="00580" D I ONCJFG=1 Q
.I ($E(ONCHIST,5)=2)&((HST14=8000)!(HST14=8010)!(HST14=8013)!(HST14=8041)!(HST14=8070)!(HST14=8120)!(HST14=8140)!(HST14=8147)!(HST14=8148)!(HST14=8201)!(HST14=8230)!(HST14=8240)) S ONCAJID="XX",ONCJFG=1 Q
.I ($E(ONCHIST,5)=2)&((HST14=8260)!(HST14=8480)!(HST14=8490)!(HST14=8500)!(HST14=8560)!(HST14=8572)!(HST14=8574)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8010)&(HST14<8013))!((HST14>8013)&(HST14<8041))!((HST14>8041)&(HST14<8061))!((HST14>8070)&(HST14<8111))!((HST14>8120)&(HST14<8132))!((HST14>8140)&(HST14<8147))!((HST14>8148)&(HST14<8201)) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8201)&(HST14<8222))!(HST14=8231)!((HST14>8240)&(HST14<8258))!((HST14>8260)&(HST14<8475))!(HST14=8481)!(HST14=8482)!((HST14>8500)&(HST14<8553))!((HST14>8560)&(HST14<8572))!(HST14=8573) S ONCAJID="XX",ONCJFG=1 Q
.I ((HST14>8574)&(HST14<8701))!((HST14>8000)&(HST14<8006))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701) S ONCAJID="XX",ONCJFG=1 Q
;
D ^ONCSCHMY ;continued in ONCSCHMY
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HONCSCHMX 14533 printed Oct 16, 2024@18:28:50 Page 2
ONCSCHMX ;HINES OIFO/RTK - AJCC ID, XX and other special code ;08/28/19
+1 ;;2.2;ONCOLOGY;**10,12,13,17**;Jul 31, 2013;Build 6
+2 ;
+3 QUIT
CHKAJID ;Special code for some Schemas-AJCC ID/Chapter values including 'XX'
+1 NEW ONCJFG,ONC3926
SET ONCJFG=0
+2 SET ONCHIST=$$HIST^ONCFUNC(D0)
+3 ;remove the "."
SET ONCTPCD=$PIECE(TOPCOD,".",1)_$PIECE(TOPCOD,".",2)
+4 SET HST14=$EXTRACT(ONCHIST,1,4)
SET ONCT3=$EXTRACT(ONCTPCD,2,5)
+5 ; Schema Discriminator 1
SET ONC3926=$PIECE($GET(^ONCO(165.5,D0,"SSD4")),U,21)
+6 ; Schema Discriminator 2
SET ONC3927=$PIECE($GET(^ONCO(165.5,D0,"SSD4")),U,22)
+7 DO ^ONCSCHMA
IF ONCSCMA=0
WRITE !!,"Unable to calculate the AJCC ID Value",!
QUIT
+8 SET ONCJFG=0
+9 ;
+10 ;
+11 ;00060 Cervical LN & Unknown Primary 6/XX
+12 IF ONCSCMA="00060"
Begin DoDot:1
+13 IF ((HST14>7999)&(HST14<8006))!((HST14>8010)&(HST14<8046))!(HST14=8050)!((HST14>8052)&(HST14<8061))!((HST14>8074)&(HST14<8082))!((HST14>8084)&(HST14<8121))!((HST14>8121)&(HST14<8132))!((HST14>8140)&(HST14<8147))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+14 IF ((HST14>8147)&(HST14<8192))!((HST14>8200)&(HST14<8301))!((HST14>8310)&(HST14<8421))!((HST14>8439)&(HST14<8445))!((HST14>8450)&(HST14<8475))!((HST14>8480)&(HST14<8525))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+15 IF ((HST14>8529)&(HST14<8544))!((HST14>8550)&(HST14<8562))!((HST14>8569)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+16 ;
+17 ;00090 Nasopharynx 9/XX
+18 IF ONCSCMA="00090"
Begin DoDot:1
+19 IF ((HST14>8000)&(HST14<8006))!((HST14>8010)&(HST14<8016))!((HST14>8020)&(HST14<8052))!((HST14>8052)&(HST14<8061))!((HST14>8073)&(HST14<8083))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+20 IF ((HST14>8083)&(HST14<8132))!((HST14>8140)&(HST14<8192))!((HST14>8200)&(HST14<8701))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+21 ;
+22 ;00111 Oropharynx (p16-) 11.1/XX
+23 IF ONCSCMA="00111"
Begin DoDot:1
+24 IF (ONCTPCD="C104")&((HST14=8051)!(HST14=8052)!(HST14=8070)!(HST14=8074)!(HST14=8075)!(HST14=8082)!(HST14=8083)!(HST14=8086)!(HST14=8560))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+25 IF "C019^C024^C051^C052^C090^C091^C098^C099^C100^C102^C103^C104^C108^C109^C111"[ONCTPCD
Begin DoDot:2
+26 IF ((HST14>7999)&(HST14<8051))!((HST14>8052)&(HST14<8061))!((HST14>8070)&(HST14<8074))!((HST14>8075)&(HST14<8082))!((HST14>8083)&(HST14<8086))!((HST14>8089)&(HST14<8553))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+27 IF ((HST14>8560)&(HST14<8701))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+28 IF (HST14=8051)!(HST14=8052)!(HST14=8070)!(HST14=8074)!(HST14=8075)!(HST14=8082)!(HST14=8083)!(HST14=8086)!(HST14=8560)
SET ONCAJID="11.1"
SET ONCJFG=1
QUIT
End DoDot:2
End DoDot:1
IF ONCJFG=1
QUIT
+29 ;
+30 ;00100 Oropharynx (p16+) 10/XX
+31 IF ONCSCMA="00100"
Begin DoDot:1
+32 IF (ONCTPCD="C104")&((HST14=8070)!(HST14=8072)!(HST14=8083)!(HST14=8085))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+33 IF "C019^C024^C051^C052^C090^C091^C098^C099^C100^C102^C103^C104^C108^C109^C111"[ONCTPCD
Begin DoDot:2
+34 IF ($EXTRACT(ONCHIST,5)=2)&((HST14=8070)!(HST14=8072)!(HST14=8083)!(HST14=8085))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+35 IF ((HST14>7999)&(HST14<8061))!(HST14=8071)!((HST14>8072)&(HST14<8083))!(HST14=8084)!((HST14>8085)&(HST14<8701))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
End DoDot:1
IF ONCJFG=1
QUIT
+36 ;
+37 ;00112 Hypopharynx 11.2/XX
+38 IF ONCSCMA="00112"
Begin DoDot:1
+39 IF ((HST14>7999)&(HST14<8051))!((HST14>8052)&(HST14<8061))!((HST14>8070)&(HST14<8074))!((HST14>8075)&(HST14<8082))!((HST14>8083)&(HST14<8086))!((HST14>8089)&(HST14<8553))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+40 IF ((HST14>8560)&(HST14<8701))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+41 ;
+42 ;00140 Melanoma of Head & Neck 14/XX
+43 IF ONCSCMA="00140"
Begin DoDot:1
+44 IF ((ONCT3>2)&(ONCT3<6))!((ONCT3>7)&(ONCT3<10))!((ONCT3>18)&(ONCT3<70))!((ONCT3>89)&(ONCT3<92))!((ONCT3>97)&(ONCT3<104))!((ONCT3>107)&(ONCT3<149))!(ONCT3=300)!(ONCT3=310)!(ONCT3=311)!((ONCT3>319)&(ONCT3<323))!(ONCT3=328)!(ONCT3=329)
Begin DoDot:2
+45 IF ($EXTRACT(ONCHIST,5)=2)
Begin DoDot:3
+46 IF ((HST14=8720)!(HST14=8721)!(HST14=8722)!(HST14=8730)!(HST14=8745)!(HST14=8746)!(HST14=8770)!(HST14=8771)!(HST14=8772))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:3
IF ONCJFG=1
QUIT
End DoDot:2
+47 IF "C104^C301^C312^C313^C318^C319^C323"[ONCTPCD
Begin DoDot:2
+48 IF (HST14=8720)!(HST14=8721)!(HST14=8722)!(HST14=8730)!(HST14=8745)!(HST14=8746)!(HST14=8770)!(HST14=8771)!(HST14=8772)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
IF ONCJFG=1
QUIT
+49 IF ((ONCT3>2)&(ONCT3<6))!((ONCT3>7)&(ONCT3<10))!((ONCT3>18)&(ONCT3<70))!((ONCT3>89)&(ONCT3<149))!((ONCT3>299)&(ONCT3<330))
Begin DoDot:2
+50 IF ((HST14>8722)&(HST14<8729))!((HST14>8739)&(HST14<8745))!((HST14>8749)&(HST14<8763))!((HST14>8772)&(HST14<8791))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
IF ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+51 ;
+52 ;00161 Esophagus (Squamous) 16.1/XX
+53 IF (ONCSCMA="00161")
Begin DoDot:1
+54 IF (HST14=8020)!(HST14=8051)!(HST14=8070)!(HST14=8074)!(HST14=8077)!(HST14=8083)!(HST14=8560)
SET ONCAJID=16.1
SET ONCAJCHP=16.1
SET ONCJFG=1
QUIT
+55 IF (HST14=8050)!(HST14=8052)!(HST14=8053)!(HST14=8054)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+56 ;
+57 ;00169 Esophagus (excluding Squamous) 16.2/16.3/XX
+58 IF (ONCSCMA="00169")
Begin DoDot:1
+59 IF "C150^C151^C152^C153^C154^C155^C158^C159"[ONCTPCD
Begin DoDot:2
+60 IF (HST14=8240)!(HST14=8249)
SET ONCAJID=16.3
SET ONCAJCHP=16.3
SET ONCJFG=1
QUIT
+61 IF (HST14=8150)!(HST14=8151)!(HST14=8152)!(HST14=8153)!(HST14=8155)!(HST14=8156)!(HST14=8158)!(HST14=8241)!(HST14=8242)!(HST14=8683)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
+62 IF "C150^C151^C152^C153^C154^C155^C158^C159^C160"[ONCTPCD
Begin DoDot:2
+63 IF (HST14=8000)!(HST14=8010)!(HST14=8013)!(HST14=8041)!(HST14=8071)!(HST14=8145)!(HST14=8246)!(HST14=8255)
SET ONCAJID=16.3
SET ONCAJCHP=16.3
SET ONCJFG=1
QUIT
+64 IF ((HST14=8020)&(ONC3927=2))!(HST14=8140)!(HST14=8148)!(HST14=8200)!(HST14=8244)!(HST14=8430)
SET ONCAJID=16.2
SET ONCAJCHP=16.2
SET ONCJFG=1
QUIT
+65 IF ((HST14>8000)&(HST14<8006))!((HST14>8010)&(HST14<8013))!((HST14>8013)&(HST14<8015))!((HST14>8020)&(HST14<8041))!(HST14=8060)!((HST14>8071)&(HST14<8074))!((HST14>8074)&(HST14<8077))!((HST14>8077)&(HST14<8083))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+66 IF ((HST14>8083)&(HST14<8132))!((HST14>8140)&(HST14<8145))!(HST14=8146)!(HST14=8147)!(HST14=8149)!(HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8192))!((HST14>8200)&(HST14<8232))!(HST14=8243)!(HST14=8245)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
+67 IF ((HST14>8041)&(HST14<8047))!(HST14=8247)!(HST14=8248)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+68 IF ((HST14>8249)&(HST14<8255))!((HST14>8255)&(HST14<8421))!((HST14>8439)&(HST14<8553))!((HST14>8560)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+69 ;
+70 ;00180 Small Intestine 18.1/18.2/XX
+71 IF ONCSCMA="00180"
Begin DoDot:1
+72 IF "C170^C171^C172^C178^C179"[ONCTPCD
Begin DoDot:2
+73 IF (HST14=8000)!(HST14=8013)!(HST14=8020)!(HST14=8041)!(HST14=8070)!(HST14=8148)!(HST14=8244)!(HST14=8255)!(HST14=8510)!(HST14=8560)
SET ONCAJID=18.2
SET ONCJFG=1
QUIT
End DoDot:2
+74 IF ONCTPCD="C173"
Begin DoDot:2
+75 IF (HST14=8000)!(HST14=8010)!(HST14=8013)!(HST14=8020)!(HST14=8041)!(HST14=8070)!(HST14=8140)!(HST14=8148)!(HST14=8210)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+76 IF (HST14=8244)!(HST14=8255)!(HST14=8261)!(HST14=8263)!(HST14=8480)!(HST14=8481)!(HST14=8490)!(HST14=8510)!(HST14=8560)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
+77 IF "C170^C171^C172^C173^C178^C179"[ONCTPCD
Begin DoDot:2
+78 IF ((HST14>7999)&(HST14<8006))!(HST14=8011)!(HST14=8012)!(HST14=8014)!(HST14=8015)!((HST14>8020)&(HST14<8041))!((HST14>8041)&(HST14<8061))!((HST14>8070)&(HST14<8132))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+79 IF ((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8148))!(HST14=8149)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+80 IF (HST14=8154)!(HST14=8157)!((HST14>8159)&(HST14<8205))!((HST14>8210)&(HST14<8213))!((HST14>8213)&(HST14<8232))!(HST14=8243)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+81 IF ((HST14>8244)&(HST14<8249))!((HST14>8249)&(HST14<8255))!((HST14>8255)&(HST14<8261))!(HST14=8262)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+82 IF ((HST14>8263)&(HST14<8475))!(HST14=8482)!((HST14>8499)&(HST14<8510))!((HST14>8511)&(HST14<8553))!((HST14>8560)&(HST14<8683))!((HST14>8689)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
End DoDot:1
IF ONCJFG=1
QUIT
+83 ;
+84 ;00220 Liver 22/XX
+85 IF ONCSCMA="00220"
Begin DoDot:1
+86 IF ($EXTRACT(ONCHIST,5)=2)&((HST14>8169)&(HST14<8175))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+87 IF ((HST14>7999)&(HST14<8164))!((HST14>8174)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+88 ;
+89 ;00230 Bile Ducts Intrahepatic 23/XX
+90 IF ONCSCMA="00230"
Begin DoDot:1
+91 IF ((HST14>7999)&(HST14<8013))!((HST14>8013)&(HST14<8041))!((HST14>8041)&(HST14<8148))!((HST14>8148)&(HST14<8159))!((HST14>8161)&(HST14<8176))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+92 IF ((HST14>8189)&(HST14<8246))!((HST14>8246)&(HST14<8464))!((HST14>8470)&(HST14<8503))!((HST14>8503)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+93 ;
+94 ;00241/00242/00250 Gallbladder/Cystic Duct/Bile Duct Perihilar 24/25/XX
+95 IF (ONCSCMA="00241")!(ONCSCMA="00242")!(ONCSCMA="00250")
Begin DoDot:1
+96 IF ((HST14>7999)&(HST14<8006))!(HST14=8011)!(HST14=8012)!(HST14=8014)!(HST14=8015)!((HST14>8020)&(HST14<8041))!((HST14>8041)&(HST14<8061))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+97 IF ((HST14>8070)&(HST14<8132))!((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8148))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+98 IF ((HST14>8148)&(HST14<8246))!((HST14>8246)&(HST14<8301))!((HST14>8310)&(HST14<8464))!((HST14>8470)&(HST14<8475))!((HST14>8503)&(HST14<8553))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+99 IF (HST14=8481)!(HST14=8482)!(HST14=8500)!(HST14=8501)!(HST14=8502)!((HST14>8560)&(HST14<8701))!((HST14>8719)&(HST14<8791))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+100 ;
+101 ;00260 Bile Ducts Distal 26/XX
+102 IF ONCSCMA="00260"
Begin DoDot:1
+103 IF ((HST14>8000)&(HST14<8006))!(HST14=8011)!(HST14=8012)!(HST14=8014)!(HST14=8015)!((HST14>8020)&(HST14<8041))!((HST14>8041)&(HST14<8061))!((HST14>8070)&(HST14<8132))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+104 IF ((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8148))!((HST14>8148)&(HST14<8159))!(HST14=8161)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+105 IF ((HST14>8162)&(HST14<8244))!(HST14=8245)!((HST14>8246)&(HST14<8301))!((HST14>8310)&(HST14<8464))!((HST14>8470)&(HST14<8475))!((HST14>8503)&(HST14<8553))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+106 IF (HST14=8481)!(HST14=8482)!(HST14=8501)!(HST14=8502)!((HST14>8560)&(HST14<8701))!((HST14>8719)&(HST14<8791))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+107 ;
+108 ;00360 Lung 36/XX
+109 IF ONCSCMA="00360"
Begin DoDot:1
+110 IF ((HST14>8000)&(HST14<8006))!(HST14=8011)!((HST14>8013)&(HST14<8022))!(HST14=8030)!((HST14>8033)&(HST14<8036))!((HST14>8042)&(HST14<8045))!((HST14>8045)&(HST14<8061))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+111 IF ((HST14>8072)&(HST14<8082))!((HST14>8083)&(HST14<8132))!((HST14>8140)&(HST14<8144))!((HST14>8144)&(HST14<8192))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+112 IF ((HST14>8200)&(HST14<8222))!(HST14=8231)!((HST14>8240)&(HST14<8246))!(HST14=8247)!(HST14=8248)!(HST14=8251)!((HST14>8260)&(HST14<8265))!((HST14>8269)&(HST14<8333))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+113 IF ((HST14>8333)&(HST14<8421))!((HST14>8439)&(HST14<8475))!((HST14>8481)&(HST14<8551))!(HST14=8552)!(HST14=8561)!((HST14>8569)&(HST14<8701))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+114 ;
+115 ;00430 GIST 43.1/43.2/XX
+116 IF ((ONCT3>149)&(ONCT3<160))!((ONCT3>169)&(ONCT3<173))!((ONCT3>177)&(ONCT3<210))!(ONCT3=480)!(ONCT3=482)!(ONCT3=488)
Begin DoDot:1
+117 IF $EXTRACT(ONCHIST,5)'=2
Begin DoDot:2
+118 IF (HST14=8936)&(ONC3926="")
SET ONCAJID=43.2
SET ONCAJCHP=43.2
SET ONCJFG=1
QUIT
End DoDot:2
End DoDot:1
IF ONCJFG=1
QUIT
+119 IF ONCTPCD="C481"
Begin DoDot:1
+120 IF $EXTRACT(ONCHIST,5)'=2
Begin DoDot:2
+121 IF (HST14=8936)&((ONC3926=1)!(ONC3926=9))
SET ONCAJID=43.2
SET ONCAJCHP=43.2
SET ONCJFG=1
QUIT
End DoDot:2
End DoDot:1
IF ONCJFG=1
QUIT
+122 IF ONCTPCD="C173"
Begin DoDot:1
+123 IF (HST14=8936)&(ONC3926="")
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+124 IF ONCTPCD="C481"
Begin DoDot:1
+125 IF (HST14=8935)&((ONC3926=1)!(ONC3926=2)!(ONC3926=9))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+126 IF (HST14=8936)&($EXTRACT(ONCHIST,5)=2)&((ONC3926=1)!(ONC3926=2)!(ONC3926=9))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+127 IF ((ONCT3>149)&(ONCT3<173))!((ONCT3>177)&(ONCT3<210))!(ONCT3=480)!(ONCT3=482)!(ONCT3=488)
Begin DoDot:1
+128 IF (HST14=8936)&($EXTRACT(ONCHIST,5)=2)&(ONC3926="")
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+129 IF ((ONCT3>149)&(ONCT3<210))!(ONCT3=480)!(ONCT3=481)!(ONCT3=482)!(ONCT3=488)
Begin DoDot:1
+130 IF (HST14=8935)&(ONC3926="")
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+131 IF (ONCT3="000")!((ONCT3>0)&(ONCT3<149))!((ONCT3>209)&(ONCT3<480))!((ONCT3>489)&(ONCT3<540))!((ONCT3>570)&(ONCT3<700))!((ONCT3>738)&(ONCT3<751))!((ONCT3>753)&(ONCT3<810))
Begin DoDot:1
+132 IF ((HST14=8935)!(HST14=8936))&(ONC3926="")
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+133 IF ((ONCT3>699)&(ONCT3<730))!((ONCT3>750)&(ONCT3<754))
Begin DoDot:1
+134 IF ((HST14=8935)!(HST14=8936))&($EXTRACT(ONCHIST,5)=3)&(ONC3926="")
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+135 ;
+136 ;00470 Melanoma of the Skin 47/XX
+137 IF ONCSCMA="00470"
Begin DoDot:1
+138 IF (HST14=8722)!((HST14>8724)&(HST14<8729))!(HST14=8740)!(HST14=8741)!((HST14>8745)&(HST14<8761))!(HST14=8762)!(HST14=8773)!(HST14=8774)!(HST14=8790)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+139 ;
+140 ;00480 Breast 48.1/48.2/XX
+141 IF "C500^C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD
Begin DoDot:1
+142 IF $EXTRACT(ONCHIST,5)=2
Begin DoDot:2
+143 IF (HST14=8000)!(HST14=8010)!(HST14=8022)!(HST14=8032)!(HST14=8035)!(HST14=8041)!(HST14=8070)!(HST14=8140)!(HST14=8200)!(HST14=8211)!(HST14=8246)!(HST14=8255)!(HST14=8290)!(HST14=8314)!(HST14=8315)!(HST14=8401)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+144 IF (HST14=8410)!(HST14=8430)!(HST14=8480)!(HST14=8502)!(HST14=8510)!(HST14=8513)!((HST14>8519)&(HST14<8526))!(HST14=8530)!(HST14=8540)!(HST14=8541)!(HST14=8550)!((HST14>8569)&(HST14<8573))!(HST14=8574)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+145 IF (HST14=8575)!(HST14=8982)!(HST14=8983)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:2
End DoDot:1
IF ONCJFG=1
QUIT
+146 IF "C500^C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD
Begin DoDot:1
+147 IF $EXTRACT(ONCHIST,5)=2
Begin DoDot:2
+148 IF (HST14=8201)!(HST14=8500)!(HST14=8501)!(HST14=8503)!(HST14=8504)!(HST14=8507)!(HST14=8509)!(HST14=8543)
SET ONCAJID=48.1
SET ONCJFG=1
End DoDot:2
End DoDot:1
IF ONCJFG=1
QUIT
+149 IF "C501^C502^C503^C504^C505^C506^C508^C509"[ONCTPCD
Begin DoDot:1
+150 IF ((HST14>8719)&(HST14<8791))
SET ONCAJID="XX"
SET ONCJFG=1
End DoDot:1
IF ONCJFG=1
QUIT
+151 ;
+152 ;00580 Prostate 58/XX
+153 IF ONCSCMA="00580"
Begin DoDot:1
+154 IF ($EXTRACT(ONCHIST,5)=2)&((HST14=8000)!(HST14=8010)!(HST14=8013)!(HST14=8041)!(HST14=8070)!(HST14=8120)!(HST14=8140)!(HST14=8147)!(HST14=8148)!(HST14=8201)!(HST14=8230)!(HST14=8240))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+155 IF ($EXTRACT(ONCHIST,5)=2)&((HST14=8260)!(HST14=8480)!(HST14=8490)!(HST14=8500)!(HST14=8560)!(HST14=8572)!(HST14=8574))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+156 IF ((HST14>8010)&(HST14<8013))!((HST14>8013)&(HST14<8041))!((HST14>8041)&(HST14<8061))!((HST14>8070)&(HST14<8111))!((HST14>8120)&(HST14<8132))!((HST14>8140)&(HST14<8147))!((HST14>8148)&(HST14<8201))
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+157 IF ((HST14>8201)&(HST14<8222))!(HST14=8231)!((HST14>8240)&(HST14<8258))!((HST14>8260)&(HST14<8475))!(HST14=8481)!(HST14=8482)!((HST14>8500)&(HST14<8553))!((HST14>8560)&(HST14<8572))!(HST14=8573)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
+158 IF ((HST14>8574)&(HST14<8701))!((HST14>8000)&(HST14<8006))!((HST14>8719)&(HST14<8791))!(HST14=9700)!(HST14=9701)
SET ONCAJID="XX"
SET ONCJFG=1
QUIT
End DoDot:1
IF ONCJFG=1
QUIT
+159 ;
+160 ;continued in ONCSCHMY
DO ^ONCSCHMY
+161 QUIT