source: WorldVistAEHR/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEX2043.m@ 814

Last change on this file since 814 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 8.5 KB
Line 
1LEX2043 ; ISL/KER - Environment Check/Pre/Post Install ; 09/06/2006
2 ;;2.0;LEXICON UTILITY;**43**;Sep 23, 1996;Build 1
3 ;
4 ; External References
5 ; DBIA 10015 EN^DIQ1
6 ; DBIA 10141 $$PATCH^XPDUTL
7 ; DBIA 10141 $$VERSION^XPDUTL
8 ; DBIA 10141 BMES^XPDUTL
9 ; DBIA 10141 MES^XPDUTL
10 ;
11ENV ; LEX*2.0*43 Environment Check
12 ;
13 W !,"LEX*2.0*43 Environment Check",!
14 ;
15 N LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXG,LEXE
16 D IMP S U="^"
17 ; No user
18 D:+($$UR)'>0 ET("User not defined (DUZ)")
19 ; No IO
20 D:+($$SY)'>0 ET("Undefined IO variable(s)") I $D(LEXE) D ABRT Q
21 ;
22 ; Load Distribution
23 ;
24 ; XPDENV = 0 Environment Check during Load
25 ;
26 ; Check Version (2.0)
27 I $$VERSION^XPDUTL("LEX")'="2.0" D D ABRT Q
28 . D ET("Version 2.0 not found. Please install Lexicon Utility v 2.0")
29 ;
30 ; Check Required Patches
31 D:'$L($G(LEXREQP)) IMP I $L(LEXREQP) D
32 . N LEXPAT,LEXI,LEXPN
33 . F LEXI=1:1 Q:'$L($P(LEXREQP,";",LEXI)) S LEXPAT=$P(LEXREQP,";",LEXI) D
34 . . S LEXPN=$$PATCH^XPDUTL(LEXPAT) W !," Checking for ",LEXPAT I +LEXPN>0 H 1 W " - installed"
35 . . I +LEXPN'>0 D ET((LEXPAT_" not found, please install "_LEXPAT_" before continuing"))
36 I $D(LEXE) D ABRT Q
37 S LEXG=$$RGBL
38 I $D(LEXE)&(+LEXG=0) D ABRT Q
39 I $D(LEXE)&(+LEXG<0) D ABRT Q
40 I '$D(LEXFULL)&(+($G(XPDENV))'=1) D QUIT Q
41 ;
42 ; Install Package(s)
43 ;
44 ; XPDENV = 1 Environment Check during Install
45 ;
46 ; Check Data "is installed" or "is translated"
47 N LEXIT S LEXIT=+($$CPD) I '$D(LEXFULL)&(LEXIT) D QUIT Q
48 ; Checking Global "Write" Protection
49 D:+($G(XPDENV))=1 GBLS I $D(LEXE) D ABRT Q
50 ; Check Import Global Checksum
51 D:+($G(XPDENV))=1 CS I $D(LEXE) D ABRT Q
52 ;
53 ; Quit, Exit or Abort
54 ;
55QUIT ; Quit Passed Environment Check
56 K LEXFULL D OK
57 Q
58EXIT ; Exit Failed Environment Check
59 D:$D(LEXE) ED S XPDQUIT=2 K LEXE,LEXFULL Q
60ABRT ; Abort Failed Environment Check, KILL the distribution
61 D:$D(LEXE) ED S XPDABORT=1,XPDQUIT=1,XPDQUIT("LEX*2.0*43")=1 K LEXE,LEXFULL
62 Q
63 ;
64 ; Checks
65 ;
66GBLS ; Check Write access on globals
67 N LEXE,LEXGBL,LEXRT,LEXT,LEXF,LEXI,LEXX,LEXOK,LEXCPD,LEXS,X S LEXOK=1
68 D BM(" I will now check the protection on ^LEX, ^ICPT, ^ICD and ^DIC Globals.")
69 D M(" If you get an ERROR, you will need to change the protection on these")
70 D M(" globals to allow read/write as indicated:")
71 D BM(" Owner Group World Network")
72 D M(" Cache systems RWD RW RW RWD")
73 D BM(" Checking:"),M(" ")
74 S LEXCPD=$$CPD,LEXS="",X=1 F LEXI=1:1 D Q:'$L(LEXX)
75 . S LEXX="" S LEXE="S LEXX=$T(GD+"_LEXI_")" X LEXE S LEXX=$$TRIM(LEXX) Q:'$L(LEXX) Q:'$L($TR(LEXX,";",""))
76 . S LEXGBL=$P(LEXX,";",3) Q:+LEXCPD>0&(LEXGBL="^LEXM(0)") S LEXRT=$P(LEXX,";",4),LEXT=$P(LEXX,";",5),LEXF=$P(LEXX,";",6)
77 . S (LEXB1,LEXB2)="",$P(LEXB1," ",(19-$L(LEXRT)))="",$P(LEXB2," ",(28-$L(LEXT)))=""
78 . I '$D(@LEXGBL) D RGNF S LEXOK=0 D M((" <"_LEXRT_" not found>")) Q
79 . D M((" "_LEXRT_LEXB1_LEXT_LEXB2_LEXF)) S @LEXGBL=$G(@LEXGBL) H 1
80 D:LEXOK M(" --> ok") D:'LEXOK M(" ??") D M(" ")
81 Q
82RGBL(X) ; Check Write access on globals
83 N LEXCPD,LEXS,LEXI,LEXX,LEXEC,LEXGBL,LEXRT,LEXT,LEXF,LEXB1,LEXB2
84 S LEXCPD=$$CPD,LEXS="",X=1 F LEXI=1:1 D Q:'$L(LEXX)
85 . S LEXX="" S LEXEC="S LEXX=$T(GD+"_LEXI_")" X LEXEC S LEXX=$$TRIM(LEXX) Q:'$L(LEXX) Q:'$L($TR(LEXX,";",""))
86 . S LEXGBL=$P(LEXX,";",3) Q:+LEXCPD>0&(LEXGBL="^LEXM(0)") S LEXRT=$P(LEXX,";",4),LEXT=$P(LEXX,";",5),LEXF=$P(LEXX,";",6)
87 . S (LEXB1,LEXB2)="",$P(LEXB1," ",(15-$L(LEXRT)))="",$P(LEXB2," ",(28-$L(LEXT)))=""
88 . I '$D(@LEXGBL) S:LEXS'[LEXRT LEXS=LEXS_", "_LEXRT S X=-1 S:LEXGBL["LEXM("&(X=1) X=0
89 I $L(LEXS),X'>0 D
90 . S:LEXS[", " LEXS=$P(LEXS,", ",1,($L(LEXS,", ")-1))_" and "_$P(LEXS,", ",$L(LEXS,", "))
91 . S:$E(LEXS,1,2)=", " LEXS=$E(LEXS,3,$L(LEXS)) S:$E(LEXS,1,7)[" and " LEXS=$P(LEXS," and ",2)
92 . D:X=-1 ET(("Global"_$S(LEXS[", "!(LEXS[" and "):"s",1:"")_" "_LEXS_" either not found or incomplete."))
93 . D:X=0 CM
94 Q X
95RGNF ; Required global not found
96 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
97 D:$G(LEXGL)["^LEX"&($G(LEXGL)'["^LEXM") ET(""),ET("Required global "_$P($G(LEXGL),"(",1)_" not found.")
98 D:$G(LEXGL)["^LEX"&($G(LEXGL)["^LEXM") CM
99 Q
100CHK ; Check the Checksum
101 D CS I $D(LEXE) D ED Q
102 D BM(" OK"),M(" ")
103 Q
104CS ; Checksum for import global
105 K LEXE
106 D BM(" Running checksum routine on the ^LEXM import global, please wait")
107 N LEXCHK,LEXNDS,LEXVER S LEXCHK=+($G(^LEXM(0,"CHECKSUM")))
108 S LEXNDS=+($G(^LEXM(0,"NODES"))),LEXVER=+($$VC(LEXCHK,LEXNDS))
109 D M(" ") D:LEXVER>0 M(" Checksum is ok"),M(" ")
110 D:LEXVER=0 CM D:LEXVER=-1 CW D:LEXVER=-2 CU D:LEXVER=-3 CF
111 Q
112VC(X,Y) ; Verify Checksum for import global
113 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF Q:'$D(^LEXM) 0
114 D IMP I $G(^LEXM(0,"BUILD"))'=$G(LEXBUILD) Q -1
115 N LEXCHK,LEXNDS,LEXCNT,LEXLC,LEXL,LEXS,LEXNC,LEXD,LEXN,LEXC,LEXGCS,LEXP,LEXT
116 S LEXCHK=+($G(X)),LEXNDS=+($G(Y))
117 Q:LEXCHK'>0!(LEXNDS'>0) -2
118 S LEXL=64,(LEXCNT,LEXLC)=0,LEXS=(+(LEXNDS\LEXL))
119 S:LEXS=0 LEXS=1 D:+($O(^LEXM(0)))>0 M("")
120 S (LEXC,LEXN)="^LEXM",(LEXNC,LEXGCS)=0 W " "
121 F S LEXN=$Q(@LEXN) Q:LEXN=""!(LEXN'[LEXC) D
122 . Q:LEXN="^LEXM(0,""CHECKSUM"")"
123 . Q:LEXN="^LEXM(0,""NODES"")"
124 . S LEXCNT=LEXCNT+1
125 . I LEXCNT'<LEXS S LEXLC=LEXLC+1 W:LEXLC'>LEXL "." S LEXCNT=0
126 . S LEXNC=LEXNC+1,LEXD=@LEXN,LEXT=LEXN_"="_LEXD
127 . F LEXP=1:1:$L(LEXT) S LEXGCS=$A(LEXT,LEXP)*LEXP+LEXGCS
128 Q:LEXNC'=LEXNDS -3
129 Q:LEXGCS'=LEXCHK -3
130 Q 1
131SY(X) ; Check System variables
132 Q:'$D(IO)!('$D(IOF))!('$D(IOM))!('$D(ION))!('$D(IOSL))!('$D(IOST)) 0
133 Q 1
134UR(X) ; Check User variables
135 Q:'$L($G(DUZ(0))) 0
136 Q:+($G(DUZ))=0!($$NOTDEF(+$G(DUZ))) 0
137 Q 1
138CPD(X) ; Check Current Patched Data is installed
139 Q 0
140 ;
141 ; Error messages
142 ;
143CM ; Missing ^LEXM
144 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP D ET(""),ET("Missing import global ^LEXM.") D CO
145 Q
146CW ; Wrong ^LEXM
147 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF,LEXB D IMP S LEXB=$G(^LEXM(0,"BUILD")) D ET("")
148 I $L(LEXBUILD),$L(LEXB),LEXBUILD'=LEXB D Q
149 . D ET(("Incorrect import global ^LEXM found ("_LEXB_" global).")) D CKO
150 D ET("Incorrect import global ^LEXM found.") D CKO
151 Q
152CU ; Unable to verify
153 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP D ET(""),ET("Unable to verify checksum for import global ^LEXM (possibly corrupt).") D CKO
154 Q
155CF ; Failed checksum
156 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP D ET("") D ET("Import global ^LEXM failed checksum.") D CKO
157 Q
158CO ; Obtain new global
159 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
160 D ET(""),ET(" Please obtain a copy of the import global ^LEXM contained in the ")
161 D ET((" global host file "_LEXIGHF_" before continuing with the "_LEXBUILD))
162 D ET((" installation."))
163 Q
164CKO ; Kill and Obtain new global
165 N LEXLREV,LEXREQP,LEXBUILD,LEXIGHF D IMP
166 D ET(""),ET(" Please KILL the existing import global ^LEXM from your system")
167 D ET((" and obtain a new copy of ^LEXM contained in the global host file"))
168 D ET((" "_LEXIGHF_" before continuing with the "_LEXBUILD_" installation."))
169 Q
170ET(X) ; Error Text
171 N LEXI S LEXI=+($G(LEXE(0))),LEXI=LEXI+1,LEXE(LEXI)=" "_$G(X),LEXE(0)=LEXI
172 Q
173ED ; Error Display
174 N LEXI S LEXI=0 F S LEXI=$O(LEXE(LEXI)) Q:+LEXI=0 D M(LEXE(LEXI))
175 D M(" ") K LEXE Q
176 ;
177 ; Miscellaneous
178 ;
179IMP ; Import names
180 S LEXLREV=43,LEXIGHF="LEX_2_43.GBL",LEXREQP="LEX*2.0*44;ICPT*6.0*19",LEXBUILD="LEX*2.0*43"
181 Q
182NOTDEF(IEN) ; Check to see if user is defined
183 N DA,DR,DIQ,LEX,DIC S DA=IEN,DR=.01,DIC=200,DIQ="LEX" D EN^DIQ1 Q '$D(LEX)
184OK ; Environment is OK
185 N LEXBUILD,LEXIGHF,LEXREQP,LEXLREV,LEXT
186 D IMP S LEXT=" Environment "_$S($L(LEXBUILD):("for patch/build "_LEXBUILD_" "),1:"")_"is ok"
187 D BM(LEXT),M(" ")
188 Q
189BM(X) ; Blank Line with Message
190 D BMES^XPDUTL($G(X)) Q
191M(X) ; Message
192 D MES^XPDUTL($G(X)) Q
193TRIM(X) ; Trim Spaces
194 S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
195 F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
196 Q X
197 ; Exported Files
198 ;;^LEX(757.01);^LEX(*;Lexicon;757-757.41
199 ;;^LEXT(757.2);^LEXT(757.2);Lexicon Subsets/Defaults;757.2
200 ;;^LEXC(757.9);^LEXC(*;Lexicon Change File;757.9-757.91
201 ;;^LEXM(0);^LEXM(*;Lexicon Export/Import;No File #
202 ;;^ICPT(0);^ICPT(;CPT/HCPCS;81
203 ;;^DIC(81.1,0);^DIC(81.1);CPT Category;81.1
204 ;;^DIC(81.2,0);^DIC(81.2);CPT Copyright;81.2
205 ;;^DIC(81.3,0);^DIC(81.3);CPT Modifier;81.3
206 ;;^ICD9(0);^ICD9(;ICD Diagnosis;80
207 ;;^ICD0(0);^ICD0(;ICD Operation/Procedure;80.1
208 ;;^ICD(0);^ICD(;DRG Grouper;80.2
209 ;;^ICM(0);^ICM(;MAJOR DIAGNOSTIC CATEGORY;80.3
210 ;;^ICD9(0);^ICD9(;ICD Diagnosis;80
211 ;;^ICPT(0);^ICPT(;CPT/HCPCS;81
212 ;;^DIC(81.3,0);^DIC(81.3);CPT Modifier;81.3
213 Q
214GD ; Global Data
215 ;;^LEX(757.01);^LEX(*;Lexicon;757-757.41
216 ;;^DIC(81.3,0);^DIC(81.3);CPT Modifier;81.3
Note: See TracBrowser for help on using the repository browser.