ORVCOMONITOR ;SPFO/AJB - VISTA CUTOVER ;Feb 11, 2021@09:04:23
;;3.0;ORDER ENTRY/RESULTS REPORTING;**529**;DEC 17, 1997;Build 17
Q
; see ORVCO for list of ICRs/DBIAs
EN ;
N ANS,BASE,POP,X,Y
S BASE=4 D PREP^XGF,HEADER
F D Q:ANS="Q"!(ANS=U)
. N JOB
. I '$$STATUS(.JOB) S JOB=0 D IOXY^XGF(BASE+JOB+1,1) W $$CJ^XLFSTR("< No Running Jobs >",80) D IOXY^XGF(14,0),PROMPT S ANS=U Q
. S JOB=$O(JOB(""),-1) D IOXY^XGF(BASE+JOB+1,1)
. N DIR S DIR="SAO^U:Update;S:Stop;Q:Quit"
. S DIR("L")="<Enter> to refresh the screen or (S)top a running Job # or (Q)uit"
. S ANS=$$FMR(.DIR,"Enter monitor action: ","UPDATE","^D MONHELP^ORVCOMONITOR") Q:ANS="Q"!(ANS=U)
. I ANS="S" D
. . D CLEAR^XGF(0,1,23,80),HEADER,STATUS(.JOB)
. . N ANS,DIR S DIR="SAO^",DIR("L")="Enter a Job # from the following list: "
. . S JOB=0 F S JOB=$O(JOB(JOB)) Q:'+JOB D
. . . S $P(DIR,U,2)=$P(DIR,U,2)_JOB(JOB)_":"_JOB(JOB)_$S(+$O(JOB(JOB)):";",1:"")
. . . S $P(DIR("L"),":",2)=$P(DIR("L"),":",2)_JOB(JOB)_$S(+$O(JOB(JOB)):", ",1:"")
. . D IOXY^XGF(BASE+$O(JOB(""),-1)+1,1)
. . S ANS=$$FMR(.DIR,"Enter a Job # from the list above: ","","^D JOBHELP^ORVCOMONITOR") Q:'+ANS
. . D CLEAR^XGF(0,1,23,80),HEADER(1),STATUS(.JOB)
. . W !!,"Asking Task Man to stop Job #: ",ANS
. . N INF,TASK S INF=$NA(^XTMP("ORVCO",ANS,"Info"))
. . S TASK=0 F S TASK=$O(@INF@(TASK)) Q:'+TASK D
. . . I $$ASKSTOP^%ZTLOAD(TASK)
. . D IOXY^XGF(14,0),PROMPT
. D CLEAR^XGF(0,0,23,80),HEADER
. I '$D(^XTMP("ORVCO")) S JOB=0 D IOXY^XGF(BASE+JOB+1,1) W $$CJ^XLFSTR("< No Running Jobs >",80) D IOXY^XGF(14,0),PROMPT S ANS=U Q
D CLEAR^XGF(0,0,23,80),CLEAN^XGF
Q
STATUS(JOB) ;
N CNT S (CNT,JOB)=0 F S JOB=$O(^XTMP("ORVCO",JOB)) Q:'+JOB D
. N DATA,INF,USER,MODE,TYPE,THREAD,START
. S INF=$NA(^XTMP("ORVCO",JOB,"Info"))
. I $D(@INF@("Single Patient")) Q
. S CNT=+$G(CNT)+1,JOB(CNT)=JOB
. I +$G(@INF@("Calculating")) D SAY^XGF((BASE+CNT),0,JOB),SAY^XGF((BASE+CNT),28,"< Evaluating Patients >") Q
. S DATA=$$SETSTR^VALM1(JOB,"",1,8) ; job #
. S DATA=$$SETSTR^VALM1($$GET1^DIQ(200,+@INF@("User"),.01),DATA,10,18) ; user
. S DATA=$$SETSTR^VALM1($S(+@INF@("Mode"):"Create",1:"Test"),DATA,35,6) ; mode
. S DATA=$$SETSTR^VALM1($S(+$P(@INF@("Mode"),U,2):"Reminders",1:"Summary"),DATA,43,9) ; type
. S (THREAD("Active"),THREAD("Progress"),THREAD)=0 F S THREAD=$O(@INF@(" Daemon",THREAD)) Q:'+THREAD D
. . S THREAD("Progress")=THREAD("Progress")+$G(@INF@(" Daemon",THREAD,"Progress"))
. . I '$D(@INF@(" Daemon",THREAD,"Stop Time")) S THREAD("Active")=THREAD("Active")+1
. S THREAD("Progress")=$E(THREAD("Progress")/@INF@("Patients"),1,3)*100 ; calculate completion %
. S DATA=$$SETSTR^VALM1(THREAD("Progress")_"%",DATA,32-$L(THREAD("Progress")),3) ; completion
. S THREAD=THREAD("Active")_$S(@INF@("Threads")>9:" of ",1:" of ")_@INF@("Threads") ; calulate active threads
. S DATA=$$SETSTR^VALM1(THREAD,DATA,61-$L(THREAD),8) ; threads
. S DATA=$$SETSTR^VALM1($E($$HTE^XLFDT(@INF@("Start Time")),1,18),DATA,63,18) ; start time
. D SAY^XGF((BASE+CNT),0,DATA)
Q CNT
N DATA D SAY^XGF(0,29,"Daemon* Monitoring Tool"),SAY^XGF(0,72,$P($$HTE^XLFDT($H),"@",2)),SAY^XGF(2,53,"Active")
S DATA=$$SETSTR^VALM1("Job #","",1,7)
S DATA=$$SETSTR^VALM1("User",DATA,10,4)
S DATA=$$SETSTR^VALM1("Progress",DATA,25,8)
S DATA=$$SETSTR^VALM1("Mode",DATA,35,4)
S DATA=$$SETSTR^VALM1("Type",DATA,43,9)
S DATA=$$SETSTR^VALM1("Threads",DATA,54,10)
S DATA=$$SETSTR^VALM1("Start Date/Time",DATA,66,15)
W !,IOUON,DATA,IOUOFF
D:'+$G(PARAM) SAY^XGF(21,0,"* In multitasking computer operating systems, a daemon is a computer program")
D:'+$G(PARAM) SAY^XGF(22,0," that runs as a background process rather than being under the direct control")
D:'+$G(PARAM) SAY^XGF(23,0," of an interactive user.")
Q
MONHELP ;
W !,"The following actions are available: <Enter>, S, or Q"
Q
JOBHELP ;
W !,"Enter the desired Job # or ^ to exit."
Q
FMR(DIR,PRM,DEF,HLP,SCR) ; fileman reader
N DILN,DILOCKTM,DISYS
N DIROUT,DIRUT,DTOUT,DUOUT,X,Y
S DIR(0)=DIR S:$G(PRM)'="" DIR("A")=PRM S:$G(DEF)'="" DIR("B")=DEF S:$G(SCR)'="" DIR("S")=SCR
I $G(HLP)'="" S DIR("?")=HLP
I $D(HLP) M DIR=HLP
W $G(IOCUON) D ^DIR W $G(IOCUOFF)
Q $S($D(DIROUT):U,$D(DIRUT):U,$D(DTOUT):U,$D(DUOUT):U,1:Y)
PROMPT ; 'Message transmitted, message received...'
I $$FMR("EA","Press <ENTER> to continue")
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HORVCOMONITOR 4419 printed Nov 22, 2024@17:44:47 Page 2
ORVCOMONITOR ;SPFO/AJB - VISTA CUTOVER ;Feb 11, 2021@09:04:23
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**529**;DEC 17, 1997;Build 17
+2 QUIT
+3 ; see ORVCO for list of ICRs/DBIAs
EN ;
+1 NEW ANS,BASE,POP,X,Y
+2 SET BASE=4
DO PREP^XGF
DO HEADER
+3 FOR
Begin DoDot:1
+4 NEW JOB
+5 IF '$$STATUS(.JOB)
SET JOB=0
DO IOXY^XGF(BASE+JOB+1,1)
WRITE $$CJ^XLFSTR("< No Running Jobs >",80)
DO IOXY^XGF(14,0)
DO PROMPT
SET ANS=U
QUIT
+6 SET JOB=$ORDER(JOB(""),-1)
DO IOXY^XGF(BASE+JOB+1,1)
+7 NEW DIR
SET DIR="SAO^U:Update;S:Stop;Q:Quit"
+8 SET DIR("L")="<Enter> to refresh the screen or (S)top a running Job # or (Q)uit"
+9 SET ANS=$$FMR(.DIR,"Enter monitor action: ","UPDATE","^D MONHELP^ORVCOMONITOR")
if ANS="Q"!(ANS=U)
QUIT
+10 IF ANS="S"
Begin DoDot:2
+11 DO CLEAR^XGF(0,1,23,80)
DO HEADER
DO STATUS(.JOB)
+12 NEW ANS,DIR
SET DIR="SAO^"
SET DIR("L")="Enter a Job # from the following list: "
+13 SET JOB=0
FOR
SET JOB=$ORDER(JOB(JOB))
if '+JOB
QUIT
Begin DoDot:3
+14 SET $PIECE(DIR,U,2)=$PIECE(DIR,U,2)_JOB(JOB)_":"_JOB(JOB)_$SELECT(+$ORDER(JOB(JOB)):";",1:"")
+15 SET $PIECE(DIR("L"),":",2)=$PIECE(DIR("L"),":",2)_JOB(JOB)_$SELECT(+$ORDER(JOB(JOB)):", ",1:"")
End DoDot:3
+16 DO IOXY^XGF(BASE+$ORDER(JOB(""),-1)+1,1)
+17 SET ANS=$$FMR(.DIR,"Enter a Job # from the list above: ","","^D JOBHELP^ORVCOMONITOR")
if '+ANS
QUIT
+18 DO CLEAR^XGF(0,1,23,80)
DO HEADER(1)
DO STATUS(.JOB)
+19 WRITE !!,"Asking Task Man to stop Job #: ",ANS
+20 NEW INF,TASK
SET INF=$NAME(^XTMP("ORVCO",ANS,"Info"))
+21 SET TASK=0
FOR
SET TASK=$ORDER(@INF@(TASK))
if '+TASK
QUIT
Begin DoDot:3
+22 IF $$ASKSTOP^%ZTLOAD(TASK)
End DoDot:3
+23 DO IOXY^XGF(14,0)
DO PROMPT
End DoDot:2
+24 DO CLEAR^XGF(0,0,23,80)
DO HEADER
+25 IF '$DATA(^XTMP("ORVCO"))
SET JOB=0
DO IOXY^XGF(BASE+JOB+1,1)
WRITE $$CJ^XLFSTR("< No Running Jobs >",80)
DO IOXY^XGF(14,0)
DO PROMPT
SET ANS=U
QUIT
End DoDot:1
if ANS="Q"!(ANS=U)
QUIT
+26 DO CLEAR^XGF(0,0,23,80)
DO CLEAN^XGF
+27 QUIT
STATUS(JOB) ;
+1 NEW CNT
SET (CNT,JOB)=0
FOR
SET JOB=$ORDER(^XTMP("ORVCO",JOB))
if '+JOB
QUIT
Begin DoDot:1
+2 NEW DATA,INF,USER,MODE,TYPE,THREAD,START
+3 SET INF=$NAME(^XTMP("ORVCO",JOB,"Info"))
+4 IF $DATA(@INF@("Single Patient"))
QUIT
+5 SET CNT=+$GET(CNT)+1
SET JOB(CNT)=JOB
+6 IF +$GET(@INF@("Calculating"))
DO SAY^XGF((BASE+CNT),0,JOB)
DO SAY^XGF((BASE+CNT),28,"< Evaluating Patients >")
QUIT
+7 ; job #
SET DATA=$$SETSTR^VALM1(JOB,"",1,8)
+8 ; user
SET DATA=$$SETSTR^VALM1($$GET1^DIQ(200,+@INF@("User"),.01),DATA,10,18)
+9 ; mode
SET DATA=$$SETSTR^VALM1($SELECT(+@INF@("Mode"):"Create",1:"Test"),DATA,35,6)
+10 ; type
SET DATA=$$SETSTR^VALM1($SELECT(+$PIECE(@INF@("Mode"),U,2):"Reminders",1:"Summary"),DATA,43,9)
+11 SET (THREAD("Active"),THREAD("Progress"),THREAD)=0
FOR
SET THREAD=$ORDER(@INF@(" Daemon",THREAD))
if '+THREAD
QUIT
Begin DoDot:2
+12 SET THREAD("Progress")=THREAD("Progress")+$GET(@INF@(" Daemon",THREAD,"Progress"))
+13 IF '$DATA(@INF@(" Daemon",THREAD,"Stop Time"))
SET THREAD("Active")=THREAD("Active")+1
End DoDot:2
+14 ; calculate completion %
SET THREAD("Progress")=$EXTRACT(THREAD("Progress")/@INF@("Patients"),1,3)*100
+15 ; completion
SET DATA=$$SETSTR^VALM1(THREAD("Progress")_"%",DATA,32-$LENGTH(THREAD("Progress")),3)
+16 ; calulate active threads
SET THREAD=THREAD("Active")_$SELECT(@INF@("Threads")>9:" of ",1:" of ")_@INF@("Threads")
+17 ; threads
SET DATA=$$SETSTR^VALM1(THREAD,DATA,61-$LENGTH(THREAD),8)
+18 ; start time
SET DATA=$$SETSTR^VALM1($EXTRACT($$HTE^XLFDT(@INF@("Start Time")),1,18),DATA,63,18)
+19 DO SAY^XGF((BASE+CNT),0,DATA)
End DoDot:1
+20 QUIT CNT
+1 NEW DATA
DO SAY^XGF(0,29,"Daemon* Monitoring Tool")
DO SAY^XGF(0,72,$PIECE($$HTE^XLFDT($HOROLOG),"@",2))
DO SAY^XGF(2,53,"Active")
+2 SET DATA=$$SETSTR^VALM1("Job #","",1,7)
+3 SET DATA=$$SETSTR^VALM1("User",DATA,10,4)
+4 SET DATA=$$SETSTR^VALM1("Progress",DATA,25,8)
+5 SET DATA=$$SETSTR^VALM1("Mode",DATA,35,4)
+6 SET DATA=$$SETSTR^VALM1("Type",DATA,43,9)
+7 SET DATA=$$SETSTR^VALM1("Threads",DATA,54,10)
+8 SET DATA=$$SETSTR^VALM1("Start Date/Time",DATA,66,15)
+9 WRITE !,IOUON,DATA,IOUOFF
+10 if '+$GET(PARAM)
DO SAY^XGF(21,0,"* In multitasking computer operating systems, a daemon is a computer program")
+11 if '+$GET(PARAM)
DO SAY^XGF(22,0," that runs as a background process rather than being under the direct control")
+12 if '+$GET(PARAM)
DO SAY^XGF(23,0," of an interactive user.")
+13 QUIT
MONHELP ;
+1 WRITE !,"The following actions are available: <Enter>, S, or Q"
+2 QUIT
JOBHELP ;
+1 WRITE !,"Enter the desired Job # or ^ to exit."
+2 QUIT
FMR(DIR,PRM,DEF,HLP,SCR) ; fileman reader
+1 NEW DILN,DILOCKTM,DISYS
+2 NEW DIROUT,DIRUT,DTOUT,DUOUT,X,Y
+3 SET DIR(0)=DIR
if $GET(PRM)'=""
SET DIR("A")=PRM
if $GET(DEF)'=""
SET DIR("B")=DEF
if $GET(SCR)'=""
SET DIR("S")=SCR
+4 IF $GET(HLP)'=""
SET DIR("?")=HLP
+5 IF $DATA(HLP)
MERGE DIR=HLP
+6 WRITE $GET(IOCUON)
DO ^DIR
WRITE $GET(IOCUOFF)
+7 QUIT $SELECT($DATA(DIROUT):U,$DATA(DIRUT):U,$DATA(DTOUT):U,$DATA(DUOUT):U,1:Y)
PROMPT ; 'Message transmitted, message received...'
+1 IF $$FMR("EA","Press <ENTER> to continue")
+2 QUIT