LEX2028 ;ISL/KER - Environment Check/Pre/Post Install ; 01/01/2004
;;2.0;LEXICON UTILITY;**28**;Sep 23, 1996
;
; External References
; DBIA 10141 $$PATCH^XPDUTL
; DBIA 10141 $$VERSION^XPDUTL
; DBIA 10141 BMES^XPDUTL
; DBIA 10141 MES^XPDUTL
; DBIA 10015 EN^DIQ1
;
ENV ; LEX*2.0*28 Environment Check
;
; General
;
N LEXBUILD,LEXIGHF,LEXLAST,LEXLREV,LEXG
D IMP S U="^"
; No user
I '$$UR D ET("User not defined (DUZ)")
; No IO
D:'$$SY ET("Undefined IO variable(s)") I $D(LEXE) D ABRT Q
;
; Load Distribution
;
; Not 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")
I $D(LEXE) D ABRT Q
; Missing last data patch
D:'$L($G(LEXLAST)) IMP I $L(LEXLAST) D
. N LEXPN S LEXPN=$$PATCH^XPDUTL(LEXLAST)
. I 'LEXPN D ET((LEXLAST_" not found, please install "_LEXLAST_" 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)
;
; Check Data "is installed" or "is translated"
N LEXIT S LEXIT=+($$CPD) I '$D(LEXFULL)&(LEXIT) D QUIT Q
; Checking Global "Write" Protection during install
D:+($G(XPDENV))=1 GBLS I $D(LEXE) D ABRT Q
; Import Global Checksum during install
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*28")=1
K LEXE,LEXFULL
Q
;
; Checks
;
GBLS ; Check Write access on globals
N LEXOK 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:") N LEXGL,LEXRT
F LEXGL="^LEX(757.01)","^LEXT(757.2)","^LEXC","^LEXM(0)","^ICD9(0)","^ICD0(0)","^ICPT(0)","^DIC(81.3,0)" D Q:'LEXOK
. S LEXRT=$P(LEXGL,"(",1) S:LEXRT["DIC" LEXRT="^DIC(81.3)" S:LEXRT["LEXT" LEXRT="^LEXT(757.2)" S:"^^LEX^^LEXC^^LEXM^^"[("^"_LEXRT_"^") LEXRT=LEXRT_"(*" S:"^^ICD9^^ICD0^^ICPT^^"[("^"_LEXRT_"^") LEXRT=LEXRT_"("
. I '$D(@LEXGL) D RGNF S LEXOK=0 D Q
. . D M((" <"_LEXRT_" not found>"))
. D M((" "_LEXRT)) S @LEXGL=$G(@LEXGL) H 1
D:LEXOK M(" --> ok") D:'LEXOK M(" ??") D M(" ")
Q
RGBL(X) ; Look for require globals
N LEXLREV,LEXLAST,LEXBUILD,LEXIGHF,LEXGL,LEX0,LEXS S LEXS="",X=1
F LEXGL="^ICD9(0)","^ICD0(0)","^ICPT(0)","^DIC(81.3,0)","^LEX(757,0)","^LEXT(757.2,0)","^LEXM(0)" D
. I +($$CPD)>0,LEXGL["LEXM" Q
. N LEXRT S LEXRT=$P(LEXGL,"(",1)
. S:LEXRT["DIC" LEXRT="^DIC(81.3)"
. S:LEXRT["LEXT" LEXRT="^LEXT(757.2)"
. S:"^^LEX^^LEXC^^LEXM^^"[("^"_LEXRT_"^") LEXRT=LEXRT_"(*" S:"^^ICD9^^ICD0^^ICPT^^"[("^"_LEXRT_"^") LEXRT=LEXRT_"("
. I '$D(@LEXGL) D
. . S:LEXS'[LEXRT LEXS=LEXS_", "_LEXRT
. . S X=-1 S:LEXGL["LEXM("&(X=1) X=0
. I LEXGL'["^LEXC" S LEX0=$G(@LEXGL) I $L(LEX0,"^")'=4 D
. . S:LEXS'[LEXRT LEXS=LEXS_", "_LEXRT
. . S:LEXGL["X("!((LEXGL["T(")) X=-1 S:LEXGL["M("&(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)
. I X=-1,LEXS="^LEXC(*" D Q
. . D ET("Global ^LEXC not found, please create this global and set protection")
. 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,LEXLAST,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 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(" 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,LEXLAST,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=68,(LEXCNT,LEXLC)=0,LEXS=+(LEXNDS\LEXL)
S:LEXS=0 LEXS=1 D:+($O(^LEXM(0)))>0 M("")
S (LEXC,LEXN)="^LEXM",(LEXNC,LEXGCS)=0
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
; Check Last Lexicon Set/Kill
S:'$D(^LEX(757.1,"B",181426,258593)) INS=0
S:$D(^LEX(757.02,"CODE","780.9 ",316332)) INS=0
; Check Last CPT/HCPCS Procedures Set/Kill
S:'$D(^ICPT("F","V2797",107622)) INS=0
S:$D(^ICPT("D",187,104417)) INS=0
; Check Last CPT Modifiers Set
S:'$D(^DIC(81.3,"C","TWO PATIENTS SERVED",489)) INS=0
S X=+($G(INS))
Q X
LPD(X) ; Check Last Patched Data
S INS=1 S:'$D(^LEX(757.02,1,4,1,0)) INS=0 S:'$D(^ICD9("ACT")) INS=0 S:'$D(^ICD0("ACT")) INS=0
S X=INS
Q X
;
; Error messages
;
CM ; Missing ^LEXM
N LEXLREV,LEXLAST,LEXBUILD,LEXIGHF D IMP
D ET(""),ET("Missing import global ^LEXM.") D CO
Q
CW ; Wrong ^LEXM
N LEXLREV,LEXLAST,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,LEXLAST,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,LEXLAST,LEXBUILD,LEXIGHF D IMP D ET("")
D ET("Import global ^LEXM failed checksum.") D CKO
Q
CO ; Obtain new global
N LEXLREV,LEXLAST,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,LEXLAST,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,LEXLAST="LEX*2.0*25",LEXBUILD="LEX*2.0*28"
S LEXIGHF="LEX_2_28.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 ;
N LEXBUILD,LEXIGHF,LEXLAST,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
S X=" "_$G(X) Q:$D(LEXQT) D:$D(XPDNM) BMES^XPDUTL($G(X)) W:'$D(XPDNM) !!,$G(X) Q
M(X) ; Message
S X=" "_$G(X) Q:$D(LEXQT) D:$D(XPDNM) MES^XPDUTL($G(X)) W:'$D(XPDNM) !,$G(X) Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLEX2028 8749 printed Nov 22, 2024@17:13:57 Page 2
LEX2028 ;ISL/KER - Environment Check/Pre/Post Install ; 01/01/2004
+1 ;;2.0;LEXICON UTILITY;**28**;Sep 23, 1996
+2 ;
+3 ; External References
+4 ; DBIA 10141 $$PATCH^XPDUTL
+5 ; DBIA 10141 $$VERSION^XPDUTL
+6 ; DBIA 10141 BMES^XPDUTL
+7 ; DBIA 10141 MES^XPDUTL
+8 ; DBIA 10015 EN^DIQ1
+9 ;
ENV ; LEX*2.0*28 Environment Check
+1 ;
+2 ; General
+3 ;
+4 NEW LEXBUILD,LEXIGHF,LEXLAST,LEXLREV,LEXG
+5 DO IMP
SET U="^"
+6 ; No user
+7 IF '$$UR
DO ET("User not defined (DUZ)")
+8 ; No IO
+9 if '$$SY
DO ET("Undefined IO variable(s)")
IF $DATA(LEXE)
DO ABRT
QUIT
+10 ;
+11 ; Load Distribution
+12 ;
+13 ; Not version 2.0
+14 IF $$VERSION^XPDUTL("LEX")'="2.0"
Begin DoDot:1
+15 DO ET("Version 2.0 not found. Please install Lexicon Utility v 2.0")
End DoDot:1
DO ABRT
QUIT
+16 IF $DATA(LEXE)
DO ABRT
QUIT
+17 ; Missing last data patch
+18 if '$LENGTH($GET(LEXLAST))
DO IMP
IF $LENGTH(LEXLAST)
Begin DoDot:1
+19 NEW LEXPN
SET LEXPN=$$PATCH^XPDUTL(LEXLAST)
+20 IF 'LEXPN
DO ET((LEXLAST_" not found, please install "_LEXLAST_" before continuing"))
End DoDot:1
+21 IF $DATA(LEXE)
DO ABRT
QUIT
+22 SET LEXG=$$RGBL
+23 IF $DATA(LEXE)&(+LEXG=0)
DO ABRT
QUIT
+24 IF $DATA(LEXE)&(+LEXG<0)
DO ABRT
QUIT
+25 IF '$DATA(LEXFULL)&(+($GET(XPDENV))'=1)
DO QUIT
QUIT
+26 ;
+27 ; Install Package(s)
+28 ;
+29 ; Check Data "is installed" or "is translated"
+30 NEW LEXIT
SET LEXIT=+($$CPD)
IF '$DATA(LEXFULL)&(LEXIT)
DO QUIT
QUIT
+31 ; Checking Global "Write" Protection during install
+32 if +($GET(XPDENV))=1
DO GBLS
IF $DATA(LEXE)
DO ABRT
QUIT
+33 ; Import Global Checksum during install
+34 if +($GET(XPDENV))=1
DO CS
IF $DATA(LEXE)
DO ABRT
QUIT
+35 ;
+36 ; Quit, Exit or Abort
+37 ;
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*28")=1
+2 KILL LEXE,LEXFULL
+3 QUIT
+4 ;
+5 ; Checks
+6 ;
GBLS ; Check Write access on globals
+1 NEW LEXOK
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:")
NEW LEXGL,LEXRT
+12 FOR LEXGL="^LEX(757.01)","^LEXT(757.2)","^LEXC","^LEXM(0)","^ICD9(0)","^ICD0(0)","^ICPT(0)","^DIC(81.3,0)"
Begin DoDot:1
+13 SET LEXRT=$PIECE(LEXGL,"(",1)
if LEXRT["DIC"
SET LEXRT="^DIC(81.3)"
if LEXRT["LEXT"
SET LEXRT="^LEXT(757.2)"
if "^^LEX^^LEXC^^LEXM^^"[("^"_LEXRT_"^")
SET LEXRT=LEXRT_"(*"
if "^^ICD9^^ICD0^^ICPT^^"[("^"_LEXRT_"^")
SET LEXRT=LEXRT_"("
+14 IF '$DATA(@LEXGL)
DO RGNF
SET LEXOK=0
Begin DoDot:2
+15 DO M((" <"_LEXRT_" not found>"))
End DoDot:2
QUIT
+16 DO M((" "_LEXRT))
SET @LEXGL=$GET(@LEXGL)
HANG 1
End DoDot:1
if 'LEXOK
QUIT
+17 if LEXOK
DO M(" --> ok")
if 'LEXOK
DO M(" ??")
DO M(" ")
+18 QUIT
RGBL(X) ; Look for require globals
+1 NEW LEXLREV,LEXLAST,LEXBUILD,LEXIGHF,LEXGL,LEX0,LEXS
SET LEXS=""
SET X=1
+2 FOR LEXGL="^ICD9(0)","^ICD0(0)","^ICPT(0)","^DIC(81.3,0)","^LEX(757,0)","^LEXT(757.2,0)","^LEXM(0)"
Begin DoDot:1
+3 IF +($$CPD)>0
IF LEXGL["LEXM"
QUIT
+4 NEW LEXRT
SET LEXRT=$PIECE(LEXGL,"(",1)
+5 if LEXRT["DIC"
SET LEXRT="^DIC(81.3)"
+6 if LEXRT["LEXT"
SET LEXRT="^LEXT(757.2)"
+7 if "^^LEX^^LEXC^^LEXM^^"[("^"_LEXRT_"^")
SET LEXRT=LEXRT_"(*"
if "^^ICD9^^ICD0^^ICPT^^"[("^"_LEXRT_"^")
SET LEXRT=LEXRT_"("
+8 IF '$DATA(@LEXGL)
Begin DoDot:2
+9 if LEXS'[LEXRT
SET LEXS=LEXS_", "_LEXRT
+10 SET X=-1
if LEXGL["LEXM("&(X=1)
SET X=0
End DoDot:2
+11 IF LEXGL'["^LEXC"
SET LEX0=$GET(@LEXGL)
IF $LENGTH(LEX0,"^")'=4
Begin DoDot:2
+12 if LEXS'[LEXRT
SET LEXS=LEXS_", "_LEXRT
+13 if LEXGL["X("!((LEXGL["T("))
SET X=-1
if LEXGL["M("&(X=1)
SET X=0
End DoDot:2
End DoDot:1
+14 IF $LENGTH(LEXS)
IF X'>0
Begin DoDot:1
+15 if LEXS[", "
SET LEXS=$PIECE(LEXS,", ",1,($LENGTH(LEXS,", ")-1))_" and "_$PIECE(LEXS,", ",$LENGTH(LEXS,", "))
+16 if $EXTRACT(LEXS,1,2)=", "
SET LEXS=$EXTRACT(LEXS,3,$LENGTH(LEXS))
+17 if $EXTRACT(LEXS,1,7)[" and "
SET LEXS=$PIECE(LEXS," and ",2)
+18 IF X=-1
IF LEXS="^LEXC(*"
Begin DoDot:2
+19 DO ET("Global ^LEXC not found, please create this global and set protection")
End DoDot:2
QUIT
+20 if X=-1
DO ET(("Global"_$SELECT(LEXS[", "!(LEXS[" and "):"s",1:"")_" "_LEXS_" either not found or incomplete."))
+21 if X=0
DO CM
End DoDot:1
+22 QUIT X
RGNF ; Required global not found
+1 NEW LEXLREV,LEXLAST,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 DO CS
IF $DATA(LEXE)
DO ED
QUIT
+1 DO BM(" OK")
DO M(" ")
+2 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(" 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,LEXLAST,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=68
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
+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 ; Check Last Lexicon Set/Kill
+3 if '$DATA(^LEX(757.1,"B",181426,258593))
SET INS=0
+4 if $DATA(^LEX(757.02,"CODE","780.9 ",316332))
SET INS=0
+5 ; Check Last CPT/HCPCS Procedures Set/Kill
+6 if '$DATA(^ICPT("F","V2797",107622))
SET INS=0
+7 if $DATA(^ICPT("D",187,104417))
SET INS=0
+8 ; Check Last CPT Modifiers Set
+9 if '$DATA(^DIC(81.3,"C","TWO PATIENTS SERVED",489))
SET INS=0
+10 SET X=+($GET(INS))
+11 QUIT X
LPD(X) ; Check Last Patched Data
+1 SET INS=1
if '$DATA(^LEX(757.02,1,4,1,0))
SET INS=0
if '$DATA(^ICD9("ACT"))
SET INS=0
if '$DATA(^ICD0("ACT"))
SET INS=0
+2 SET X=INS
+3 QUIT X
+4 ;
+5 ; Error messages
+6 ;
CM ; Missing ^LEXM
+1 NEW LEXLREV,LEXLAST,LEXBUILD,LEXIGHF
DO IMP
+2 DO ET("")
DO ET("Missing import global ^LEXM.")
DO CO
+3 QUIT
CW ; Wrong ^LEXM
+1 NEW LEXLREV,LEXLAST,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,LEXLAST,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,LEXLAST,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,LEXLAST,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,LEXLAST,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 LEXLAST="LEX*2.0*25"
SET LEXBUILD="LEX*2.0*28"
+2 SET LEXIGHF="LEX_2_28.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 ;
+1 NEW LEXBUILD,LEXIGHF,LEXLAST,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 SET X=" "_$GET(X)
if $DATA(LEXQT)
QUIT
if $DATA(XPDNM)
DO BMES^XPDUTL($GET(X))
if '$DATA(XPDNM)
WRITE !!,$GET(X)
QUIT
M(X) ; Message
+1 SET X=" "_$GET(X)
if $DATA(LEXQT)
QUIT
if $DATA(XPDNM)
DO MES^XPDUTL($GET(X))
if '$DATA(XPDNM)
WRITE !,$GET(X)
QUIT