LEX2030 ;ISL/KER - Environment Check/Pre/Post Install ; 08/04/2004
;;2.0;LEXICON UTILITY;**30**;Sep 23, 1996
;
; External References
; DBIA 10015 EN^DIQ1
; DBIA 10141 $$PATCH^XPDUTL
; DBIA 10141 $$VERSION^XPDUTL
; DBIA 10141 BMES^XPDUTL
; DBIA 10141 MES^XPDUTL
;
; Global Variables
; ^ICD( ^ICD("ADS"
; ^DIC(81.3 ^DIC(81.3,"ADS" ^DIC(81.3,"AST"
; ^ICD0( ^ICD0("ADS" ^ICD0("AST"
; ^ICD9( ^ICD9("ADS" ^ICD9("AST"
; ^ICPT( ^ICPT("ADS ^ICPT("AST"
; ^LEXM ^LEXM(0
;
ENV ; LEX*2.0*30 Environment Check
;
; General
;
N LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXG,LEXE
W !," LEX - Lexicon Code Text Descriptors (CTD)",!
D IMP S U="^"
; No user
D:+($$UR)'>0 ET("User not defined (DUZ)")
; No IO
D:+($$SY)'>0 ET("Undefined IO variable(s)") I $D(LEXE) D ABRT Q
;
; Load Distribution
;
; XPDENV = 0 Environment Check during Load
;
; Check Version (2.0)
I $$VERSION^XPDUTL("LEX")'="2.0" D D ABRT Q
. D ET("Version 2.0 not found. Please install Lexicon Utility v 2.0")
;
; Check Required Patches
D:'$L($G(LEXREQP)) IMP I $L(LEXREQP) D
. N LEXPAT,LEXI,LEXPN
. F LEXI=1:1 Q:'$L($P(LEXREQP,";",LEXI)) S LEXPAT=$P(LEXREQP,";",LEXI) D
. . S LEXPN=$$PATCH^XPDUTL(LEXPAT) W !," Checking for ",LEXPAT I +LEXPN>0 H 1 W " - installed"
. . I +LEXPN'>0 D ET((LEXPAT_" not found, please install "_LEXPAT_" before continuing"))
I $D(LEXE) D ABRT Q
S LEXG=$$RGBL
I $D(LEXE)&(+LEXG=0) D ABRT Q
I $D(LEXE)&(+LEXG<0) D ABRT Q
I '$D(LEXFULL)&(+($G(XPDENV))'=1) D QUIT Q
;
; Install Package(s)
;
; XPDENV = 1 Environment Check during Install
;
; Check Data "is installed" or "is translated"
N LEXIT S LEXIT=+($$CPD) I '$D(LEXFULL)&(LEXIT) D QUIT Q
; Checking Global "Write" Protection
D:+($G(XPDENV))=1 GBLS I $D(LEXE) D ABRT Q
; Check Import Global Checksum
D:+($G(XPDENV))=1 CS I $D(LEXE) D ABRT Q
;
; Quit, Exit or Abort
;
QUIT ; Quit Passed Environment Check
K LEXFULL D OK
Q
EXIT ; Exit Failed Environment Check
D:$D(LEXE) ED S XPDQUIT=2 K LEXE,LEXFULL Q
ABRT ; Abort Failed Environment Check, KILL the distribution
D:$D(LEXE) ED S XPDABORT=1,XPDQUIT=1,XPDQUIT("LEX*2.0*30")=1
S XPDQUIT("ICD*18.0*12")=1,XPDQUIT("ICPT*6.0*19")=1
S XPDQUIT("CTD UTIL 1.0")=1 K LEXE,LEXFULL
Q
;
; Checks
;
GBLS ; Check Write access on globals
N LEXE,LEXGBL,LEXRT,LEXT,LEXF,LEXI,LEXX,LEXOK,LEXCPD,LEXS,X S LEXOK=1
D BM(" I will now check the protection on ^LEX, ^LEXT, ^LEXC and ^LEXM Globals.")
D M(" If you get an ERROR, you will need to change the protection on these")
D M(" globals to allow read/write as indicated for the appropriate M system:")
D BM(" System World Group UCI")
D M(" DSM for OpenVMS RWP RW RW RW")
D BM(" System World Group User")
D M(" MSM-DOS RWD RWD RWD RWD")
D BM(" Owner Group World Network")
D M(" Cache systems RWD RW RW RWD")
D BM(" Checking:"),M(" ")
S LEXCPD=$$CPD,LEXS="",X=1 F LEXI=1:1 D Q:'$L(LEXX)
. S LEXX="" S LEXE="S LEXX=$T(GD+"_LEXI_")" X LEXE S LEXX=$$TRIM(LEXX) Q:'$L(LEXX) Q:'$L($TR(LEXX,";",""))
. S LEXGBL=$P(LEXX,";",3) Q:+LEXCPD>0&(LEXGBL="^LEXM(0)") S LEXRT=$P(LEXX,";",4),LEXT=$P(LEXX,";",5),LEXF=$P(LEXX,";",6)
. S (LEXB1,LEXB2)="",$P(LEXB1," ",(19-$L(LEXRT)))="",$P(LEXB2," ",(28-$L(LEXT)))=""
. I '$D(@LEXGBL) D RGNF S LEXOK=0 D M((" <"_LEXRT_" not found>")) Q
. D M((" "_LEXRT_LEXB1_LEXT_LEXB2_LEXF)) S @LEXGBL=$G(@LEXGBL) H 1
D:LEXOK M(" --> ok") D:'LEXOK M(" ??") D M(" ")
Q
RGBL(X) ; Check Write access on globals
N LEXCPD,LEXS,LEXI,LEXX,LEXEC,LEXGBL,LEXRT,LEXT,LEXF,LEXB1,LEXB2
S LEXCPD=$$CPD,LEXS="",X=1 F LEXI=1:1 D Q:'$L(LEXX)
. S LEXX="" S LEXEC="S LEXX=$T(GD+"_LEXI_")" X LEXEC S LEXX=$$TRIM(LEXX) Q:'$L(LEXX) Q:'$L($TR(LEXX,";",""))
. S LEXGBL=$P(LEXX,";",3) Q:+LEXCPD>0&(LEXGBL="^LEXM(0)") S LEXRT=$P(LEXX,";",4),LEXT=$P(LEXX,";",5),LEXF=$P(LEXX,";",6)
. S (LEXB1,LEXB2)="",$P(LEXB1," ",(15-$L(LEXRT)))="",$P(LEXB2," ",(28-$L(LEXT)))=""
. I '$D(@LEXGBL) S:LEXS'[LEXRT LEXS=LEXS_", "_LEXRT S X=-1 S:LEXGBL["LEXM("&(X=1) X=0
I $L(LEXS),X'>0 D
. S:LEXS[", " LEXS=$P(LEXS,", ",1,($L(LEXS,", ")-1))_" and "_$P(LEXS,", ",$L(LEXS,", "))
. S:$E(LEXS,1,2)=", " LEXS=$E(LEXS,3,$L(LEXS)) S:$E(LEXS,1,7)[" and " LEXS=$P(LEXS," and ",2)
. D:X=-1 ET(("Global"_$S(LEXS[", "!(LEXS[" and "):"s",1:"")_" "_LEXS_" either not found or incomplete."))
. D:X=0 CM
Q X
RGNF ; Required global not found
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
D:$G(LEXGL)["^LEX"&($G(LEXGL)'["^LEXM") ET(""),ET("Required global "_$P($G(LEXGL),"(",1)_" not found.")
D:$G(LEXGL)["^LEX"&($G(LEXGL)["^LEXM") CM
Q
CHK ; Check the Checksum
D CS I $D(LEXE) D ED Q
D BM(" OK"),M(" ")
Q
CS ; Checksum for import global
K LEXE
D BM(" Running checksum routine on the ^LEXM import global, please wait")
N LEXCHK,LEXNDS,LEXVER S LEXCHK=+($G(^LEXM(0,"CHECKSUM")))
S LEXNDS=+($G(^LEXM(0,"NODES"))),LEXVER=+($$VC(LEXCHK,LEXNDS))
D M(" ") D:LEXVER>0 M(" Checksum is ok"),M(" ")
D:LEXVER=0 CM D:LEXVER=-1 CW D:LEXVER=-2 CU D:LEXVER=-3 CF
Q
VC(X,Y) ; Verify Checksum for import global
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF Q:'$D(^LEXM) 0
D IMP I $G(^LEXM(0,"BUILD"))'=$G(LEXBUILD) Q -1
N LEXCHK,LEXNDS,LEXCNT,LEXLC,LEXL,LEXS,LEXNC,LEXD,LEXN,LEXC,LEXGCS,LEXP,LEXT
S LEXCHK=+($G(X)),LEXNDS=+($G(Y))
Q:LEXCHK'>0!(LEXNDS'>0) -2
S LEXL=64,(LEXCNT,LEXLC)=0,LEXS=(+(LEXNDS\LEXL))
S:LEXS=0 LEXS=1 D:+($O(^LEXM(0)))>0 M("")
S (LEXC,LEXN)="^LEXM",(LEXNC,LEXGCS)=0 W " "
F S LEXN=$Q(@LEXN) Q:LEXN=""!(LEXN'[LEXC) D
. Q:LEXN="^LEXM(0,""CHECKSUM"")"
. Q:LEXN="^LEXM(0,""NODES"")"
. S LEXCNT=LEXCNT+1
. I LEXCNT'<LEXS S LEXLC=LEXLC+1 W:LEXLC'>LEXL "." S LEXCNT=0
. S LEXNC=LEXNC+1,LEXD=@LEXN,LEXT=LEXN_"="_LEXD
. F LEXP=1:1:$L(LEXT) S LEXGCS=$A(LEXT,LEXP)*LEXP+LEXGCS
Q:LEXNC'=LEXNDS -3
Q:LEXGCS'=LEXCHK -3
Q 1
SY(X) ; Check System variables
Q:'$D(IO)!('$D(IOF))!('$D(IOM))!('$D(ION))!('$D(IOSL))!('$D(IOST)) 0
Q 1
UR(X) ; Check User variables
Q:'$L($G(DUZ(0))) 0
Q:+($G(DUZ))=0!($$NOTDEF(+$G(DUZ))) 0
Q 1
CPD(X) ; Check Current Patched Data is installed
N INS S INS=1
; ICD
S:'$D(^ICD9("AST"))!('$D(^ICD9("ADS")))!('$D(^ICD0("AST")))!('$D(^ICD0("ADS")))!('$D(^ICD("ADS"))) INS=0
S:'$D(^ICD9(1,67,"B"))!('$D(^ICD9(1,68,"B"))) INS=0 S:'$D(^ICD0(1,67,"B"))!('$D(^ICD0(1,68,"B"))) INS=0
S:'$D(^ICD(1,68,"B")) INS=0
S:$G(^ICD9(13826,66,1,"DRG"))'["248" INS=0
; ICPT
S:'$D(^ICPT("AST"))!('$D(^ICPT("ADS")))!('$D(^DIC(81.3,"AST")))!('$D(^DIC(81.3,"ADS"))) INS=0
S:'$D(^ICPT(100,61,"B"))!('$D(^ICPT(100,62,"B"))) INS=0 S:'$D(^DIC(81.3,1,61,"B"))!('$D(^DIC(81.3,1,62,"B"))) INS=0
;
S X=INS
Q X
;
; Error messages
;
CM ; Missing ^LEXM
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
D ET(""),ET("Missing import global ^LEXM.") D CO
Q
CW ; Wrong ^LEXM
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF,LEXB D IMP
S LEXB=$G(^LEXM(0,"BUILD")) D ET("")
I $L(LEXBUILD),$L(LEXB),LEXBUILD'=LEXB D Q
. D ET(("Incorrect import global ^LEXM found ("_LEXB_" global)."))
. D CKO
D ET("Incorrect import global ^LEXM found.") D CKO
Q
CU ; Unable to verify
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
D ET(""),ET("Unable to verify checksum for import global ^LEXM (possibly corrupt).") D CKO
Q
CF ; Failed checksum
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP D ET("")
D ET("Import global ^LEXM failed checksum.") D CKO
Q
CO ; Obtain new global
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
D ET(""),ET(" Please obtain a copy of the import global ^LEXM contained in the ")
D ET((" global host file "_LEXIGHF_" before continuing with the "_LEXBUILD))
D ET((" installation."))
Q
CKO ; Kill and Obtain new global
N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
D ET(""),ET(" Please KILL the existing import global ^LEXM from your system")
D ET((" and obtain a new copy of ^LEXM contained in the global host file"))
D ET((" "_LEXIGHF_" before continuing with the "_LEXBUILD_" installation."))
Q
ET(X) ; Error Text
N LEXI S LEXI=+($G(LEXE(0))),LEXI=LEXI+1,LEXE(LEXI)=" "_$G(X),LEXE(0)=LEXI
Q
ED ; Error Display
N LEXI S LEXI=0 F S LEXI=$O(LEXE(LEXI)) Q:+LEXI=0 D M(LEXE(LEXI))
D M(" ") K LEXE Q
;
; Miscellaneous
;
IMP ; Import names
S LEXLREV=16,LEXREQP="ICD*18.0*7;ICD*18.0*11;ICPT*6.0*16;LEX*2.0*29",LEXBUILD="LEX*2.0*30"
S LEXIGHF="LEX20_30.GBL"
Q
NOTDEF(IEN) ; Check to see if user is defined
N DA,DR,DIQ,LEX,DIC S DA=IEN,DR=.01,DIC=200,DIQ="LEX" D EN^DIQ1 Q '$D(LEX)
OK ; Environment is OK
N LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXT
D IMP S LEXT=" Environment "_$S($L(LEXBUILD):("for patch/build "_LEXBUILD_" "),1:"")_"is ok"
D BM(LEXT),M(" ")
Q
BM(X) ; Blank Line with Message
D BMES^XPDUTL($G(X)) Q
M(X) ; Message
D MES^XPDUTL($G(X)) Q
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))
Q X
Q
GD ; Global Data
;;^LEX(757.01);^LEX(*;Lexicon;757-757.41
;;^LEXT(757.2);^LEXT(757.2);Lexicon Subsets/Defaults;757.2
;;^LEXC(757.9);^LEXC(*;Lexicon Change File;757.9-757.91
;;^LEXM(0);^LEXM(*;Lexicon Export/Import;No File #
;;^ICD9(0);^ICD9(;ICD Diagnosis;80
;;^ICD0(0);^ICD0(;ICD Operation/Procedure;80.1
;;^ICD(0);^ICD(;DRG;80.2
;;^ICPT(0);^ICPT(;CPT/HCPCS;81
;;^DIC(81.1,0);^DIC(81.1);CPT Category;81.1
;;^DIC(81.2,0);^DIC(81.2);CPT Copyright;81.2
;;^DIC(81.3,0);^DIC(81.3);CPT Modifier;81.3
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLEX2030 9946 printed Nov 22, 2024@17:14 Page 2
LEX2030 ;ISL/KER - Environment Check/Pre/Post Install ; 08/04/2004
+1 ;;2.0;LEXICON UTILITY;**30**;Sep 23, 1996
+2 ;
+3 ; External References
+4 ; DBIA 10015 EN^DIQ1
+5 ; DBIA 10141 $$PATCH^XPDUTL
+6 ; DBIA 10141 $$VERSION^XPDUTL
+7 ; DBIA 10141 BMES^XPDUTL
+8 ; DBIA 10141 MES^XPDUTL
+9 ;
+10 ; Global Variables
+11 ; ^ICD( ^ICD("ADS"
+12 ; ^DIC(81.3 ^DIC(81.3,"ADS" ^DIC(81.3,"AST"
+13 ; ^ICD0( ^ICD0("ADS" ^ICD0("AST"
+14 ; ^ICD9( ^ICD9("ADS" ^ICD9("AST"
+15 ; ^ICPT( ^ICPT("ADS ^ICPT("AST"
+16 ; ^LEXM ^LEXM(0
+17 ;
ENV ; LEX*2.0*30 Environment Check
+1 ;
+2 ; General
+3 ;
+4 NEW LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXG,LEXE
+5 WRITE !," LEX - Lexicon Code Text Descriptors (CTD)",!
+6 DO IMP
SET U="^"
+7 ; No user
+8 if +($$UR)'>0
DO ET("User not defined (DUZ)")
+9 ; No IO
+10 if +($$SY)'>0
DO ET("Undefined IO variable(s)")
IF $DATA(LEXE)
DO ABRT
QUIT
+11 ;
+12 ; Load Distribution
+13 ;
+14 ; XPDENV = 0 Environment Check during Load
+15 ;
+16 ; Check Version (2.0)
+17 IF $$VERSION^XPDUTL("LEX")'="2.0"
Begin DoDot:1
+18 DO ET("Version 2.0 not found. Please install Lexicon Utility v 2.0")
End DoDot:1
DO ABRT
QUIT
+19 ;
+20 ; Check Required Patches
+21 if '$LENGTH($GET(LEXREQP))
DO IMP
IF $LENGTH(LEXREQP)
Begin DoDot:1
+22 NEW LEXPAT,LEXI,LEXPN
+23 FOR LEXI=1:1
if '$LENGTH($PIECE(LEXREQP,";",LEXI))
QUIT
SET LEXPAT=$PIECE(LEXREQP,";",LEXI)
Begin DoDot:2
+24 SET LEXPN=$$PATCH^XPDUTL(LEXPAT)
WRITE !," Checking for ",LEXPAT
IF +LEXPN>0
HANG 1
WRITE " - installed"
+25 IF +LEXPN'>0
DO ET((LEXPAT_" not found, please install "_LEXPAT_" before continuing"))
End DoDot:2
End DoDot:1
+26 IF $DATA(LEXE)
DO ABRT
QUIT
+27 SET LEXG=$$RGBL
+28 IF $DATA(LEXE)&(+LEXG=0)
DO ABRT
QUIT
+29 IF $DATA(LEXE)&(+LEXG<0)
DO ABRT
QUIT
+30 IF '$DATA(LEXFULL)&(+($GET(XPDENV))'=1)
DO QUIT
QUIT
+31 ;
+32 ; Install Package(s)
+33 ;
+34 ; XPDENV = 1 Environment Check during Install
+35 ;
+36 ; Check Data "is installed" or "is translated"
+37 NEW LEXIT
SET LEXIT=+($$CPD)
IF '$DATA(LEXFULL)&(LEXIT)
DO QUIT
QUIT
+38 ; Checking Global "Write" Protection
+39 if +($GET(XPDENV))=1
DO GBLS
IF $DATA(LEXE)
DO ABRT
QUIT
+40 ; Check Import Global Checksum
+41 if +($GET(XPDENV))=1
DO CS
IF $DATA(LEXE)
DO ABRT
QUIT
+42 ;
+43 ; Quit, Exit or Abort
+44 ;
QUIT ; Quit Passed Environment Check
+1 KILL LEXFULL
DO OK
+2 QUIT
EXIT ; Exit Failed Environment Check
+1 if $DATA(LEXE)
DO ED
SET XPDQUIT=2
KILL LEXE,LEXFULL
QUIT
ABRT ; Abort Failed Environment Check, KILL the distribution
+1 if $DATA(LEXE)
DO ED
SET XPDABORT=1
SET XPDQUIT=1
SET XPDQUIT("LEX*2.0*30")=1
+2 SET XPDQUIT("ICD*18.0*12")=1
SET XPDQUIT("ICPT*6.0*19")=1
+3 SET XPDQUIT("CTD UTIL 1.0")=1
KILL LEXE,LEXFULL
+4 QUIT
+5 ;
+6 ; Checks
+7 ;
GBLS ; Check Write access on globals
+1 NEW LEXE,LEXGBL,LEXRT,LEXT,LEXF,LEXI,LEXX,LEXOK,LEXCPD,LEXS,X
SET LEXOK=1
+2 DO BM(" I will now check the protection on ^LEX, ^LEXT, ^LEXC and ^LEXM Globals.")
+3 DO M(" If you get an ERROR, you will need to change the protection on these")
+4 DO M(" globals to allow read/write as indicated for the appropriate M system:")
+5 DO BM(" System World Group UCI")
+6 DO M(" DSM for OpenVMS RWP RW RW RW")
+7 DO BM(" System World Group User")
+8 DO M(" MSM-DOS RWD RWD RWD RWD")
+9 DO BM(" Owner Group World Network")
+10 DO M(" Cache systems RWD RW RW RWD")
+11 DO BM(" Checking:")
DO M(" ")
+12 SET LEXCPD=$$CPD
SET LEXS=""
SET X=1
FOR LEXI=1:1
Begin DoDot:1
+13 SET LEXX=""
SET LEXE="S LEXX=$T(GD+"_LEXI_")"
XECUTE LEXE
SET LEXX=$$TRIM(LEXX)
if '$LENGTH(LEXX)
QUIT
if '$LENGTH($TRANSLATE(LEXX,";",""))
QUIT
+14 SET LEXGBL=$PIECE(LEXX,";",3)
if +LEXCPD>0&(LEXGBL="^LEXM(0)")
QUIT
SET LEXRT=$PIECE(LEXX,";",4)
SET LEXT=$PIECE(LEXX,";",5)
SET LEXF=$PIECE(LEXX,";",6)
+15 SET (LEXB1,LEXB2)=""
SET $PIECE(LEXB1," ",(19-$LENGTH(LEXRT)))=""
SET $PIECE(LEXB2," ",(28-$LENGTH(LEXT)))=""
+16 IF '$DATA(@LEXGBL)
DO RGNF
SET LEXOK=0
DO M((" <"_LEXRT_" not found>"))
QUIT
+17 DO M((" "_LEXRT_LEXB1_LEXT_LEXB2_LEXF))
SET @LEXGBL=$GET(@LEXGBL)
HANG 1
End DoDot:1
if '$LENGTH(LEXX)
QUIT
+18 if LEXOK
DO M(" --> ok")
if 'LEXOK
DO M(" ??")
DO M(" ")
+19 QUIT
RGBL(X) ; Check Write access on globals
+1 NEW LEXCPD,LEXS,LEXI,LEXX,LEXEC,LEXGBL,LEXRT,LEXT,LEXF,LEXB1,LEXB2
+2 SET LEXCPD=$$CPD
SET LEXS=""
SET X=1
FOR LEXI=1:1
Begin DoDot:1
+3 SET LEXX=""
SET LEXEC="S LEXX=$T(GD+"_LEXI_")"
XECUTE LEXEC
SET LEXX=$$TRIM(LEXX)
if '$LENGTH(LEXX)
QUIT
if '$LENGTH($TRANSLATE(LEXX,";",""))
QUIT
+4 SET LEXGBL=$PIECE(LEXX,";",3)
if +LEXCPD>0&(LEXGBL="^LEXM(0)")
QUIT
SET LEXRT=$PIECE(LEXX,";",4)
SET LEXT=$PIECE(LEXX,";",5)
SET LEXF=$PIECE(LEXX,";",6)
+5 SET (LEXB1,LEXB2)=""
SET $PIECE(LEXB1," ",(15-$LENGTH(LEXRT)))=""
SET $PIECE(LEXB2," ",(28-$LENGTH(LEXT)))=""
+6 IF '$DATA(@LEXGBL)
if LEXS'[LEXRT
SET LEXS=LEXS_", "_LEXRT
SET X=-1
if LEXGBL["LEXM("&(X=1)
SET X=0
End DoDot:1
if '$LENGTH(LEXX)
QUIT
+7 IF $LENGTH(LEXS)
IF X'>0
Begin DoDot:1
+8 if LEXS[", "
SET LEXS=$PIECE(LEXS,", ",1,($LENGTH(LEXS,", ")-1))_" and "_$PIECE(LEXS,", ",$LENGTH(LEXS,", "))
+9 if $EXTRACT(LEXS,1,2)=", "
SET LEXS=$EXTRACT(LEXS,3,$LENGTH(LEXS))
if $EXTRACT(LEXS,1,7)[" and "
SET LEXS=$PIECE(LEXS," and ",2)
+10 if X=-1
DO ET(("Global"_$SELECT(LEXS[", "!(LEXS[" and "):"s",1:"")_" "_LEXS_" either not found or incomplete."))
+11 if X=0
DO CM
End DoDot:1
+12 QUIT X
RGNF ; Required global not found
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF
DO IMP
+2 if $GET(LEXGL)["^LEX"&($GET(LEXGL)'["^LEXM")
DO ET("")
DO ET("Required global "_$PIECE($GET(LEXGL),"(",1)_" not found.")
+3 if $GET(LEXGL)["^LEX"&($GET(LEXGL)["^LEXM")
DO CM
+4 QUIT
CHK ; Check the Checksum
+1 DO CS
IF $DATA(LEXE)
DO ED
QUIT
+2 DO BM(" OK")
DO M(" ")
+3 QUIT
CS ; Checksum for import global
+1 KILL LEXE
+2 DO BM(" Running checksum routine on the ^LEXM import global, please wait")
+3 NEW LEXCHK,LEXNDS,LEXVER
SET LEXCHK=+($GET(^LEXM(0,"CHECKSUM")))
+4 SET LEXNDS=+($GET(^LEXM(0,"NODES")))
SET LEXVER=+($$VC(LEXCHK,LEXNDS))
+5 DO M(" ")
if LEXVER>0
DO M(" Checksum is ok")
DO M(" ")
+6 if LEXVER=0
DO CM
if LEXVER=-1
DO CW
if LEXVER=-2
DO CU
if LEXVER=-3
DO CF
+7 QUIT
VC(X,Y) ; Verify Checksum for import global
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF
if '$DATA(^LEXM)
QUIT 0
+2 DO IMP
IF $GET(^LEXM(0,"BUILD"))'=$GET(LEXBUILD)
QUIT -1
+3 NEW LEXCHK,LEXNDS,LEXCNT,LEXLC,LEXL,LEXS,LEXNC,LEXD,LEXN,LEXC,LEXGCS,LEXP,LEXT
+4 SET LEXCHK=+($GET(X))
SET LEXNDS=+($GET(Y))
+5 if LEXCHK'>0!(LEXNDS'>0)
QUIT -2
+6 SET LEXL=64
SET (LEXCNT,LEXLC)=0
SET LEXS=(+(LEXNDS\LEXL))
+7 if LEXS=0
SET LEXS=1
if +($ORDER(^LEXM(0)))>0
DO M("")
+8 SET (LEXC,LEXN)="^LEXM"
SET (LEXNC,LEXGCS)=0
WRITE " "
+9 FOR
SET LEXN=$QUERY(@LEXN)
if LEXN=""!(LEXN'[LEXC)
QUIT
Begin DoDot:1
+10 if LEXN="^LEXM(0,""CHECKSUM"")"
QUIT
+11 if LEXN="^LEXM(0,""NODES"")"
QUIT
+12 SET LEXCNT=LEXCNT+1
+13 IF LEXCNT'<LEXS
SET LEXLC=LEXLC+1
if LEXLC'>LEXL
WRITE "."
SET LEXCNT=0
+14 SET LEXNC=LEXNC+1
SET LEXD=@LEXN
SET LEXT=LEXN_"="_LEXD
+15 FOR LEXP=1:1:$LENGTH(LEXT)
SET LEXGCS=$ASCII(LEXT,LEXP)*LEXP+LEXGCS
End DoDot:1
+16 if LEXNC'=LEXNDS
QUIT -3
+17 if LEXGCS'=LEXCHK
QUIT -3
+18 QUIT 1
SY(X) ; Check System variables
+1 if '$DATA(IO)!('$DATA(IOF))!('$DATA(IOM))!('$DATA(ION))!('$DATA(IOSL))!('$DATA(IOST))
QUIT 0
+2 QUIT 1
UR(X) ; Check User variables
+1 if '$LENGTH($GET(DUZ(0)))
QUIT 0
+2 if +($GET(DUZ))=0!($$NOTDEF(+$GET(DUZ)))
QUIT 0
+3 QUIT 1
CPD(X) ; Check Current Patched Data is installed
+1 NEW INS
SET INS=1
+2 ; ICD
+3 if '$DATA(^ICD9("AST"))!('$DATA(^ICD9("ADS")))!('$DATA(^ICD0("AST")))!('$DATA(^ICD0("ADS")))!('$DATA(^ICD("ADS")))
SET INS=0
+4 if '$DATA(^ICD9(1,67,"B"))!('$DATA(^ICD9(1,68,"B")))
SET INS=0
if '$DATA(^ICD0(1,67,"B"))!('$DATA(^ICD0(1,68,"B")))
SET INS=0
+5 if '$DATA(^ICD(1,68,"B"))
SET INS=0
+6 if $GET(^ICD9(13826,66,1,"DRG"))'["248"
SET INS=0
+7 ; ICPT
+8 if '$DATA(^ICPT("AST"))!('$DATA(^ICPT("ADS")))!('$DATA(^DIC(81.3,"AST")))!('$DATA(^DIC(81.3,"ADS")))
SET INS=0
+9 if '$DATA(^ICPT(100,61,"B"))!('$DATA(^ICPT(100,62,"B")))
SET INS=0
if '$DATA(^DIC(81.3,1,61,"B"))!('$DATA(^DIC(81.3,1,62,"B")))
SET INS=0
+10 ;
+11 SET X=INS
+12 QUIT X
+13 ;
+14 ; Error messages
+15 ;
CM ; Missing ^LEXM
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF
DO IMP
+2 DO ET("")
DO ET("Missing import global ^LEXM.")
DO CO
+3 QUIT
CW ; Wrong ^LEXM
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF,LEXB
DO IMP
+2 SET LEXB=$GET(^LEXM(0,"BUILD"))
DO ET("")
+3 IF $LENGTH(LEXBUILD)
IF $LENGTH(LEXB)
IF LEXBUILD'=LEXB
Begin DoDot:1
+4 DO ET(("Incorrect import global ^LEXM found ("_LEXB_" global)."))
+5 DO CKO
End DoDot:1
QUIT
+6 DO ET("Incorrect import global ^LEXM found.")
DO CKO
+7 QUIT
CU ; Unable to verify
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF
DO IMP
+2 DO ET("")
DO ET("Unable to verify checksum for import global ^LEXM (possibly corrupt).")
DO CKO
+3 QUIT
CF ; Failed checksum
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF
DO IMP
DO ET("")
+2 DO ET("Import global ^LEXM failed checksum.")
DO CKO
+3 QUIT
CO ; Obtain new global
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF
DO IMP
+2 DO ET("")
DO ET(" Please obtain a copy of the import global ^LEXM contained in the ")
+3 DO ET((" global host file "_LEXIGHF_" before continuing with the "_LEXBUILD))
+4 DO ET((" installation."))
+5 QUIT
CKO ; Kill and Obtain new global
+1 NEW LEXLREV,LEXREQP,LEXBUILD,LEXIGHF
DO IMP
+2 DO ET("")
DO ET(" Please KILL the existing import global ^LEXM from your system")
+3 DO ET((" and obtain a new copy of ^LEXM contained in the global host file"))
+4 DO ET((" "_LEXIGHF_" before continuing with the "_LEXBUILD_" installation."))
+5 QUIT
ET(X) ; Error Text
+1 NEW LEXI
SET LEXI=+($GET(LEXE(0)))
SET LEXI=LEXI+1
SET LEXE(LEXI)=" "_$GET(X)
SET LEXE(0)=LEXI
+2 QUIT
ED ; Error Display
+1 NEW LEXI
SET LEXI=0
FOR
SET LEXI=$ORDER(LEXE(LEXI))
if +LEXI=0
QUIT
DO M(LEXE(LEXI))
+2 DO M(" ")
KILL LEXE
QUIT
+3 ;
+4 ; Miscellaneous
+5 ;
IMP ; Import names
+1 SET LEXLREV=16
SET LEXREQP="ICD*18.0*7;ICD*18.0*11;ICPT*6.0*16;LEX*2.0*29"
SET LEXBUILD="LEX*2.0*30"
+2 SET LEXIGHF="LEX20_30.GBL"
+3 QUIT
NOTDEF(IEN) ; Check to see if user is defined
+1 NEW DA,DR,DIQ,LEX,DIC
SET DA=IEN
SET DR=.01
SET DIC=200
SET DIQ="LEX"
DO EN^DIQ1
QUIT '$DATA(LEX)
OK ; Environment is OK
+1 NEW LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXT
+2 DO IMP
SET LEXT=" Environment "_$SELECT($LENGTH(LEXBUILD):("for patch/build "_LEXBUILD_" "),1:"")_"is ok"
+3 DO BM(LEXT)
DO M(" ")
+4 QUIT
BM(X) ; Blank Line with Message
+1 DO BMES^XPDUTL($GET(X))
QUIT
M(X) ; Message
+1 DO MES^XPDUTL($GET(X))
QUIT
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 QUIT X
+4 QUIT
GD ; Global Data
+1 ;;^LEX(757.01);^LEX(*;Lexicon;757-757.41
+2 ;;^LEXT(757.2);^LEXT(757.2);Lexicon Subsets/Defaults;757.2
+3 ;;^LEXC(757.9);^LEXC(*;Lexicon Change File;757.9-757.91
+4 ;;^LEXM(0);^LEXM(*;Lexicon Export/Import;No File #
+5 ;;^ICD9(0);^ICD9(;ICD Diagnosis;80
+6 ;;^ICD0(0);^ICD0(;ICD Operation/Procedure;80.1
+7 ;;^ICD(0);^ICD(;DRG;80.2
+8 ;;^ICPT(0);^ICPT(;CPT/HCPCS;81
+9 ;;^DIC(81.1,0);^DIC(81.1);CPT Category;81.1
+10 ;;^DIC(81.2,0);^DIC(81.2);CPT Copyright;81.2
+11 ;;^DIC(81.3,0);^DIC(81.3);CPT Modifier;81.3