source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEX2054.m@ 1674

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

initial load of FOIAVistA 6/30/08 version

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