| 1 | LEX2052 ;ISL/KER - LEX*2.0*52 Environment Check ;08/18/2007
 | 
|---|
| 2 |  ;;2.0;LEXICON UTILITY;**52**;Sep 23, 1996;Build 25
 | 
|---|
| 3 |  ;            
 | 
|---|
| 4 |  ; Global Variables
 | 
|---|
| 5 |  ;    None
 | 
|---|
| 6 |  ;            
 | 
|---|
| 7 |  ; External References
 | 
|---|
| 8 |  ;    EN^DIQ1          DBIA  10015
 | 
|---|
| 9 |  ;    $$PATCH^XPDUTL   DBIA  10141
 | 
|---|
| 10 |  ;    $$VERSION^XPDUTL DBIA  10141
 | 
|---|
| 11 |  ;    BMES^XPDUTL      DBIA  10141
 | 
|---|
| 12 |  ;    MES^XPDUTL       DBIA  10141
 | 
|---|
| 13 |  ;            
 | 
|---|
| 14 |  ; Variables NEWed or KILLed elsewhere
 | 
|---|
| 15 |  ;    XPDABORT         Kernel Systems Manual pg 454
 | 
|---|
| 16 |  ;    XPDQUIT          Kernel Systems Manual pg 454
 | 
|---|
| 17 |  ;            
 | 
|---|
| 18 |  ; Special Variables
 | 
|---|
| 19 |  ;    XPDDIQ("XPZ1")   Kernel Systems Manual pg 456
 | 
|---|
| 20 |  ;    XPDDIQ("XPI1")   FORUM Message #45828644
 | 
|---|
| 21 |  ;            
 | 
|---|
| 22 | ENV ; LEX*2.0*52 Environment Check
 | 
|---|
| 23 |  ;                    
 | 
|---|
| 24 |  ;   General
 | 
|---|
| 25 |  ;
 | 
|---|
| 26 |  N LEXPTYPE,LEXLREV,LEXREQP,LEXBLDS,LEXBUILD,LEXIGHF,LEXFY,LEXQTR,LEXG,LEXE,LEXSTR D IMP
 | 
|---|
| 27 |  K XPDDIQ("XPZ1","B"),XPDDIQ("XPI1","B") S XPDDIQ("XPZ1","B")="NO",XPDDIQ("XPI1","B")="NO"
 | 
|---|
| 28 |  S LEXSTR=$G(LEXPTYPE) S:$L($G(LEXFY))&($L($G(LEXQTR))) LEXSTR=LEXSTR_" for "_$G(LEXFY)_" "_$G(LEXQTR)_" Quarter"
 | 
|---|
| 29 |  D BM(LEXSTR),M("")
 | 
|---|
| 30 |  S U="^"
 | 
|---|
| 31 |  ;     No user
 | 
|---|
| 32 |  D:+($$UR)'>0 ET("User not defined (DUZ)")
 | 
|---|
| 33 |  ;     No IO
 | 
|---|
| 34 |  D:+($$SY)'>0 ET("Undefined IO variable(s)")
 | 
|---|
| 35 |  I $D(LEXE) D ABRT Q
 | 
|---|
| 36 |  ;                    
 | 
|---|
| 37 |  ;   Load Distribution
 | 
|---|
| 38 |  ;
 | 
|---|
| 39 |  ;     XPDENV = 0 Environment Check during Load
 | 
|---|
| 40 |  ;
 | 
|---|
| 41 |  ;       Check Version (2.0)
 | 
|---|
| 42 |  I $$VERSION^XPDUTL("LEX")'="2.0" D  D ABRT Q
 | 
|---|
| 43 |  . D ET("Version 2.0 not found.  Please install Lexicon Utility v 2.0")
 | 
|---|
| 44 |  ;
 | 
|---|
| 45 |  ;       Check Required Patches
 | 
|---|
| 46 |  D:'$L($G(LEXREQP)) IMP I $L(LEXREQP) D
 | 
|---|
| 47 |  . N LEXPAT,LEXI,LEXPN
 | 
|---|
| 48 |  . F LEXI=1:1 Q:'$L($P(LEXREQP,";",LEXI))  S LEXPAT=$P(LEXREQP,";",LEXI) D
 | 
|---|
| 49 |  . . S LEXPN=$$PATCH^XPDUTL(LEXPAT) W !,"   Checking for ",LEXPAT H 1 W:+LEXPN>0 ?31,"  installed" W:+LEXPN'>0 ?31,"  missing"
 | 
|---|
| 50 |  . . I +LEXPN'>0 D ET((LEXPAT_" not found, please install "_LEXPAT_" before continuing"))
 | 
|---|
| 51 |  I $D(LEXE) D ABRT Q
 | 
|---|
| 52 | QUIT ;     Quit   Passed Environment Check
 | 
|---|
| 53 |  K LEXFULL D OK
 | 
|---|
| 54 |  Q
 | 
|---|
| 55 | EXIT ;     Exit   Failed Environment Check
 | 
|---|
| 56 |  D:$D(LEXE) ED S XPDQUIT=2 K LEXE,LEXFULL Q
 | 
|---|
| 57 | ABRT ;     Abort  Failed Environment Check, KILL the distribution
 | 
|---|
| 58 |  D:$D(LEXE) ED S XPDABORT=1,XPDQUIT=1
 | 
|---|
| 59 |  S (XPDQUIT("LEX*2.0*52"),XPDQUIT("ICPT*6.0*37"))=1
 | 
|---|
| 60 |  K LEXE,LEXFULL
 | 
|---|
| 61 |  Q
 | 
|---|
| 62 |  ;               
 | 
|---|
| 63 |  ; Checks
 | 
|---|
| 64 |  ;
 | 
|---|
| 65 | SY(X) ;   Check System variables
 | 
|---|
| 66 |  Q:'$D(IO)!('$D(IOF))!('$D(IOM))!('$D(ION))!('$D(IOSL))!('$D(IOST)) 0
 | 
|---|
| 67 |  Q 1
 | 
|---|
| 68 | UR(X) ;   Check User variables
 | 
|---|
| 69 |  Q:'$L($G(DUZ(0))) 0
 | 
|---|
| 70 |  Q:+($G(DUZ))=0!($$NOTDEF(+$G(DUZ))) 0
 | 
|---|
| 71 |  Q 1
 | 
|---|
| 72 |  ;               
 | 
|---|
| 73 |  ; Error messages
 | 
|---|
| 74 |  ;
 | 
|---|
| 75 | ET(X) ;   Error Text
 | 
|---|
| 76 |  N LEXI S LEXI=+($G(LEXE(0))),LEXI=LEXI+1,LEXE(LEXI)="    "_$G(X),LEXE(0)=LEXI
 | 
|---|
| 77 |  Q
 | 
|---|
| 78 | ED ;   Error Display
 | 
|---|
| 79 |  N LEXI,LEXC S (LEXI,LEXC)=0 F  S LEXI=$O(LEXE(LEXI)) Q:+LEXI=0  S LEXC=LEXC+1 D:LEXC=1 M("  ") D M(LEXE(LEXI))
 | 
|---|
| 80 |  D M(" ") K LEXE Q
 | 
|---|
| 81 |  ;                   
 | 
|---|
| 82 |  ; Miscellaneous
 | 
|---|
| 83 |  ;
 | 
|---|
| 84 | NOTDEF(IEN) ;   Check to see if user is defined
 | 
|---|
| 85 |  N DA,DR,DIQ,LEX,DIC S DA=IEN,DR=.01,DIC=200,DIQ="LEX" D EN^DIQ1 Q '$D(LEX)
 | 
|---|
| 86 | OK ;   Environment is OK
 | 
|---|
| 87 |  N LEXPTYPE,LEXLREV,LEXREQP,LEXBLDS,LEXBUILD,LEXIGHF,LEXFY,LEXQTR,LEXT
 | 
|---|
| 88 |  D IMP S LEXT="  Environment "_$S($L(LEXBLDS):("for patch/build "_LEXBLDS_" "),1:"")_"is ok"
 | 
|---|
| 89 |  D BM(LEXT),M(" ")
 | 
|---|
| 90 |  Q
 | 
|---|
| 91 | BM(X) ;   Blank Line with Message
 | 
|---|
| 92 |  D BMES^XPDUTL($G(X)) Q
 | 
|---|
| 93 | M(X) ;   Message
 | 
|---|
| 94 |  D MES^XPDUTL($G(X)) Q
 | 
|---|
| 95 | TRIM(X) ;   Trim Spaces
 | 
|---|
| 96 |  S X=$G(X) F  Q:$E(X,1)'=" "  S X=$E(X,2,$L(X))
 | 
|---|
| 97 |  F  Q:$E(X,$L(X))'=" "  S X=$E(X,1,($L(X)-1))
 | 
|---|
| 98 |  Q X
 | 
|---|
| 99 | IMP ;   Import names
 | 
|---|
| 100 |  ;     Patch Type
 | 
|---|
| 101 |  S LEXPTYPE="Lexicon/CPT Remedy Ticket Fixes"
 | 
|---|
| 102 |  ;     Revision
 | 
|---|
| 103 |  S LEXLREV="52"
 | 
|---|
| 104 |  ;     Required Builds
 | 
|---|
| 105 |  S LEXREQP="LEX*2.0*50"
 | 
|---|
| 106 |  ;     This Build Name
 | 
|---|
| 107 |  S LEXBLDS="LEX*2.0*52/ICPT*6.0*37",LEXBUILD=$P(LEXBLDS,"/",1)
 | 
|---|
| 108 |  ;     This Build's Export Global Host Filename
 | 
|---|
| 109 |  S LEXIGHF=""
 | 
|---|
| 110 |  ;     Fiscal Year
 | 
|---|
| 111 |  S LEXFY=""
 | 
|---|
| 112 |  ;     Quarter
 | 
|---|
| 113 |  S LEXQTR=""
 | 
|---|
| 114 |  Q
 | 
|---|