DG53376M ;;ALB/RTK DG*5.3*376 Edit Cat A Edit Mailman Msg; 04/11/01
;;5.3;Registration;**376,1015**;Aug 13, 1993;Build 21
;
; This routine will be run as part of the Cat A MT Edit in
; patch DG*5.3*376.
;
; A mail message will be sent to the user when the 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("DG53376",$J)
S XMSUB="Cat A Means Test Edit"
S XMDUZ="VistA Distribution",XMY(DUZ)="",XMY(.5)=""
S XMTEXT="^TMP(""DG53376"","_$J_","
D NOW^%DTC S Y=% D DD^%DT
S ^TMP("DG53376",$J,1)="Means Test Edit/Transmission"
S ^TMP("DG53376",$J,2)=" "
S TEXT="Means Test Records:"
S ^TMP("DG53376",$J,3)=TEXT
S TEXT="Cat A Recs Edited"
S ^TMP("DG53376",$J,4)=TEXT
S ^TMP("DG53376",$J,5)=$$REPEAT^XLFSTR("=",$L(TEXT))
S NODE=5
S DATA=^XTMP("DG-EDIT",1)
S TEXT=^XTMP("DG-MTRC",1)
S TEXT=$$BLDSTR(DATA,TEXT,16,$L(DATA))
S NODE=NODE+1
S ^TMP("DG53376",$J,NODE)=TEXT
F I=1:1:2 S NODE=NODE+1,^TMP("DG53376",$J,NODE)=" "
;
; add error reports to the mail message
I $O(^XTMP("IVM-FERR",0))'="" D
.S NODE=NODE+1
.S ^TMP("DG53376",$J,NODE)="Some records were not edited due to filing errors:"
.S NODE=NODE+1
.S ^TMP("DG53376",$J,NODE)=" "
.S TEXT="File #"
.S TEXT=$$BLDSTR("Record #",TEXT,12,8)
.S TEXT=$$BLDSTR("MTIEN",TEXT,22,9)
.S TEXT=$$BLDSTR("Error Message",TEXT,32,13)
.S NODE=NODE+1
.S ^TMP("DG53376",$J,NODE)=TEXT
.S FILE=""
.F S FILE=$O(^XTMP("DG-FERR",FILE)) Q:FILE="" D
..S TEXT=FILE
..S IENX=""
..F S IENX=$O(^XTMP("DG-FERR",FILE,IENX)) Q:IENX="" D
...S FLD=""
...F S FLD=$O(^XTMP("DG-FERR",FILE,IENX,FLD)) Q:FLD="" D
....S DATA=^XTMP("DG-FERR",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("DG53376",$J,NODE)=TEXT
;
MAIL1 D ^XMD
K ^TMP("DG53376",$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)
DG53376M ;;ALB/RTK DG*5.3*376 Edit Cat A Edit Mailman Msg; 04/11/01
+1 ;;5.3;Registration;**376,1015**;Aug 13, 1993;Build 21
+2 ;
+3 ; This routine will be run as part of the Cat A MT Edit in
+4 ; patch DG*5.3*376.
+5 ;
+6 ; A mail message will be sent to the user when the 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("DG53376",$JOB)
+4 SET XMSUB="Cat A Means Test Edit"
+5 SET XMDUZ="VistA Distribution"
SET XMY(DUZ)=""
SET XMY(.5)=""
+6 SET XMTEXT="^TMP(""DG53376"","_$JOB_","
+7 DO NOW^%DTC
SET Y=%
DO DD^%DT
+8 SET ^TMP("DG53376",$JOB,1)="Means Test Edit/Transmission"
+9 SET ^TMP("DG53376",$JOB,2)=" "
+10 SET TEXT="Means Test Records:"
+11 SET ^TMP("DG53376",$JOB,3)=TEXT
+12 SET TEXT="Cat A Recs Edited"
+13 SET ^TMP("DG53376",$JOB,4)=TEXT
+14 SET ^TMP("DG53376",$JOB,5)=$$REPEAT^XLFSTR("=",$LENGTH(TEXT))
+15 SET NODE=5
+16 SET DATA=^XTMP("DG-EDIT",1)
+17 SET TEXT=^XTMP("DG-MTRC",1)
+18 SET TEXT=$$BLDSTR(DATA,TEXT,16,$LENGTH(DATA))
+19 SET NODE=NODE+1
+20 SET ^TMP("DG53376",$JOB,NODE)=TEXT
+21 FOR I=1:1:2
SET NODE=NODE+1
SET ^TMP("DG53376",$JOB,NODE)=" "
+22 ;
+23 ; add error reports to the mail message
+24 IF $ORDER(^XTMP("IVM-FERR",0))'=""
Begin DoDot:1
+25 SET NODE=NODE+1
+26 SET ^TMP("DG53376",$JOB,NODE)="Some records were not edited due to filing errors:"
+27 SET NODE=NODE+1
+28 SET ^TMP("DG53376",$JOB,NODE)=" "
+29 SET TEXT="File #"
+30 SET TEXT=$$BLDSTR("Record #",TEXT,12,8)
+31 SET TEXT=$$BLDSTR("MTIEN",TEXT,22,9)
+32 SET TEXT=$$BLDSTR("Error Message",TEXT,32,13)
+33 SET NODE=NODE+1
+34 SET ^TMP("DG53376",$JOB,NODE)=TEXT
+35 SET FILE=""
+36 FOR
SET FILE=$ORDER(^XTMP("DG-FERR",FILE))
IF FILE=""
QUIT
Begin DoDot:2
+37 SET TEXT=FILE
+38 SET IENX=""
+39 FOR
SET IENX=$ORDER(^XTMP("DG-FERR",FILE,IENX))
IF IENX=""
QUIT
Begin DoDot:3
+40 SET FLD=""
+41 FOR
SET FLD=$ORDER(^XTMP("DG-FERR",FILE,IENX,FLD))
IF FLD=""
QUIT
Begin DoDot:4
+42 SET DATA=^XTMP("DG-FERR",FILE,IENX,FLD)
+43 SET TEXT=$$BLDSTR(IENX,TEXT,12,$LENGTH(IENX))
+44 SET TEXT=$$BLDSTR(FLD,TEXT,22,$LENGTH(FLD))
+45 SET TEXT=$$BLDSTR(DATA,TEXT,32,$LENGTH(DATA))
+46 SET NODE=NODE+1
+47 SET ^TMP("DG53376",$JOB,NODE)=TEXT
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+48 ;
MAIL1 DO ^XMD
+1 KILL ^TMP("DG53376",$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)