YSKFMAIL ;16IT/BL - SUBSTANCE ABUSE ;6/20/01 20:47
;;5.01;MENTAL HEALTH;**73**;Dec 30, 1994
MAIL ; SEND REPORT IN MAILMAN
S DTIME=600
I $D(YSKFEQST) G MAIL2
S XMSUB=$P(YSKFSITE,U,1)_" "_YSKFDIS_" RPT ("_$E(YSKFBDT,4,5)_"/"_$E(YSKFBDT,6,7)_"/"_$E(YSKFBDT,2,3)_"-"_$E(YSKFEDT,4,5)_"/"_$E(YSKFEDT,6,7)_"/"_$E(YSKFEDT,2,3)_")"
S XMTEXT="^TMP($J,"
I YSKFMG="Y"!(YSKFMG="y") D
.I $G(YSKFMHFG)=1 S XMY("G.YS ASI PERFORMANCE MEASURES")=""
S XMY(DUZ)=""
S XMDUZ="AUTOMATED MESSAGE"
D ^XMD
MAIL2 ; SEND DATASET MAILMAN
I (YSKFZZ="Y")!(YSKFZZ="y") D
.S YSKFMCNT=0,YSKFMTC=(YSKFJCNT\1000)+1
.S (YSKFCNT,YSKFCNT2)=0 F S YSKFCNT=$O(^TMP("XM",$J,YSKFCNT)) Q:(YSKFCNT'>0) D
..S YSKFCNT2=YSKFCNT2+1,^TMP("M",$J,YSKFCNT)=^TMP("XM",$J,YSKFCNT)
..I (YSKFCNT2=1000)!(YSKFCNT=YSKFJCNT) D
...S YSKFMCNT=YSKFMCNT+1
...S DTIME=600
...S XMSUB=$P(YSKFSITE,U,1)_" "_YSKFDIS_" DATA ("_$E(YSKFBDT,4,5)_"/"_$E(YSKFBDT,6,7)_"/"_$E(YSKFBDT,2,3)_"-"_$E(YSKFEDT,4,5)_"/"_$E(YSKFEDT,6,7)_"/"_$E(YSKFEDT,2,3)_")"_" "_YSKFMCNT_" OF "_YSKFMTC
...S XMTEXT="^TMP(""M"",$J,"
...I YSKFMG="Y"!(YSKFMG="y") D
....I $G(YSKFMHFG)=1 S XMY("G.YS ASI PERFORMANCE MEASURES")=""
...S XMY(DUZ)=""
...S XMDUZ="AUTOMATED MESSAGE"
...D ^XMD
...S YSKFCNT2=0
...K ^TMP("M",$J)
.I $D(^TMP("XM",$J,"ALC")) D
..S YSKFMCNT=0,YSKFMTC=(YSKFJCNT\1000)+1
..S YSKFCNT=0,YSKFCNT2=0 F S YSKFCNT=$O(^TMP("XM",$J,"ALC",YSKFCNT)) Q:YSKFCNT'>0 D
...S YSKFCNT2=YSKFCNT2+1,^TMP("M",$J,YSKFCNT)=^TMP("XM",$J,"ALC",YSKFCNT)
...I (YSKFCNT2=1000)!(YSKFCNT=YSKFJCNT) D
....S YSKFMCNT=YSKFMCNT+1
....S DTIME=600
....S XMSUB=$P(YSKFSITE,U,1)_" "_YSKFDIS_" DATA ("_$E(YSKFBDT,4,5)_"/"_$E(YSKFBDT,6,7)_"/"_$E(YSKFBDT,2,3)_"-"_$E(YSKFEDT,4,5)_"/"_$E(YSKFEDT,6,7)_"/"_$E(YSKFEDT,2,3)_")"_" "_YSKFMCNT_" OF "_YSKFMTC
....S XMTEXT="^TMP(""M"",$J,"
....I YSKFMG="Y"!(YSKFMG="y") D
.....I $G(YSKFMHFG)=1 S XMY("G.YS ASI PERFORMANCE MEASURES")="" ;if from MH monthly menu
....S XMY(DUZ)=""
....S XMDUZ="AUTOMATED MESSAGE"
....D ^XMD
....S YSKFCNT2=0
....K ^TMP("M",$J)
KILL ;KILL MAIL VARIABLES
S DTIME=$$DTIME^XUP(DUZ)
K XMSUB,XMTEXT,XMY,XMDUZ,^TMP($J),^TMP("XM",$J),^TMP("M",$J),^TMP("XN",$J),^TMP("XN1",$J),^TMP("YSKF",$J),YSKFMCNT,YSKFCNT,YSKFCNT2,YSKFMTC,^TMP("XN2",$J),^TMP("YSKFY",$J),^UTILITY($J)
D KILL^XM
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HYSKFMAIL 2329 printed Dec 13, 2024@02:14:38 Page 2
YSKFMAIL ;16IT/BL - SUBSTANCE ABUSE ;6/20/01 20:47
+1 ;;5.01;MENTAL HEALTH;**73**;Dec 30, 1994
MAIL ; SEND REPORT IN MAILMAN
+1 SET DTIME=600
+2 IF $DATA(YSKFEQST)
GOTO MAIL2
+3 SET XMSUB=$PIECE(YSKFSITE,U,1)_" "_YSKFDIS_" RPT ("_$EXTRACT(YSKFBDT,4,5)_"/"_$EXTRACT(YSKFBDT,6,7)_"/"_$EXTRACT(YSKFBDT,2,3)_"-"_$EXTRACT(YSKFEDT,4,5)_"/"_$EXTRACT(YSKFEDT,6,7)_"/"_$EXTRACT(YSKFEDT,2,3)_")"
+4 SET XMTEXT="^TMP($J,"
+5 IF YSKFMG="Y"!(YSKFMG="y")
Begin DoDot:1
+6 IF $GET(YSKFMHFG)=1
SET XMY("G.YS ASI PERFORMANCE MEASURES")=""
End DoDot:1
+7 SET XMY(DUZ)=""
+8 SET XMDUZ="AUTOMATED MESSAGE"
+9 DO ^XMD
MAIL2 ; SEND DATASET MAILMAN
+1 IF (YSKFZZ="Y")!(YSKFZZ="y")
Begin DoDot:1
+2 SET YSKFMCNT=0
SET YSKFMTC=(YSKFJCNT\1000)+1
+3 SET (YSKFCNT,YSKFCNT2)=0
FOR
SET YSKFCNT=$ORDER(^TMP("XM",$JOB,YSKFCNT))
if (YSKFCNT'>0)
QUIT
Begin DoDot:2
+4 SET YSKFCNT2=YSKFCNT2+1
SET ^TMP("M",$JOB,YSKFCNT)=^TMP("XM",$JOB,YSKFCNT)
+5 IF (YSKFCNT2=1000)!(YSKFCNT=YSKFJCNT)
Begin DoDot:3
+6 SET YSKFMCNT=YSKFMCNT+1
+7 SET DTIME=600
+8 SET XMSUB=$PIECE(YSKFSITE,U,1)_" "_YSKFDIS_" DATA ("_$EXTRACT(YSKFBDT,4,5)_"/"_$EXTRACT(YSKFBDT,6,7)_"/"_$EXTRACT(YSKFBDT,2,3)_"-"_$EXTRACT(YSKFEDT,4,5)_"/"_$EXTRACT(YSKFEDT,6,7)_"/"_$EXTRACT(YSKFEDT,2,3)_")"_" "_YSKFMCN
T_" OF "_YSKFMTC
+9 SET XMTEXT="^TMP(""M"",$J,"
+10 IF YSKFMG="Y"!(YSKFMG="y")
Begin DoDot:4
+11 IF $GET(YSKFMHFG)=1
SET XMY("G.YS ASI PERFORMANCE MEASURES")=""
End DoDot:4
+12 SET XMY(DUZ)=""
+13 SET XMDUZ="AUTOMATED MESSAGE"
+14 DO ^XMD
+15 SET YSKFCNT2=0
+16 KILL ^TMP("M",$JOB)
End DoDot:3
End DoDot:2
+17 IF $DATA(^TMP("XM",$JOB,"ALC"))
Begin DoDot:2
+18 SET YSKFMCNT=0
SET YSKFMTC=(YSKFJCNT\1000)+1
+19 SET YSKFCNT=0
SET YSKFCNT2=0
FOR
SET YSKFCNT=$ORDER(^TMP("XM",$JOB,"ALC",YSKFCNT))
if YSKFCNT'>0
QUIT
Begin DoDot:3
+20 SET YSKFCNT2=YSKFCNT2+1
SET ^TMP("M",$JOB,YSKFCNT)=^TMP("XM",$JOB,"ALC",YSKFCNT)
+21 IF (YSKFCNT2=1000)!(YSKFCNT=YSKFJCNT)
Begin DoDot:4
+22 SET YSKFMCNT=YSKFMCNT+1
+23 SET DTIME=600
+24 SET XMSUB=$PIECE(YSKFSITE,U,1)_" "_YSKFDIS_" DATA ("_$EXTRACT(YSKFBDT,4,5)_"/"_$EXTRACT(YSKFBDT,6,7)_"/"_$EXTRACT(YSKFBDT,2,3)_"-"_$EXTRACT(YSKFEDT,4,5)_"/"_$EXTRACT(YSKFEDT,6,7)_"/"_$EXTRACT(YSKFEDT,2,3)_")"_" "
_YSKFMCNT_" OF "_YSKFMTC
+25 SET XMTEXT="^TMP(""M"",$J,"
+26 IF YSKFMG="Y"!(YSKFMG="y")
Begin DoDot:5
+27 ;if from MH monthly menu
IF $GET(YSKFMHFG)=1
SET XMY("G.YS ASI PERFORMANCE MEASURES")=""
End DoDot:5
+28 SET XMY(DUZ)=""
+29 SET XMDUZ="AUTOMATED MESSAGE"
+30 DO ^XMD
+31 SET YSKFCNT2=0
+32 KILL ^TMP("M",$JOB)
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
KILL ;KILL MAIL VARIABLES
+1 SET DTIME=$$DTIME^XUP(DUZ)
+2 KILL XMSUB,XMTEXT,XMY,XMDUZ,^TMP($JOB),^TMP("XM",$JOB),^TMP("M",$JOB),^TMP("XN",$JOB),^TMP("XN1",$JOB),^TMP("YSKF",$JOB),YSKFMCNT,YSKFCNT,YSKFCNT2,YSKFMTC,^TMP("XN2",$JOB),^TMP("YSKFY",$JOB),^UTILITY($JOB)
+3 DO KILL^XM
+4 QUIT