source: WorldVistAEHR/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEX2042.m@ 635

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

initial load of WorldVistAEHR

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