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
VIEWLINK ;
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
;
TESTLINK ;
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
;
ASKLINK() ;
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
HLOUSR ;ALB/CJM -ListManager Screen for viewing system status;12 JUN 1997 10:00 am
+1 ;;1.6;HEALTH LEVEL SEVEN;**126,130**;Oct 13, 1995;Build 10
+2 ;
EN ;
+1 ;
+2 NEW HLSCREEN,TESTOPEN,HLRFRSH
+3 DO WAIT^DICD
+4 DO EN^VALM("HLO SYSTEM MONITOR")
+5 QUIT
+6 ;
BRIEF ;Init variables and list array
+1 NEW COUNT,LINK,QUE,FROM,TIME,STATUS,TEMP,DIR,TODAY,LIST
+2 SET HLRFRSH="BRIEF^HLOUSR"
+3 SET (HLSCREEN,VALMSG)="Brief System Status"
+4 SET VALMCNT=8
+5 ;K @VALMAR
+6 DO CLEAN^VALM10
+7 SET VALMBG=1
+8 SET VALMBCK="R"
+9 KILL VALMDDF("COL 2"),VALMDDF("COL 3"),VALMDDF("COL 4"),VALMDDF("COL 5")
+10 DO CHGCAP^VALM("COL 1","Brief Operational Overview")
+11 SET @VALMAR@(1,0)="SYSTEM STATUS: "_$SELECT($$CHKSTOP^HLOPROC:"STOPPED",1:"RUNNING")
+12 SET @VALMAR@(2,0)="PROCESS MANAGER: "_$SELECT($$RUNNING:"RUNNING",1:"STOPPED")
+13 ;
+14 SET TIME=$PIECE($GET(TESTOPEN("LISTENER")),"^",2)
+15 IF TIME
IF $$FMDIFF^XLFDT($$NOW^XLFDT,TIME,2)<300
Begin DoDot:1
+16 SET STATUS=+TESTOPEN("LISTENER")
End DoDot:1
+17 IF '$TEST
Begin DoDot:1
+18 SET STATUS=0
+19 SET LINK=$PIECE($GET(^HLD(779.1,1,0)),"^",10)
+20 IF LINK
SET LINK=$PIECE($GET(^HLCS(870,LINK,0)),"^")
IF '$LENGTH(LINK)
QUIT
SET STATUS=$$IFOPEN^HLOUSR1(LINK)
+21 SET TESTOPEN("LISTENER")=STATUS_"^"_$$NOW^XLFDT
End DoDot:1
+22 ;
+23 SET @VALMAR@(3,0)="STANDARD LISTENER: "_$SELECT(STATUS:"OPERATIONAL",1:"NOT OPERATIONAL")
+24 ;
+25 SET TIME=$PIECE($GET(TESTOPEN("IE")),"^",2)
+26 IF TIME
IF $$FMDIFF^XLFDT($$NOW^XLFDT,TIME,2)<300
Begin DoDot:1
+27 SET STATUS=+TESTOPEN("IE")
End DoDot:1
+28 IF '$TEST
Begin DoDot:1
+29 SET STATUS=$$IFOPEN^HLOUSR1("VA-VIE")
+30 SET TESTOPEN("IE")=STATUS_"^"_$$NOW^XLFDT
End DoDot:1
+31 SET @VALMAR@(4,0)="INTERFACE ENGINE: "_$SELECT(STATUS:"OPERATIONAL",1:"NOT OPERATIONAL")
+32 SET @VALMAR@(5,0)="TASKMAN: "_$SELECT($$TM^%ZTLOAD:"RUNNING",1:"NOT RUNNING")
+33 ;
+34 SET (LIST,LINK)=""
+35 FOR
SET LINK=$ORDER(^HLTMP("FAILING LINKS",LINK))
IF LINK=""
QUIT
Begin DoDot:1
+36 NEW TIME,QUE,LINKARY
+37 IF $$GETLINK^HLOTLNK($PIECE(LINK,":"),.LINKARY)
+38 SET TIME=$GET(^HLTMP("FAILING LINKS",LINK))
IF TIME=""
QUIT
+39 IF '$GET(LINKARY("SHUTDOWN"))
IF TIME=""
QUIT
+40 IF '$GET(LINKARY("SHUTDOWN"))
IF ($$HDIFF^XLFDT($HOROLOG,TIME,2)<300)
QUIT
+41 SET LIST=LIST_$SELECT($LENGTH(LIST):", ",1:"")_$PIECE(LINK,":")
End DoDot:1
IF $LENGTH(LIST)>60
SET LIST=LIST_",..."
QUIT
+42 SET @VALMAR@(6,0)="DOWN LINKS: "_LIST
+43 SET @VALMAR@(7,0)="CLIENT LINK PROCESSES: "_+$GET(^HLC("HL7 PROCESS COUNTS","RUNNING","OUTGOING CLIENT LINK"))
+44 SET @VALMAR@(8,0)="IN-FILER PROCESSES: "_+$GET(^HLC("HL7 PROCESS COUNTS","RUNNING","INCOMING QUEUES"))
+45 SET COUNT=0
SET LINK=""
+46 FOR
SET LINK=$ORDER(^HLC("QUEUECOUNT","OUT",LINK))
IF LINK=""
QUIT
SET QUE=""
FOR
SET QUE=$ORDER(^(LINK,QUE))
IF QUE=""
QUIT
SET COUNT=COUNT+$GET(^(QUE))
+47 SET @VALMAR@(9,0)="MESSAGES PENDING TRANSMISSION: "_+COUNT
+48 SET TEMP="STOPPED OUTGOING QUEUES: "
+49 SET COUNT=0
SET QUE=""
+50 FOR
SET QUE=$ORDER(^HLTMP("STOPPED QUEUES","OUT",QUE))
IF QUE=""
QUIT
SET COUNT=COUNT+1
IF COUNT>4
QUIT
IF COUNT=1
SET TEMP=TEMP_QUE
IF "23"[COUNT
SET TEMP=TEMP_"; "_QUE
IF COUNT=4
SET TEMP=TEMP_" ..."
+51 SET @VALMAR@(10,0)=TEMP
+52 SET COUNT=0
SET QUE=""
+53 FOR
SET QUE=$ORDER(^HLC("QUEUECOUNT","IN",QUE))
IF QUE=""
QUIT
SET FROM=""
FOR
SET FROM=$ORDER(^(QUE,FROM))
IF FROM=""
QUIT
SET COUNT=COUNT+$GET(^(FROM))
+54 SET @VALMAR@(11,0)="MESSAGES PENDING ON APPLICATIONS: "_+COUNT
+55 SET TEMP="STOPPED INCOMING QUEUES: "
+56 SET COUNT=0
SET QUE=""
+57 FOR
SET QUE=$ORDER(^HLTMP("STOPPED QUEUES","IN",QUE))
IF QUE=""
QUIT
SET COUNT=COUNT+1
IF COUNT>4
QUIT
IF COUNT=1
SET TEMP=TEMP_QUE
IF "23"[COUNT
SET TEMP=TEMP_"; "_QUE
IF COUNT=4
SET TEMP=TEMP_" ..."
+58 SET @VALMAR@(12,0)=TEMP
+59 SET @VALMAR@(13,0)="FILE 777 RECORD COUNT: "_$$RJ($PIECE($GET(^HLTMP("FILE 777 RECORD COUNT")),"^"),10)_" --> as of "_$$FMTE^XLFDT($PIECE($GET(^HLTMP("FILE 777 RECORD COUNT")),"^",2))
+60 SET @VALMAR@(14,0)="FILE 778 RECORD COUNT: "_$$RJ($PIECE($GET(^HLTMP("FILE 778 RECORD COUNT")),"^"),10)_" --> as of "_$$FMTE^XLFDT($PIECE($GET(^HLTMP("FILE 778 RECORD COUNT")),"^",2))
+61 SET TODAY=$$DT^XLFDT
+62 FOR DIR="IN","OUT"
Begin DoDot:1
+63 NEW RAP,SAP,TIME,TOTAL
+64 SET TOTAL=0
+65 SET TIME=TODAY-.0001
+66 FOR
SET TIME=$ORDER(^HLSTATS(DIR,"HOURLY",TIME))
IF 'TIME
QUIT
IF ((TIME\1)>TODAY)
QUIT
Begin DoDot:2
+67 SET SAP=""
+68 FOR
SET SAP=$ORDER(^HLSTATS(DIR,"HOURLY",TIME,SAP))
IF SAP=""
QUIT
Begin DoDot:3
+69 IF SAP="ACCEPT ACK"
QUIT
+70 SET RAP=""
+71 FOR
SET RAP=$ORDER(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP))
IF RAP=""
QUIT
Begin DoDot:4
+72 SET TYPE=""
+73 FOR
SET TYPE=$ORDER(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE))
IF TYPE=""
QUIT
Begin DoDot:5
+74 SET TOTAL=TOTAL+$GET(^HLSTATS(DIR,"HOURLY",TIME,SAP,RAP,TYPE))
End DoDot:5
End DoDot:4
End DoDot:3
End DoDot:2
+75 IF DIR="OUT"
SET @VALMAR@(15,0)="MESSAGES SENT TODAY: "_$$RJ(TOTAL,10)
+76 IF DIR'="OUT"
SET @VALMAR@(16,0)="MESSAGES RECEIVED TODAY: "_$$RJ(TOTAL,10)
End DoDot:1
+77 QUIT
+78 ;
HELP ;Help code
+1 SET X="?"
DO DISP^XQORM1
WRITE !!
+2 QUIT
+3 ;
EXIT ;Exit code
+1 DO CLEAN^VALM10
+2 DO CLEAR^VALM1
+3 ;
+4 QUIT
+5 ;
EXPND ;Expand code
+1 QUIT
+2 ;
PROCS ;
+1 SET HLRFRSH="PROCS^HLOUSR"
+2 ;K @VALMAR
+3 DO CLEAN^VALM10
+4 SET VALMCNT=0
+5 SET VALMBCK="R"
+6 SET VALMDDF("COL 2")="COL 2^35^10^MIN^H"
+7 SET VALMDDF("COL 3")="COL 3^47^10^MAX^H"
+8 SET VALMDDF("COL 4")="COL 4^59^10^#RUNNING^H"
+9 SET VALMDDF("COL 5")="COL 5^71^10^#QUEUED^IOBON"
+10 DO CHGCAP^VALM("COL 1","Process Type")
+11 NEW IEN
+12 SET IEN=0
+13 FOR
SET IEN=$ORDER(^HLD(779.3,"C",1,IEN))
IF 'IEN
QUIT
Begin DoDot:1
+14 NEW PROC
+15 IF '$$GETPROC^HLOPROC1(IEN,.PROC)
QUIT
+16 IF PROC("NAME")="VMS TCP LISTENER"
QUIT
+17 SET VALMCNT=VALMCNT+1
+18 SET @VALMAR@(VALMCNT,0)=$$LJ(PROC("NAME"),30)_$$RJ(PROC("MINIMUM"),6)_$$RJ(PROC("MAXIMUM"),12)_$$RJ(+$GET(^HLC("HL7 PROCESS COUNTS","RUNNING",PROC("NAME"))),14)_$$RJ(+$GET(^HLC("HL7 PROCESS COUNTS","QUEUED",PROC("NAME"))),12)
End DoDot:1
+19 SET VALMCNT=VALMCNT+1
SET @VALMAR@(VALMCNT,0)=""
+20 SET IEN=""
+21 FOR
SET IEN=$ORDER(^HLTMP("HL7 RUNNING PROCESSES",IEN))
IF IEN=""
QUIT
Begin DoDot:1
+22 NEW NODE
+23 SET NODE=$GET(^HLTMP("HL7 RUNNING PROCESSES",IEN))
+24 IF NODE=""
QUIT
+25 SET VALMCNT=VALMCNT+1
+26 SET @VALMAR@(VALMCNT,0)="$J: "_$$LJ(IEN,9)_" ->"_$$CJ($PIECE(NODE,"^",3),28)_"<- started at "_$$HTE^XLFDT($PIECE(NODE,"^"))
End DoDot:1
+27 QUIT
+28 ;
OUTQUEUE ;
+1 NEW LINK
+2 DO CLEAN^VALM10
+3 ;K @VALMAR
+4 SET HLRFRSH="OUTQUEUE^HLOUSR"
+5 SET (HLSCREEN,VALMSG)="Outgoing Queues *down links !stopped queues"
+6 SET VALMCNT=0
+7 SET VALMBCK="R"
+8 SET VALMDDF("COL 1")="COL 1^2^20^ Link^H"
+9 SET VALMDDF("COL 2")="COL 2^28^20^Queue^H"
+10 SET VALMDDF("COL 3")="COL 3^50^20^Count^H"
+11 KILL VALMDDF("COL 4"),VALMDDF("COL 5")
+12 DO CHGCAP^VALM("COL 1"," Link")
+13 SET LINK=""
+14 FOR
SET LINK=$ORDER(^HLC("QUEUECOUNT","OUT",LINK))
IF LINK=""
QUIT
Begin DoDot:1
+15 NEW COUNT,QUE,SHOW
+16 SET SHOW=LINK
+17 IF $DATA(^HLTMP("FAILING LINKS",SHOW))
SET SHOW="*"_SHOW
+18 SET QUE=""
+19 FOR
SET QUE=$ORDER(^HLC("QUEUECOUNT","OUT",LINK,QUE))
IF QUE=""
QUIT
Begin DoDot:2
+20 SET COUNT=$GET(^HLC("QUEUECOUNT","OUT",LINK,QUE))
+21 IF 'COUNT
QUIT
+22 SET VALMCNT=VALMCNT+1
+23 IF $EXTRACT(SHOW)="*"
Begin DoDot:3
+24 SET @VALMAR@(VALMCNT,0)=$$LJ(SHOW,20)_$$CJ($SELECT($$STOPPED^HLOQUE("OUT",QUE):"!",1:"")_QUE,21)_" "_$$RJ(COUNT,10)
SET SHOW=""
+25 DO CNTRL^VALM10(VALMCNT,1,1,IOBON,IOBOFF)
End DoDot:3
+26 IF '$TEST
SET @VALMAR@(VALMCNT,0)=$$LJ(SHOW,20)_$$CJ($SELECT($$STOPPED^HLOQUE("OUT",QUE):"!",1:"")_QUE,21)_" "_$$RJ(COUNT,10)
SET SHOW=""
End DoDot:2
End DoDot:1
+27 QUIT
+28 ;
INQUEUE ;
+1 NEW FROM
+2 DO CLEAN^VALM10
+3 ;K @VALMAR
+4 SET HLRFRSH="INQUEUE^HLOUSR"
+5 SET (HLSCREEN,VALMSG)="Incoming Queues ('!' = stopped queues)"
+6 SET VALMCNT=0
+7 SET VALMBCK="R"
+8 SET VALMDDF("COL 1")="COL 1^1^40^ From^H"
+9 SET VALMDDF("COL 2")="COL 2^45^20^Queue^H"
+10 SET VALMDDF("COL 3")="COL 3^70^10^Count^H"
+11 KILL VALMDDF("COL 4"),VALMDDF("COL 5")
+12 DO CHGCAP^VALM("COL 1"," From")
+13 SET FROM=""
+14 FOR
SET FROM=$ORDER(^HLC("QUEUECOUNT","IN",FROM))
IF FROM=""
QUIT
Begin DoDot:1
+15 NEW COUNT,QUE,SHOW
+16 SET SHOW=$$LJ(FROM,40)_" "
+17 SET QUE=""
+18 FOR
SET QUE=$ORDER(^HLC("QUEUECOUNT","IN",FROM,QUE))
IF QUE=""
QUIT
Begin DoDot:2
+19 SET COUNT=$GET(^HLC("QUEUECOUNT","IN",FROM,QUE))
+20 IF 'COUNT
QUIT
+21 SET VALMCNT=VALMCNT+1
+22 SET @VALMAR@(VALMCNT,0)=SHOW_$$LJ($SELECT($$STOPPED^HLOQUE("IN",QUE):"!",1:"")_QUE,21)_" "_$$RJ(COUNT,10)
+23 SET SHOW=$$LJ("",40)_" "
End DoDot:2
End DoDot:1
+24 QUIT
VIEWLINK ;
+1 NEW C,QUIT,LINK,LINKARY
+2 SET (QUIT,C,LINK)=""
+3 SET VALMBCK="R"
+4 ;
+5 ;currently HL7 (Optimized) only does TCP, when serial added a change is needed here
+6 SET LINK=$$ASKLINK
+7 IF LINK=""
QUIT
+8 IF '$$GETLINK^HLOTLNK(LINK,.LINKARY)
QUIT
+9 SET LINK=LINK_":"_LINKARY("PORT")
+10 WRITE !,"Hit any key to stop...",!
+11 FOR
Begin DoDot:1
+12 NEW COUNT,QUE
+13 SET (COUNT,QUE)=""
+14 FOR
SET QUE=$ORDER(^HLC("QUEUECOUNT","OUT",LINK,QUE))
IF QUE=""
QUIT
SET COUNT=COUNT+$GET(^(QUE))
+15 WRITE $CHAR(13)," ",$CHAR(13),"MESSAGES PENDING TRANSMISSION: ",IOBON,$$RJ(+COUNT,10),IOBOFF
+16 READ *C:1
IF $TEST
SET QUIT=1
End DoDot:1
IF QUIT
QUIT
+17 QUIT
+18 ;
CJ(STRING,LEN) ;
+1 QUIT $$CJ^XLFSTR($EXTRACT(STRING,1,LEN),LEN)
LJ(STRING,LEN) ;
+1 QUIT $$LJ^XLFSTR($EXTRACT(STRING,1,LEN),LEN)
RJ(STRING,LEN) ;
+1 QUIT $$RJ^XLFSTR($EXTRACT(STRING,1,LEN),LEN)
+2 ;
RUNNING() ;Is the Process Manager running?
+1 NEW RUNNING
+2 LOCK +^HLTMP("PROCESS MANAGER"):0
+3 SET RUNNING='$TEST
+4 IF 'RUNNING
LOCK -^HLTMP("PROCESS MANAGER")
+5 QUIT RUNNING
+6 ;
TESTLINK ;
+1 NEW LINK,LINKNAME,OK
+2 SET VALMBCK="R"
+3 SET LINKNAME=$$ASKLINK
+4 IF LINKNAME=""
QUIT
+5 SET OK=$$IFOPEN^HLOUSR1(LINKNAME)
+6 IF OK
WRITE !,LINKNAME_" IS operational..."
+7 IF '$TEST
WRITE !,LINKNAME_" is NOT operational..."
+8 WRITE !,"Hit any key to continue..."
+9 READ *C:DTIME
+10 QUIT
+11 ;
ASKLINK() ;
+1 NEW DIC,TCP,X,Y,DTOUT,DUOUT
+2 SET DIC=870
+3 SET DIC(0)="AENQ"
+4 SET TCP=$ORDER(^HLCS(869.1,"B","TCP",0))
+5 SET DIC("A")="Select a TCP link:"
+6 SET DIC("S")="I $P(^(0),U,3)=TCP"
+7 DO FULL^VALM1
+8 DO ^DIC
+9 IF +Y'=-1
IF '$DATA(DTOUT)
IF '$DATA(DUOUT)
QUIT $PIECE(Y,"^",2)
+10 QUIT ""
+11 ;
STOP ;
+1 IF '$$ASKYESNO^HLOUSR2("Are you SURE that you want to stop sending and receiving messages","NO")
SET VALMBCK=""
QUIT
+2 ;
+3 DO STOPHL7^HLOPROC1
+4 SET VALMBCK="R"
SET VALMSG="HL7 (Optimized) has been stopped...."
+5 HANG 5
+6 IF HLSCREEN="Brief System Status"
DO BRIEF^HLOUSR
+7 IF HLSCREEN="Running Processes"
DO PROCS^HLOUSR
+8 QUIT
+9 ;
UPDMODE ;update mode
+1 IF '$LENGTH(HLRFRSH)
QUIT
+2 NEW QUIT,NEW,TOP,BOTTOM,DX,DY,IOTM,IOBM,I
+3 WRITE !!,IOINHI,"Hit any key to escape realtime display mode...",IOINORM
+4 SET IOTM=3
SET IOBM=23
+5 WRITE @IOSTBM
+6 SET DX=1
SET DY=$SELECT(VALMCNT<17:VALMCNT+1,1:17)
XECUTE IOXY
+7 IF VALMCNT>16
FOR I=17:1:$SELECT(VALMCNT<22:VALMCNT,1:21)
WRITE !,@VALMAR@(I,0)
+8 SET QUIT=0
+9 SET TOP=VALMBG
+10 SET BOTTOM=TOP+23
+11 SET OLD=VALMAR
+12 SET VALMAR="NEW"
+13 SET VALMCNT=0
+14 FOR
Begin DoDot:1
+15 NEW LINE
+16 READ *C:3
IF $TEST
SET QUIT=1
+17 SET (VALMCNT,I)=0
+18 DO @HLRFRSH
+19 FOR LINE=TOP:1:BOTTOM
IF $GET(@OLD@(LINE,0))'=$GET(@VALMAR@(LINE,0))
DO WRITE^VALM10(LINE)
End DoDot:1
IF QUIT
QUIT
+20 KILL @OLD
MERGE @OLD=@VALMAR
SET VALMAR=OLD
+21 SET VALMBCK="R"
+22 QUIT