KMPRBD01 ;SFISC/RAK - RUM Daily/Weekly Compression ;1/20/00 07:35
;;1.0;CAPACITY MANAGEMENT - RUM;**1**;Dec 09, 1998
;
EN ;-- entry point for Background Driver.
;
S:'$G(DT) DT=$$DT^XLFDT
; Protect ^XTMP("KMPR") from the XQ82 background cleanup job
S ^XTMP("KMPR",0)=DT+10000
;
S:'$G(DT) DT=$$DT^XLFDT
;
; store daily stats in file #8971.1 (RESOURCE USAGE MONITOR).
S ^XTMP("KMPR","BACKGROUND","START")=$$FMTE^XLFDT($$NOW^XLFDT)
S ^XTMP("KMPR","BACKGROUND","STOP")=""
D DAILY^KMPRBD02(+$H)
S ^XTMP("KMPR","BACKGROUND","STOP")=$$FMTE^XLFDT($$NOW^XLFDT)
;
; clean up old "job" nodes.
D CLEAN
;
; if sunday do weekly compression
I '$$DOW^XLFDT(DT,1) D
.; store weekly start/stop stats.
.S ^XTMP("KMPR","BACKGROUND","WEEKLY","START")=$$FMTE^XLFDT($$NOW^XLFDT)
.S ^XTMP("KMPR","BACKGROUND","WEEKLY","STOP")=""
.D WEEKLY^KMPRBD02(DT)
.S ^XTMP("KMPR","BACKGROUND","WEEKLY","STOP")=$$FMTE^XLFDT($$NOW^XLFDT)
;
; check for errors.
D ERRORS
;
Q
;
CLEAN ;-- clean up old "JOB" nodes
;
N JOB,NODE S NODE=""
F S NODE=$O(^XTMP("KMPR","JOB",NODE)) Q:NODE="" D
.S JOB=0 F S JOB=$O(^XTMP("KMPR","JOB",NODE,JOB)) Q:'+JOB D
..I '$D(^XUTL("XQ",JOB)) K ^XTMP("KMPR","JOB",NODE,JOB)
;
; Store the number of active user jobs into ^XTMP("KMPR","ACTIVE")
; D CLUSTER^%ZKMPRC1
;
Q
;
ERRORS ; check and process errors.
;
Q:'$D(^XTMP("KMPR","ERR"))
;
N H,I,LN,N,O,SITE,TEXT,XMSUB,X,XMTEXT,XMY,XMZ,Y,Z
;
S SITE=$$SITE^VASITE
S XMSUB="RUM Error at site "_$P(SITE,U,3)_" on "_$$FMTE^XLFDT($$DT^XLFDT)
S TEXT(1)=" The following error(s) have been logged at "_$P(SITE,U,2)_" ("_$P(SITE,U,3)_") "
S TEXT(2)=" while moving data from ^XTMP(""KMPR"",""DLY"") to file 8971.1."
S H="",LN=3
; H = date in $H format (+$H).
; N = node name.
; O = option.
F S H=$O(^XTMP("KMPR","ERR",H)) Q:H="" S N="" D
.F S N=$O(^XTMP("KMPR","ERR",H,N)) Q:N="" S O="" D
..F S O=$O(^XTMP("KMPR","ERR",H,N,O)) Q:O="" D
...S TEXT(LN)="",LN=LN+1
...S TEXT(LN)="Date..: "_H_" Node: "_N,LN=LN+1
...S TEXT(LN)="Option: "_O,LN=LN+1
...; prime time.
...S TEXT(LN)="Prime Time = "_$G(^XTMP("KMPR","ERR",H,N,O,0)),LN=LN+1
...; non-prime time.
...S TEXT(LN)="Non-Prime Time = "_$G(^XTMP("KMPR","ERR",H,N,O,1)),LN=LN+1
...; message.
...F I=0:0 S I=$O(^XTMP("KMPR","ERR",H,N,O,"MSG",I)) Q:'I D
....S TEXT(LN)=^XTMP("KMPR","ERR",H,N,O,"MSG",I),LN=LN+1
S XMTEXT="TEXT("
S XMY("G.KMP2-RUM@DOMAIN.NAME")=""
D ^XMD
;
K ^XTMP("KMPR","ERR")
;
Q
KMPRBD01 ;SFISC/RAK - RUM Daily/Weekly Compression ;1/20/00 07:35
+1 ;;1.0;CAPACITY MANAGEMENT - RUM;**1**;Dec 09, 1998
+2 ;
EN ;-- entry point for Background Driver.
+1 ;
+2 IF '$GET(DT)
SET DT=$$DT^XLFDT
+3 ; Protect ^XTMP("KMPR") from the XQ82 background cleanup job
+4 SET ^XTMP("KMPR",0)=DT+10000
+5 ;
+6 IF '$GET(DT)
SET DT=$$DT^XLFDT
+7 ;
+8 ; store daily stats in file #8971.1 (RESOURCE USAGE MONITOR).
+9 SET ^XTMP("KMPR","BACKGROUND","START")=$$FMTE^XLFDT($$NOW^XLFDT)
+10 SET ^XTMP("KMPR","BACKGROUND","STOP")=""
+11 DO DAILY^KMPRBD02(+$HOROLOG)
+12 SET ^XTMP("KMPR","BACKGROUND","STOP")=$$FMTE^XLFDT($$NOW^XLFDT)
+13 ;
+14 ; clean up old "job" nodes.
+15 DO CLEAN
+16 ;
+17 ; if sunday do weekly compression
+18 IF '$$DOW^XLFDT(DT,1)
Begin DoDot:1
+19 ; store weekly start/stop stats.
+20 SET ^XTMP("KMPR","BACKGROUND","WEEKLY","START")=$$FMTE^XLFDT($$NOW^XLFDT)
+21 SET ^XTMP("KMPR","BACKGROUND","WEEKLY","STOP")=""
+22 DO WEEKLY^KMPRBD02(DT)
+23 SET ^XTMP("KMPR","BACKGROUND","WEEKLY","STOP")=$$FMTE^XLFDT($$NOW^XLFDT)
End DoDot:1
+24 ;
+25 ; check for errors.
+26 DO ERRORS
+27 ;
+28 QUIT
+29 ;
CLEAN ;-- clean up old "JOB" nodes
+1 ;
+2 NEW JOB,NODE
SET NODE=""
+3 FOR
SET NODE=$ORDER(^XTMP("KMPR","JOB",NODE))
IF NODE=""
QUIT
Begin DoDot:1
+4 SET JOB=0
FOR
SET JOB=$ORDER(^XTMP("KMPR","JOB",NODE,JOB))
IF '+JOB
QUIT
Begin DoDot:2
+5 IF '$DATA(^XUTL("XQ",JOB))
KILL ^XTMP("KMPR","JOB",NODE,JOB)
End DoDot:2
End DoDot:1
+6 ;
+7 ; Store the number of active user jobs into ^XTMP("KMPR","ACTIVE")
+8 ; D CLUSTER^%ZKMPRC1
+9 ;
+10 QUIT
+11 ;
ERRORS ; check and process errors.
+1 ;
+2 IF '$DATA(^XTMP("KMPR","ERR"))
QUIT
+3 ;
+4 NEW H,I,LN,N,O,SITE,TEXT,XMSUB,X,XMTEXT,XMY,XMZ,Y,Z
+5 ;
+6 SET SITE=$$SITE^VASITE
+7 SET XMSUB="RUM Error at site "_$PIECE(SITE,U,3)_" on "_$$FMTE^XLFDT($$DT^XLFDT)
+8 SET TEXT(1)=" The following error(s) have been logged at "_$PIECE(SITE,U,2)_" ("_$PIECE(SITE,U,3)_") "
+9 SET TEXT(2)=" while moving data from ^XTMP(""KMPR"",""DLY"") to file 8971.1."
+10 SET H=""
SET LN=3
+11 ; H = date in $H format (+$H).
+12 ; N = node name.
+13 ; O = option.
+14 FOR
SET H=$ORDER(^XTMP("KMPR","ERR",H))
IF H=""
QUIT
SET N=""
Begin DoDot:1
+15 FOR
SET N=$ORDER(^XTMP("KMPR","ERR",H,N))
IF N=""
QUIT
SET O=""
Begin DoDot:2
+16 FOR
SET O=$ORDER(^XTMP("KMPR","ERR",H,N,O))
IF O=""
QUIT
Begin DoDot:3
+17 SET TEXT(LN)=""
SET LN=LN+1
+18 SET TEXT(LN)="Date..: "_H_" Node: "_N
SET LN=LN+1
+19 SET TEXT(LN)="Option: "_O
SET LN=LN+1
+20 ; prime time.
+21 SET TEXT(LN)="Prime Time = "_$GET(^XTMP("KMPR","ERR",H,N,O,0))
SET LN=LN+1
+22 ; non-prime time.
+23 SET TEXT(LN)="Non-Prime Time = "_$GET(^XTMP("KMPR","ERR",H,N,O,1))
SET LN=LN+1
+24 ; message.
+25 FOR I=0:0
SET I=$ORDER(^XTMP("KMPR","ERR",H,N,O,"MSG",I))
IF 'I
QUIT
Begin DoDot:4
+26 SET TEXT(LN)=^XTMP("KMPR","ERR",H,N,O,"MSG",I)
SET LN=LN+1
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+27 SET XMTEXT="TEXT("
+28 SET XMY("G.KMP2-RUM@DOMAIN.NAME")=""
+29 DO ^XMD
+30 ;
+31 KILL ^XTMP("KMPR","ERR")
+32 ;
+33 QUIT