source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEX2046.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

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