Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMTSXPS1

GMTSXPS1.m

Go to the documentation of this file.
  1. GMTSXPS1 ; SLC/KER - Health Summary Status ; 08/27/2002
  1. ;;2.7;Health Summary;**35,34,46,56**;Oct 20, 1995
  1. ;
  1. ; External References
  1. ; DBIA 10086 HOME^%ZIS
  1. ; DBIA 10086 ^%ZIS
  1. ; DBIA 10089 ^%ZISC
  1. ; DBIA 10063 ^%ZTLOAD
  1. ; DBIA 10096 ^%ZOSF("UCI")
  1. ; DBIA 10096 ^%ZOSF("PROD")
  1. ; DBIA 10096 ^%ZOSF("TEST")
  1. ; DBIA 10060 ^VA(200,
  1. ; DBIA 2056 $$GET1^DIQ (file #4 and 200)
  1. ; DBIA 1131 ^XMB("NETNAME")
  1. ; DBIA 10091 ^XMB(1, file #4.3
  1. ; DBIA 10070 ^XMD
  1. ; DBIA 10103 $$NOW^XLFDT
  1. ; DBIA 10103 $$FMTE^XLFDT
  1. ;
  1. EN ; Display status only
  1. N POP,GMTSENV S GMTSENV=$$ENV Q:'GMTSENV
  1. K ^TMP($J,"GMTSINFO"),GMTSMAIL N X,Y,ZTSAVE D HDR
  1. D:'$D(GMTSHORT) FI,INS^GMTSXPS2 D OUTPUT Q
  1. SEND ; Send status to G.GMTS@ISC-SLC.DOMAIN.EXT
  1. N POP,GMTSENV S GMTSENV=$$ENV2 Q:'GMTSENV
  1. S GMTSIENS=$G(GMTSIENS) S:$L(GMTSIENS) GMTSIENS=";"_GMTSIENS_";"
  1. S GMTSENV=$$ROK("XMD") Q:'GMTSENV K ^TMP($J,"GMTSINFO") N X,Y,ZTSAVE,ZTQUEUED,ZTREQ,ZTRTN
  1. S:$D(GMTSHORT) ZTSAVE("GMTSHORT")="" S:$L($G(GMTSBLD)) ZTSAVE("GMTSBLD")="" S:$D(GMTSINST) ZTSAVE("GMTSINST")="" S:$L($G(GMTSIENS)) ZTSAVE("GMTSIENS")=""
  1. S ZTRTN="SENDTO^GMTSXPS1",ZTDESC="Health Summary Status Report Msg",ZTIO="",ZTDTH=$H D ^%ZTLOAD,HOME^%ZIS K Y,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN Q
  1. SENDTO ; Send (Tasked)
  1. N GMTSMAIL S GMTSMAIL="" S:$D(ZTQUEUED) ZTREQ="@"
  1. N X,Y D HDR D:'$D(GMTSHORT) FI,INS^GMTSXPS2 D OUTPUT Q
  1. ;
  1. HDR ; Report Header
  1. N X D TITLE,ASOF D:$D(GMTSINST) MTBY D INAC,BLD D BL
  1. Q
  1. TITLE ; As of date
  1. N X S X=$S($D(GMTSINST)&('$L($G(GMTSBLD))):"Health Summary Installation",$D(GMTSINST)&($L($G(GMTSBLD))):($G(GMTSBLD)_" Installation"),1:"Health Summary Status") D TT(X),BL Q
  1. ASOF ; As of date
  1. N X S X=$$NOW S:$L(X) X=$$TB($S($D(GMTSINST):" Installed on:",1:" As of:"))_X D:$L(X) TL(X) Q
  1. INAC ; In Account
  1. N X S X=$$UCI($$U) S:$L(X) X=$$TB(" Install Account:")_X D:$L(X) TL(X) Q
  1. MTBY ; Maintained by
  1. N X,Y S X=$$P,Y=$P(X,"^",2),X=$P(X,"^",1) S:$L(X) X=$$TB($S($D(GMTSINST):" Installed by:",1:" Maintained by:"))_X S:$L(X)&($L(Y)) X=X_" "_Y D:$L(X) TL(X) Q
  1. BLD ; Install Build
  1. Q:$D(GMTSINST)&($L($G(GMTSBLD))) N X S X=$G(GMTSBLD) Q:'$L(X) S:$L(X) X=$$TB(" Build:")_X D:$L(X) TL(X) Q
  1. ;
  1. FI ; Health Summary Files
  1. Q:$D(GMTSHORT)
  1. N X S X="",X=X_$J("",37-$L(X))_" Total",X=X_$J("",48-$L(X))_"Last" D TL(X)
  1. S X=" File",X=X_$J("",37-$L(X))_"Entries",X=X_$J("",48-$L(X))_"Entry" D TL(X)
  1. S X="",$P(X,"-",51)="-",X=" "_X D TL(X)
  1. D F142,F1421,F14299,BL
  1. Q
  1. F142 ; Health Summary Type file 142
  1. N X,GMTSA,GMTSAT,GMTSAP,GMTSL,GMTST,GMTSI S X=" Health Summary Type",(GMTSL,GMTST,GMTSI)=0
  1. F S GMTSI=$O(^GMT(142,GMTSI)) Q:+GMTSI=0 S GMTSL=GMTSI,GMTST=GMTST+1
  1. S X=X_$J("",32-$L(X))_$J(GMTST,10),X=X_$J("",42-$L(X))_$J(GMTSL,10) D TL(X)
  1. S GMTSA=$O(^GMT(142,"B","GMTS HS ADHOC OPTION",0))
  1. S X=" Ad Hoc Health Summary Type",(GMTSL,GMTST,GMTSI)=0
  1. I GMTSA=0 S X=X_$J("",37-$L(X))_"Missing Ad Hoc Health Summary Type" D TL(X) Q
  1. F S GMTSI=$O(^GMT(142,GMTSA,1,GMTSI)) Q:+GMTSI=0 S GMTSL=GMTSI,GMTST=GMTST+1
  1. S X=X_$J("",32-$L(X))_$J(GMTST,10),X=X_$J("",42-$L(X))_$J(GMTSL,10) S:GMTSA'=12 X=X_$J("",57-$L(X))_"Invalid IEN" D TL(X)
  1. Q
  1. F1421 ; Health Summary Component file 142.1
  1. N X,GMTSA,GMTSAC,GMTSAT,GMTSAP,GMTSL,GMTST,GMTSE,GMTSI
  1. S X=" Health Summary Component",(GMTSAT,GMTSAP,GMTSAC,GMTSL,GMTST,GMTSI,GMTSE)=0
  1. F S GMTSI=$O(^GMT(142.1,GMTSI)) Q:+GMTSI=0 D
  1. . S GMTSL=GMTSI,GMTST=GMTST+1 S:GMTSI<501 GMTSE=GMTSE+1
  1. . S GMTSA=$P($G(^GMT(142.1,GMTSI,0)),"^",6) S:GMTSA="T" GMTSAT=+($G(GMTSAT))+1 S:GMTSA="P" GMTSAP=+($G(GMTSAP))+1 S:GMTSA="" GMTSAC=+($G(GMTSAC))+1
  1. S X=X_$J("",32-$L(X))_$J(GMTST,10),X=X_$J("",42-$L(X))_$J(GMTSL,10) D TL(X)
  1. I +($G(GMTSE))>0 S X=" Exported",X=X_$J("",32-$L(X))_$J(GMTSE,10) D TL(X)
  1. I +($G(GMTSAT))>0 S X=" Temporarily Disabled",X=X_$J("",32-$L(X))_$J(GMTSAT,10) D TL(X)
  1. I +($G(GMTSAP))>0 S X=" Permanently Disabled",X=X_$J("",32-$L(X))_$J(GMTSAP,10) D TL(X)
  1. I +($G(GMTSAC))>0&(+($G(GMTSAC))'=+($G(GMTST))) S X=" Active Components",X=X_$J("",32-$L(X))_$J(GMTSAC,10) D TL(X)
  1. D STA^GMTSXPS3
  1. Q
  1. F14299 ; Health Summary Parameter file 142.9
  1. N X,GMTSA,GMTSL,GMTST,GMTSI S X=" Health Summary Parameters",(GMTSL,GMTST,GMTSI)=0
  1. F S GMTSI=$O(^GMT(142.99,GMTSI)) Q:+GMTSI=0 S GMTSL=GMTSI,GMTST=GMTST+1
  1. S X=X_$J("",32-$L(X))_$J(GMTST,10),X=X_$J("",42-$L(X))_$J(GMTSL,10) D TL(X)
  1. Q
  1. ;
  1. ; Retrieve Data
  1. U(X) ; UCI where Health Summary is installed
  1. N GMTSU,GMTSP,GMTST S GMTST=$G(X) X ^%ZOSF("UCI") S GMTSU=Y
  1. S:Y=^%ZOSF("PROD") GMTSP=" (Production)" S:Y'=^%ZOSF("PROD") GMTSP=" (Test)" S:GMTSU["DEM" GMTSP=" (Demo)"
  1. S X="",$P(X,"^",1)=GMTSU,$P(X,"^",2)=GMTSP Q X
  1. UCI(X) ; UCI Format
  1. S X=$G(X) N GMTSA,GMTST S GMTSA=$P(X,"^",1),GMTST=$P(X,"^",2) S:$L(GMTST) GMTST=$$MX($$TRIM($$PA(GMTST)))
  1. S:$L($P(GMTSA,",",1))=3&($L($P(GMTSA,",",2))=3) GMTSA="["_GMTSA_"]" S:$L(GMTSA)&($L(GMTST)) GMTST="("_GMTST_")"
  1. S X="" S:$L(GMTSA) X=GMTSA S:$L(X)&($L(GMTST)) X=X_" "_GMTST S:'$L(X)&($L(GMTST)) X=GMTST
  1. Q X
  1. P(X) ; Person
  1. S X=+($G(DUZ)) Q:'$L($P($G(^VA(200,+($G(X)),0)),"^",1)) "UNKNOWN^"
  1. N GMTSDUZ,GMTSPH S GMTSDUZ=+($G(DUZ))
  1. S GMTSPH=$P($G(^VA(200,GMTSDUZ,.13)),"^",2) S:GMTSPH="" GMTSPH=$P($G(^VA(200,GMTSDUZ,.13)),"^",1) S:GMTSPH="" GMTSPH=$P($G(^VA(200,GMTSDUZ,.13)),"^",3) S:GMTSPH="" GMTSPH=$P($G(^VA(200,GMTSDUZ,.13)),"^",4)
  1. S GMTSDUZ=$P(^VA(200,GMTSDUZ,0),"^",1),X=GMTSDUZ_"^"_GMTSPH Q X
  1. INST(X) ; Institution
  1. S X=$G(^XMB("NETNAME")) I $L(X) S:X[".DOMAIN.EXT" X=$P(X,".DOMAIN.EXT",1) S:X["." X=$P(X,".",$L(X,".")) Q X
  1. S X=$P($G(^XMB(1,1,"XUS")),"^",17) I +X>0 S X=$$GET1^DIQ(4,+X,.01,"E") Q:$L(X) X
  1. S X="" Q X
  1. ;
  1. OUTPUT ; Show global array (display or mail)
  1. D:$D(GMTSMAIL) MAIL,CLR D:'$D(GMTSMAIL) DSP,CLR Q
  1. DISPLAY ; Display global array
  1. N GMTSI S GMTSI=0 F S GMTSI=$O(^TMP($J,"GMTSINFO",GMTSI)) Q:+GMTSI=0 D
  1. . W !,^TMP($J,"GMTSINFO",GMTSI)
  1. Q
  1. MAIL ; Mail global array in message
  1. N DIFROM S U="^",XMSUB="Health Summary Info"
  1. S:$D(GMTSINST)&($L($G(GMTSBLD))) XMSUB="Health Summary "_GMTSBLD_" Install"
  1. S XMY("G.GMTS@ISC-SLC.DOMAIN.EXT")=""
  1. S XMTEXT="^TMP($J,""GMTSINFO"",",XMDUZ=.5 D ^XMD
  1. K ^TMP($J,"GMTSINFO"),%Z,XCNP,XMSCR,XMDUZ,XMY("G.GMTS@ISC-SLC.DOMAIN.EXT"),XMZ,XMSUB,XMY,XMTEXT,XMDUZ Q
  1. Q
  1. ;
  1. ; Temporary Global
  1. BL ; Blank Line
  1. N GMTSNX S GMTSNX=+($$NX),^TMP($J,"GMTSINFO",GMTSNX)="" Q
  1. TT(X) ; Title Line
  1. Q:'$L($G(X)) D TL(X) N GMTSBK S GMTSBK="===============================================================================",GMTSBK=$E(GMTSBK,1,$L($G(X))) D:$L(GMTSBK) TL(GMTSBK) Q
  1. TL(X) ; Text Line
  1. N GMTSNX S GMTSNX=+($$NX),^TMP($J,"GMTSINFO",GMTSNX)=$G(X) Q
  1. BK1 ; Break Line
  1. N GMTSNX S GMTSNX=+($$NX),^TMP($J,"GMTSINFO",GMTSNX)="-------------------------------------------------------------------------------" Q
  1. NX(X) ; Next Line #
  1. S (X,^TMP($J,"GMTSINFO",0))=+($G(^TMP($J,"GMTSINFO",0)))+1 Q X
  1. ST ; Show ^TMP($J,"GMTSINFO")
  1. N GMTSNN,GMTSNC S GMTSNN="^TMP("_$J_",""GMTSINFO"")",GMTSNC="^TMP("_$J_",""GMTSINFO"","
  1. F S GMTSNN=$Q(@GMTSNN) Q:GMTSNN=""!(GMTSNN'[GMTSNC) W:GMTSNN'[",0)" !,@GMTSNN
  1. Q
  1. ;
  1. DSP ; Display ^TMP($J,"GMTSINFO")
  1. D DEV Q
  1. DEV ; Select a device
  1. N %,%ZIS,IOP,ZTRTN,ZTSAVE,ZTDESC,ZTDTH,ZTIO,ZTSK
  1. S ZTRTN="DSPI^GMTSXPS1",ZTDESC="printing Health Summary install information"
  1. S ZTIO=ION,ZTDTH=$H,%ZIS="PQ",ZTSAVE("^TMP($J,""GMTSINFO"",")=""
  1. D ^%ZIS Q:POP S ZTIO=ION I $D(IO("Q")) D QUE,^%ZISC Q
  1. D NOQUE Q
  1. NOQUE ; Do not que task
  1. W @IOF W:IOST["P-" !,"< Not queued, printing Health Summary Info >",! H 2 U:IOST["P-" IO D @ZTRTN,^%ZISC Q
  1. QUE ; Task queued to print user defaults
  1. K IO("Q") D ^%ZTLOAD W !,$S($D(ZTSK):"Request Queued",1:"Request Cancelled"),! H 2 Q
  1. Q
  1. DSPI ; Display installation information
  1. I '$D(ZTQUEUED),$G(IOST)'["P-" I '$D(^TMP($J,"GMTSINFO")) W !,"Health Summary Installation not found"
  1. I IOST["P-" U IO
  1. G:'$D(^TMP($J,"GMTSINFO")) DSPQ
  1. N GMTSCONT,GMTSI,GMTSLC,GMTSEOP S GMTSCONT="",(GMTSLC,GMTSI)=0,GMTSEOP=+($G(IOSL)) S:GMTSEOP=0 GMTSEOP=24
  1. F S GMTSI=$O(^TMP($J,"GMTSINFO",GMTSI)) Q:+GMTSI=0!(GMTSCONT["^") D
  1. . W !,^TMP($J,"GMTSINFO",GMTSI) D LF Q:GMTSCONT["^"
  1. S:$D(ZTQUEUED) ZTREQ="@"
  1. W:$G(IOST)["P-" @IOF
  1. DSPQ ; Quit Display
  1. Q
  1. LF ; Line Feed
  1. S GMTSLC=GMTSLC+1 D:IOST["P-"&(GMTSLC>(GMTSEOP-7)) CONT D:IOST'["P-"&(GMTSLC>(GMTSEOP-4)) CONT
  1. Q
  1. CONT ; Page/Form Feed
  1. S GMTSLC=0 W:IOST["P-" @IOF Q:IOST["P-" W !!,"Press <Return> to continue " R GMTSCONT:300 S:'$T GMTSCONT="^" S:GMTSCONT'["^" GMTSCONT=""
  1. Q
  1. ;
  1. ; Miscellaneous
  1. TB(X) ; Tab
  1. S X=X F Q:$L(X)>19 S X=X_" "
  1. Q X
  1. PA(X) ; Remove Parenthesis
  1. Q $TR(X,"()","")
  1. LO(X) ; Lowercase
  1. Q $TR(X,"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
  1. UP(X) ; Uppercase
  1. Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
  1. MX(X) ; Mixed Case
  1. Q $TR($E(X,1),"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")_$TR($E(X,2,$L(X)),"ABCDEFGHIJKLMNOPQRSTUVWXYZ","abcdefghijklmnopqrstuvwxyz")
  1. TRIM(X) ; Trim Space Characters
  1. S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
  1. F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
  1. Q X
  1. CLR ; Clean up
  1. K ^TMP($J,"GMTSINFO") Q
  1. NOW(X) ; Today's Date
  1. S X=$$EDT($$NOW^XLFDT) Q X
  1. EDT(X) ; External Date Foramt
  1. S X=+($G(X)) Q:X=0 "" S X=$$FMTE^XLFDT(+X,"5Z") S:X["@" X=$P(X,"@",1)_" "_$P(X,"@",2) Q X
  1. ROK(X) ; Routine OK (in UCI) (NDBI)
  1. S X=$G(X) Q:'$L(X) 0 Q:$L(X)>8 0 X ^%ZOSF("TEST") Q:$T 1 Q 0
  1. ENV(X) ; Environment check
  1. D HOME^%ZIS I '$D(^VA(200,+($G(DUZ)),0)) W !!," User (DUZ) not defined",! Q 0
  1. Q 1
  1. ENV2(X) ; Environment check
  1. D HOME^%ZIS I '$D(^VA(200,+($G(DUZ)),0)) Q 0
  1. Q 1