DG53318M ;ALB/RTK DG*5.3*318 MT Cleanup Mailman Msg ; 09/07/00
;;5.3;Registration;**318,1015**;Aug 13, 1993;Build 21
;
; This routine will be run at sites as part of the MT Source Reset
; in patch DG*5.3*318.
;
; A mail message will be sent to the user when the cleanup process
; is complete.
;
;
MAIL ; Send a mailman msg to user with results
N DIFROM,%
N DATA,DATA1,FILE,FLD,IENX,NODE,TEXT,I,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,STA
K ^TMP("DG53318",$J)
S XMSUB="Means Test Source Reset Cleanup"
S XMDUZ="DG Cleanup Package",XMY(DUZ)="",XMY(.5)=""
S XMTEXT="^TMP(""DG53318"",$J,"
D NOW^%DTC S Y=% D DD^%DT
S ^TMP("DG53318",$J,1)="Means Test Source Reset Cleanup"
S ^TMP("DG53318",$J,2)=" "
S TEXT="Recs Scanned"
S TEXT=$$BLDSTR("# of MT Source Resets",TEXT,20,21)
S ^TMP("DG53318",$J,3)=TEXT
S ^TMP("DG53318",$J,4)=$$REPEAT^XLFSTR("=",$L(TEXT))
S NODE=4
S DATA=^XTMP("DG-FIXED",1)
S TEXT=^XTMP("DG-RECRD",1)
S TEXT=$$BLDSTR(DATA,TEXT,20,$L(DATA))
S NODE=NODE+1
S ^TMP("DG53318",$J,NODE)=TEXT
F I=1:1:2 S NODE=NODE+1,^TMP("DG53318",$J,NODE)=" "
;
; add error reports to the mail message
I $O(^XTMP("DG-ERORS",0))'="" D
.S NODE=NODE+1
.S ^TMP("DG53318",$J,NODE)="Some records were not edited due to filing errors:"
.S NODE=NODE+1
.S ^TMP("DG53318",$J,NODE)=" "
.S TEXT="File #"
.S TEXT=$$BLDSTR("Record #",TEXT,12,8)
.S TEXT=$$BLDSTR("Node",TEXT,22,9)
.S TEXT=$$BLDSTR("Error Message",TEXT,32,13)
.S NODE=NODE+1
.S ^TMP("DG53318",$J,NODE)=TEXT
.S FILE=""
.F S FILE=$O(^XTMP("DG-ERORS",FILE)) Q:FILE="" D
..S TEXT=FILE
..S IENX=""
..F S IENX=$O(^XTMP("DG-ERORS",FILE,IENX)) Q:IENX="" D
...S FLD=""
...F S FLD=$O(^XTMP("DG-ERORS",FILE,IENX,FLD)) Q:FLD="" D
....S DATA=^XTMP("DG-ERORS",FILE,IENX,FLD)
....S TEXT=$$BLDSTR(IENX,TEXT,12,$L(IENX))
....S TEXT=$$BLDSTR(FLD,TEXT,22,$L(FLD))
....S TEXT=$$BLDSTR(DATA,TEXT,32,$L(DATA))
....S NODE=NODE+1
....S ^TMP("DG53318",$J,NODE)=TEXT
;
MAIL1 D ^XMD
K ^TMP("DG53318",$J)
Q
;
BLDSTR(NSTR,STR,COL,NSL) ; build a string
; Input:
; NSTR = a string to be added to STR
; STR = an existing string to which NSTR will be added
; COL = column location at which NSTR will be added to STR
; NSL = length of new string
; Output:
; returns STR with NSTR appended at the specified COL
;
Q $E(STR_$J("",COL-1),1,COL-1)_$E(NSTR_$J("",NSL),1,NSL)_$E(STR,COL+NSL,999)
DG53318M ;ALB/RTK DG*5.3*318 MT Cleanup Mailman Msg ; 09/07/00
+1 ;;5.3;Registration;**318,1015**;Aug 13, 1993;Build 21
+2 ;
+3 ; This routine will be run at sites as part of the MT Source Reset
+4 ; in patch DG*5.3*318.
+5 ;
+6 ; A mail message will be sent to the user when the cleanup process
+7 ; is complete.
+8 ;
+9 ;
MAIL ; Send a mailman msg to user with results
+1 NEW DIFROM,%
+2 NEW DATA,DATA1,FILE,FLD,IENX,NODE,TEXT,I,X,XMDUZ,XMSUB,XMTEXT,XMY,Y,STA
+3 KILL ^TMP("DG53318",$JOB)
+4 SET XMSUB="Means Test Source Reset Cleanup"
+5 SET XMDUZ="DG Cleanup Package"
SET XMY(DUZ)=""
SET XMY(.5)=""
+6 SET XMTEXT="^TMP(""DG53318"",$J,"
+7 DO NOW^%DTC
SET Y=%
DO DD^%DT
+8 SET ^TMP("DG53318",$JOB,1)="Means Test Source Reset Cleanup"
+9 SET ^TMP("DG53318",$JOB,2)=" "
+10 SET TEXT="Recs Scanned"
+11 SET TEXT=$$BLDSTR("# of MT Source Resets",TEXT,20,21)
+12 SET ^TMP("DG53318",$JOB,3)=TEXT
+13 SET ^TMP("DG53318",$JOB,4)=$$REPEAT^XLFSTR("=",$LENGTH(TEXT))
+14 SET NODE=4
+15 SET DATA=^XTMP("DG-FIXED",1)
+16 SET TEXT=^XTMP("DG-RECRD",1)
+17 SET TEXT=$$BLDSTR(DATA,TEXT,20,$LENGTH(DATA))
+18 SET NODE=NODE+1
+19 SET ^TMP("DG53318",$JOB,NODE)=TEXT
+20 FOR I=1:1:2
SET NODE=NODE+1
SET ^TMP("DG53318",$JOB,NODE)=" "
+21 ;
+22 ; add error reports to the mail message
+23 IF $ORDER(^XTMP("DG-ERORS",0))'=""
Begin DoDot:1
+24 SET NODE=NODE+1
+25 SET ^TMP("DG53318",$JOB,NODE)="Some records were not edited due to filing errors:"
+26 SET NODE=NODE+1
+27 SET ^TMP("DG53318",$JOB,NODE)=" "
+28 SET TEXT="File #"
+29 SET TEXT=$$BLDSTR("Record #",TEXT,12,8)
+30 SET TEXT=$$BLDSTR("Node",TEXT,22,9)
+31 SET TEXT=$$BLDSTR("Error Message",TEXT,32,13)
+32 SET NODE=NODE+1
+33 SET ^TMP("DG53318",$JOB,NODE)=TEXT
+34 SET FILE=""
+35 FOR
SET FILE=$ORDER(^XTMP("DG-ERORS",FILE))
IF FILE=""
QUIT
Begin DoDot:2
+36 SET TEXT=FILE
+37 SET IENX=""
+38 FOR
SET IENX=$ORDER(^XTMP("DG-ERORS",FILE,IENX))
IF IENX=""
QUIT
Begin DoDot:3
+39 SET FLD=""
+40 FOR
SET FLD=$ORDER(^XTMP("DG-ERORS",FILE,IENX,FLD))
IF FLD=""
QUIT
Begin DoDot:4
+41 SET DATA=^XTMP("DG-ERORS",FILE,IENX,FLD)
+42 SET TEXT=$$BLDSTR(IENX,TEXT,12,$LENGTH(IENX))
+43 SET TEXT=$$BLDSTR(FLD,TEXT,22,$LENGTH(FLD))
+44 SET TEXT=$$BLDSTR(DATA,TEXT,32,$LENGTH(DATA))
+45 SET NODE=NODE+1
+46 SET ^TMP("DG53318",$JOB,NODE)=TEXT
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+47 ;
MAIL1 DO ^XMD
+1 KILL ^TMP("DG53318",$JOB)
+2 QUIT
+3 ;
BLDSTR(NSTR,STR,COL,NSL) ; build a string
+1 ; Input:
+2 ; NSTR = a string to be added to STR
+3 ; STR = an existing string to which NSTR will be added
+4 ; COL = column location at which NSTR will be added to STR
+5 ; NSL = length of new string
+6 ; Output:
+7 ; returns STR with NSTR appended at the specified COL
+8 ;
+9 QUIT $EXTRACT(STR_$JUSTIFY("",COL-1),1,COL-1)_$EXTRACT(NSTR_$JUSTIFY("",NSL),1,NSL)_$EXTRACT(STR,COL+NSL,999)