KMPRBD01 ;OAK/RAK - RUM Daily/Weekly Compression ;11/19/04 10:31
;;2.0;CAPACITY MANAGEMENT - RUM;**1,2**;May 28, 2003;Build 12
;
EN ;-- entry point for Background Driver.
;
S:'$G(DT) DT=$$DT^XLFDT
;
N ENDT,STR
;
; quit if test lab
Q:$$TESTLAB^KMPDUT1
;
S STR=$$NOW^XLFDT
D DAILY^KMPRBD02(+$H)
; store start, stop and delta times for daily background job
D STRSTP^KMPDUTL2(2,1,1,STR)
;
; clean up old "job" nodes.
D CLEAN
;
; if sunday do weekly compression
I '$$DOW^XLFDT(DT,1) D
.; store weekly start/stop stats.
.S STR=$$NOW^XLFDT
.D WEEKLY^KMPRBD04(DT)
.; store start, stop and delta times for weekly background job
.D STRSTP^KMPDUTL2(2,2,1,STR)
;
; check for errors.
D ERRORS
;
Q
;
CLEAN ;-- clean up old "JOB" nodes
;
N JOB,NODE S NODE=""
F S NODE=$O(^KMPTMP("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 ^KMPTMP("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@ISC-ALBANY.DOMAIN.EXT")=""
D ^XMD
;
K ^KMPTMP("KMPR","ERR")
;
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HKMPRBD01 2311 printed Dec 13, 2024@01:41:32 Page 2
KMPRBD01 ;OAK/RAK - RUM Daily/Weekly Compression ;11/19/04 10:31
+1 ;;2.0;CAPACITY MANAGEMENT - RUM;**1,2**;May 28, 2003;Build 12
+2 ;
EN ;-- entry point for Background Driver.
+1 ;
+2 if '$GET(DT)
SET DT=$$DT^XLFDT
+3 ;
+4 NEW ENDT,STR
+5 ;
+6 ; quit if test lab
+7 if $$TESTLAB^KMPDUT1
QUIT
+8 ;
+9 SET STR=$$NOW^XLFDT
+10 DO DAILY^KMPRBD02(+$HOROLOG)
+11 ; store start, stop and delta times for daily background job
+12 DO STRSTP^KMPDUTL2(2,1,1,STR)
+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 STR=$$NOW^XLFDT
+21 DO WEEKLY^KMPRBD04(DT)
+22 ; store start, stop and delta times for weekly background job
+23 DO STRSTP^KMPDUTL2(2,2,1,STR)
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(^KMPTMP("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 ^KMPTMP("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@ISC-ALBANY.DOMAIN.EXT")=""
+29 DO ^XMD
+30 ;
+31 KILL ^KMPTMP("KMPR","ERR")
+32 ;
+33 QUIT