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

HLOUSR.m

Go to the documentation of this file.
HLOUSR ;ALB/CJM -ListManager Screen for viewing system status;12 JUN 1997 10:00 am
 ;;1.6;HEALTH LEVEL SEVEN;**126,130**;Oct 13, 1995;Build 10
 ;
EN ;
 ;
 N HLSCREEN,TESTOPEN,HLRFRSH
 D WAIT^DICD
 D EN^VALM("HLO SYSTEM MONITOR")
 Q
 ;
BRIEF ;Init variables and list array
 N COUNT,LINK,QUE,FROM,TIME,STATUS,TEMP,DIR,TODAY,LIST
 S HLRFRSH="BRIEF^HLOUSR"
 S (HLSCREEN,VALMSG)="Brief System Status"
 S VALMCNT=8
 ;K @VALMAR
 D CLEAN^VALM10
 S VALMBG=1
 S VALMBCK="R"
 K VALMDDF("COL 2"),VALMDDF("COL 3"),VALMDDF("COL 4"),VALMDDF("COL 5")
 D CHGCAP^VALM("COL 1","Brief Operational Overview")
 S @VALMAR@(1,0)="SYSTEM STATUS:             "_$S($$CHKSTOP^HLOPROC:"STOPPED",1:"RUNNING")
 S @VALMAR@(2,0)="PROCESS MANAGER:           "_$S($$RUNNING:"RUNNING",1:"STOPPED")
 ;
 S TIME=$P($G(TESTOPEN("LISTENER")),"^",2)
 I TIME,$$FMDIFF^XLFDT($$NOW^XLFDT,TIME,2)<300 D
 .S STATUS=+TESTOPEN("LISTENER")
 E  D
 .S STATUS=0
 .S LINK=$P($G(^HLD(779.1,1,0)),"^",10)
 .I LINK S LINK=$P($G(^HLCS(870,LINK,0)),"^") Q:'$L(LINK)  S STATUS=$$IFOPEN^HLOUSR1(LINK)
 .S TESTOPEN("LISTENER")=STATUS_"^"_$$NOW^XLFDT
 ;
 S @VALMAR@(3,0)="STANDARD LISTENER:         "_$S(STATUS:"OPERATIONAL",1:"NOT OPERATIONAL")
 ;
 S TIME=$P($G(TESTOPEN("IE")),"^",2)
 I TIME,$$FMDIFF^XLFDT($$NOW^XLFDT,TIME,2)<300 D
 .S STATUS=+TESTOPEN("IE")
 E  D
 .S STATUS=$$IFOPEN^HLOUSR1("VA-VIE")
 .S TESTOPEN("IE")=STATUS_"^"_$$NOW^XLFDT
 S @VALMAR@(4,0)="INTERFACE ENGINE:          "_$S(STATUS:"OPERATIONAL",1:"NOT OPERATIONAL")
 S @VALMAR@(5,0)="TASKMAN:                   "_$S($$TM^%ZTLOAD:"RUNNING",1:"NOT RUNNING")
 ;
 S (LIST,LINK)=""
 F  S LINK=$O(^HLTMP("FAILING LINKS",LINK)) Q:LINK=""  D  I $L(LIST)>60 S LIST=LIST_",..." Q
 .N TIME,QUE,LINKARY
 .I $$GETLINK^HLOTLNK($P(LINK,":"),.LINKARY)
 .S TIME=$G(^HLTMP("FAILING LINKS",LINK)) Q:TIME=""
 .I '$G(LINKARY("SHUTDOWN")),TIME="" Q
 .I '$G(LINKARY("SHUTDOWN")),($$HDIFF^XLFDT($H,TIME,2)<300) Q
 .S LIST=LIST_$S($L(LIST):", ",1:"")_$P(LINK,":")
 S @VALMAR@(6,0)="DOWN LINKS: "_LIST
 S @VALMAR@(7,0)="CLIENT LINK PROCESSES:     "_+$G(^HLC("HL7 PROCESS COUNTS","RUNNING","OUTGOING CLIENT LINK"))
 S @VALMAR@(8,0)="IN-FILER PROCESSES:        "_+$G(^HLC("HL7 PROCESS COUNTS","RUNNING","INCOMING QUEUES"))
 S COUNT=0,LINK=""
 F  S LINK=$O(^HLC("QUEUECOUNT","OUT",LINK)) Q:LINK=""  S QUE=""  F  S QUE=$O(^(LINK,QUE)) Q:QUE=""  S COUNT=COUNT+$G(^(QUE))
 S @VALMAR@(9,0)="MESSAGES PENDING TRANSMISSION:      "_+COUNT
 S TEMP="STOPPED OUTGOING QUEUES: "
 S COUNT=0,QUE=""
 F  S QUE=$O(^HLTMP("STOPPED QUEUES","OUT",QUE)) Q:QUE=""  S COUNT=COUNT+1 Q:COUNT>4  S:COUNT=1 TEMP=TEMP_QUE S:"23"[COUNT TEMP=TEMP_"; "_QUE S:COUNT=4 TEMP=TEMP_" ..."
 S @VALMAR@(10,0)=TEMP
 S COUNT=0,QUE=""
 F  S QUE=$O(^HLC("QUEUECOUNT","IN",QUE)) Q:QUE=""  S FROM=""  F  S FROM=$O(^(QUE,FROM)) Q:FROM=""  S COUNT=COUNT+$G(^(FROM))
 S @VALMAR@(11,0)="MESSAGES PENDING ON APPLICATIONS:   "_+COUNT
 S TEMP="STOPPED INCOMING QUEUES: "
 S COUNT=0,QUE=""
 F  S QUE=$O(^HLTMP("STOPPED QUEUES","IN",QUE)) Q:QUE=""  S COUNT=COUNT+1 Q:COUNT>4  S:COUNT=1 TEMP=TEMP_QUE S:"23"[COUNT TEMP=TEMP_"; "_QUE S:COUNT=4 TEMP=TEMP_" ..."
 S @VALMAR@(12,0)=TEMP
 S @VALMAR@(13,0)="FILE 777 RECORD COUNT:         "_$$RJ($P($G(^HLTMP("FILE 777 RECORD COUNT")),"^"),10)_"     --> as of "_$$FMTE^XLFDT($P($G(^HLTMP("FILE 777 RECORD COUNT")),"^",2))
 S @VALMAR@(14,0)="FILE 778 RECORD COUNT:         "_$$RJ($P($G(^HLTMP("FILE 778 RECORD COUNT")),"^"),10)_"     --> as of "_$$FMTE^XLFDT($P($G(^HLTMP("FILE 778 RECORD COUNT")),"^",2))
 S TODAY=$$DT^XLFDT
 F DIR="IN","OUT" D
 .N RAP,SAP,TIME,TOTAL
 .S TOTAL=0
 .S TIME=TODAY-.0001
 .F  S TIME=$O(^HLSTATS(DIR,"HOURLY",TIME)) Q:'TIME  Q:((TIME\1)>TODAY)  D
 ..S SAP=""
 ..F  S SAP=$O(^HLSTATS(DIR,"HOURLY",TIME,SAP)) Q:SAP=""  D
 ...Q:SAP="ACCEPT ACK"
 ...S RAP=""
 ...F  S RAP=$O(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP)) Q:RAP=""  D
 ....S TYPE=""
 ....F  S TYPE=$O(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE)) Q:TYPE=""  D
 .....S TOTAL=TOTAL+$G(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE))
 .S:DIR="OUT" @VALMAR@(15,0)="MESSAGES SENT TODAY:           "_$$RJ(TOTAL,10)
 .S:DIR'="OUT" @VALMAR@(16,0)="MESSAGES RECEIVED TODAY:       "_$$RJ(TOTAL,10)
 Q
 ;
HELP ;Help code
 S X="?" D DISP^XQORM1 W !!
 Q
 ;
EXIT ;Exit code
 D CLEAN^VALM10
 D CLEAR^VALM1
 ;
 Q
 ;
EXPND ;Expand code
 Q
 ;
PROCS ;
 S HLRFRSH="PROCS^HLOUSR"
 ;K @VALMAR
 D CLEAN^VALM10
 S VALMCNT=0
 S VALMBCK="R"
 S VALMDDF("COL 2")="COL 2^35^10^MIN^H"
 S VALMDDF("COL 3")="COL 3^47^10^MAX^H"
 S VALMDDF("COL 4")="COL 4^59^10^#RUNNING^H"
 S VALMDDF("COL 5")="COL 5^71^10^#QUEUED^IOBON"
 D CHGCAP^VALM("COL 1","Process Type")
 N IEN
 S IEN=0
 F  S IEN=$O(^HLD(779.3,"C",1,IEN)) Q:'IEN  D
 .N PROC
 .Q:'$$GETPROC^HLOPROC1(IEN,.PROC)
 .Q:PROC("NAME")="VMS TCP LISTENER"
 .S VALMCNT=VALMCNT+1
 .S @VALMAR@(VALMCNT,0)=$$LJ(PROC("NAME"),30)_$$RJ(PROC("MINIMUM"),6)_$$RJ(PROC("MAXIMUM"),12)_$$RJ(+$G(^HLC("HL7 PROCESS COUNTS","RUNNING",PROC("NAME"))),14)_$$RJ(+$G(^HLC("HL7 PROCESS COUNTS","QUEUED",PROC("NAME"))),12)
 S VALMCNT=VALMCNT+1,@VALMAR@(VALMCNT,0)=""
 S IEN=""
 F  S IEN=$O(^HLTMP("HL7 RUNNING PROCESSES",IEN)) Q:IEN=""  D
 .N NODE
 .S NODE=$G(^HLTMP("HL7 RUNNING PROCESSES",IEN))
 .Q:NODE=""
 .S VALMCNT=VALMCNT+1
 .S @VALMAR@(VALMCNT,0)="$J: "_$$LJ(IEN,9)_" ->"_$$CJ($P(NODE,"^",3),28)_"<- started at "_$$HTE^XLFDT($P(NODE,"^"))
 Q
 ;
OUTQUEUE ;
 N LINK
 D CLEAN^VALM10
 ;K @VALMAR
 S HLRFRSH="OUTQUEUE^HLOUSR"
 S (HLSCREEN,VALMSG)="Outgoing Queues *down links !stopped queues"
 S VALMCNT=0
 S VALMBCK="R"
 S VALMDDF("COL 1")="COL 1^2^20^ Link^H"
 S VALMDDF("COL 2")="COL 2^28^20^Queue^H"
 S VALMDDF("COL 3")="COL 3^50^20^Count^H"
 K VALMDDF("COL 4"),VALMDDF("COL 5")
 D CHGCAP^VALM("COL 1"," Link")
 S LINK=""
 F  S LINK=$O(^HLC("QUEUECOUNT","OUT",LINK)) Q:LINK=""  D
 .N COUNT,QUE,SHOW
 .S SHOW=LINK
 .I $D(^HLTMP("FAILING LINKS",SHOW)) S SHOW="*"_SHOW
 .S QUE=""
 .F  S QUE=$O(^HLC("QUEUECOUNT","OUT",LINK,QUE)) Q:QUE=""  D
 ..S COUNT=$G(^HLC("QUEUECOUNT","OUT",LINK,QUE))
 ..Q:'COUNT
 ..S VALMCNT=VALMCNT+1
 ..I $E(SHOW)="*" D
 ...S @VALMAR@(VALMCNT,0)=$$LJ(SHOW,20)_$$CJ($S($$STOPPED^HLOQUE("OUT",QUE):"!",1:"")_QUE,21)_"   "_$$RJ(COUNT,10),SHOW=""
 ...D CNTRL^VALM10(VALMCNT,1,1,IOBON,IOBOFF)
 ..E  S @VALMAR@(VALMCNT,0)=$$LJ(SHOW,20)_$$CJ($S($$STOPPED^HLOQUE("OUT",QUE):"!",1:"")_QUE,21)_"   "_$$RJ(COUNT,10),SHOW=""
 Q
 ;
INQUEUE ;
 N FROM
 D CLEAN^VALM10
 ;K @VALMAR
 S HLRFRSH="INQUEUE^HLOUSR"
 S (HLSCREEN,VALMSG)="Incoming Queues ('!' = stopped queues)"
 S VALMCNT=0
 S VALMBCK="R"
 S VALMDDF("COL 1")="COL 1^1^40^ From^H"
 S VALMDDF("COL 2")="COL 2^45^20^Queue^H"
 S VALMDDF("COL 3")="COL 3^70^10^Count^H"
 K VALMDDF("COL 4"),VALMDDF("COL 5")
 D CHGCAP^VALM("COL 1"," From")
 S FROM=""
 F  S FROM=$O(^HLC("QUEUECOUNT","IN",FROM)) Q:FROM=""  D
 .N COUNT,QUE,SHOW
 .S SHOW=$$LJ(FROM,40)_"  "
 .S QUE=""
 .F  S QUE=$O(^HLC("QUEUECOUNT","IN",FROM,QUE)) Q:QUE=""  D
 ..S COUNT=$G(^HLC("QUEUECOUNT","IN",FROM,QUE))
 ..Q:'COUNT
 ..S VALMCNT=VALMCNT+1
 ..S @VALMAR@(VALMCNT,0)=SHOW_$$LJ($S($$STOPPED^HLOQUE("IN",QUE):"!",1:"")_QUE,21)_" "_$$RJ(COUNT,10)
 ..S SHOW=$$LJ("",40)_"  "
 Q
 N C,QUIT,LINK,LINKARY
 S (QUIT,C,LINK)=""
 S VALMBCK="R"
 ;
 ;currently HL7 (Optimized) only does TCP, when serial added a change is needed here
 S LINK=$$ASKLINK
 Q:LINK=""
 Q:'$$GETLINK^HLOTLNK(LINK,.LINKARY)
 S LINK=LINK_":"_LINKARY("PORT")
 W !,"Hit any key to stop...",!
 F  D  Q:QUIT
 .N COUNT,QUE
 .S (COUNT,QUE)=""
 .F  S QUE=$O(^HLC("QUEUECOUNT","OUT",LINK,QUE)) Q:QUE=""  S COUNT=COUNT+$G(^(QUE))
 .W $C(13),"                             ",$C(13),"MESSAGES PENDING TRANSMISSION: ",IOBON,$$RJ(+COUNT,10),IOBOFF
 .R *C:1 I $T S QUIT=1
 Q
 ;
CJ(STRING,LEN) ;
 Q $$CJ^XLFSTR($E(STRING,1,LEN),LEN)
LJ(STRING,LEN) ;
 Q $$LJ^XLFSTR($E(STRING,1,LEN),LEN)
RJ(STRING,LEN) ;
 Q $$RJ^XLFSTR($E(STRING,1,LEN),LEN)
 ;
RUNNING() ;Is the Process Manager running?
 N RUNNING
 L +^HLTMP("PROCESS MANAGER"):0
 S RUNNING='$T
 I 'RUNNING L -^HLTMP("PROCESS MANAGER")
 Q RUNNING
 ;
 N LINK,LINKNAME,OK
 S VALMBCK="R"
 S LINKNAME=$$ASKLINK
 Q:LINKNAME=""
 S OK=$$IFOPEN^HLOUSR1(LINKNAME)
 I OK W !,LINKNAME_" IS operational..."
 E  W !,LINKNAME_" is NOT operational..."
 W !,"Hit any key to continue..."
 R *C:DTIME
 Q
 ;
 N DIC,TCP,X,Y,DTOUT,DUOUT
 S DIC=870
 S DIC(0)="AENQ"
 S TCP=$O(^HLCS(869.1,"B","TCP",0))
 S DIC("A")="Select a TCP link:"
 S DIC("S")="I $P(^(0),U,3)=TCP"
 D FULL^VALM1
 D ^DIC
 I +Y'=-1,'$D(DTOUT),'$D(DUOUT) Q $P(Y,"^",2)
 Q ""
 ;
STOP ;
 I '$$ASKYESNO^HLOUSR2("Are you SURE that you want to stop sending and receiving messages","NO") S VALMBCK="" Q
 ;
 D STOPHL7^HLOPROC1
 S VALMBCK="R",VALMSG="HL7 (Optimized) has been stopped...."
 H 5
 D:HLSCREEN="Brief System Status" BRIEF^HLOUSR
 D:HLSCREEN="Running Processes" PROCS^HLOUSR
 Q
 ;
UPDMODE ;update mode
 Q:'$L(HLRFRSH)
 N QUIT,NEW,TOP,BOTTOM,DX,DY,IOTM,IOBM,I
 W !!,IOINHI,"Hit any key to escape realtime display mode...",IOINORM
 S IOTM=3,IOBM=23
 W @IOSTBM
 S DX=1,DY=$S(VALMCNT<17:VALMCNT+1,1:17) X IOXY
 I VALMCNT>16 F I=17:1:$S(VALMCNT<22:VALMCNT,1:21) W !,@VALMAR@(I,0)
 S QUIT=0
 S TOP=VALMBG
 S BOTTOM=TOP+23
 S OLD=VALMAR
 S VALMAR="NEW"
 S VALMCNT=0
 F  D  Q:QUIT
 .N LINE
 .R *C:3 I $T S QUIT=1
 .S (VALMCNT,I)=0
 .D @HLRFRSH
 .F LINE=TOP:1:BOTTOM IF $G(@OLD@(LINE,0))'=$G(@VALMAR@(LINE,0)) D WRITE^VALM10(LINE)
 K @OLD M @OLD=@VALMAR S VALMAR=OLD
 S VALMBCK="R"
 Q