FSCNMS ;SLC/STAFF NOIS Notification Mail Send ;1/13/98  13:55
 ;;1.1;NOIS;;Sep 06, 1998
 ;
MAIL(XMSUB) ; from FSCLMPNN
 Q:'$D(XMSUB)  I XMSUB[U S XMSUB=$$REPLACE^FSCRU(XMSUB,U,"~U~")
 N CNT,DIR,LINE,XMTEXT,XMY,Y K DIR,XMY,XMZ,^TMP("FSC MAIL",$J),^TMP("FSC TEXT",$J)
 S DIR(0)="YAO",DIR("A")="Do you want to load the list document into the message? ",DIR("B")="NO"
 S DIR("?",1)="Enter YES to load the display into the message."
 S DIR("?",2)="Enter NO to just send a message without the display."
 S DIR("?",3)="When loading the display into the message, you can later edit the message"
 S DIR("?",4)="before sending.  Be aware that displays may have edited information."
 S DIR("?")="^D HELP^FSCU(.DIR)"
 S DIR("??")="FSC U1 NOIS"
 D ^DIR K DIR
 I $D(DIRUT) Q
 D
 .I Y D  Q
 ..S ^TMP("FSC MAIL",$J,1,0)=" "
 ..S ^TMP("FSC MAIL",$J,2,0)="     *** NOIS INFORMATION ***"
 ..S CNT=2 I $G(FSCCALLS)="EVALUES" S ^TMP("FSC MAIL",$J,3,0)=$G(VALMHDR(1)),CNT=3
 ..S LINE=0 F  S LINE=$O(@VALMAR@(LINE)) Q:LINE<1  S CNT=CNT+1,^TMP("FSC MAIL",$J,CNT,0)=^(LINE,0)
 ..D EDITWP^FSCEU("^TMP(""FSC MAIL"",$J)","You may edit this message.")
 .D WP^FSCEU("MAIL","Enter your mail message.")
 S XMTEXT=""
 I $O(^TMP("FSC MAIL",$J,0)) S XMTEXT="^TMP(""FSC MAIL"",$J,"
 I $O(^TMP("FSC TEXT",$J,"MAIL",0)) S XMTEXT="^TMP(""FSC TEXT"",$J,""MAIL"","
 I '$L(XMTEXT) Q
 D EN^XM W !,"This message will be sent to you." S XMY(DUZ)="" D DES^XMA21
 I '$D(XMY) Q
 N DIR,Y K DIR
 S DIR(0)="YAO",DIR("A")="Send notification message: ",DIR("B")="YES"
 S DIR("?",1)="Enter YES to send this message."
 S DIR("?",2)="Enter NO or '^' to exit without sending the message, '??' for more help."
 S DIR("?")="^D HELP^FSCU(.DIR)"
 S DIR("??")="FSC U1 NOIS"
 D ^DIR K DIR
 I $D(DIRUT) Q
 I Y'=1 Q
 D ^XMD I $G(XMZ) W !,"Message #",XMZ," sent." H 2
 D KILL^XM K ^TMP("FSC MAIL",$J),^TMP("FSC TEXT",$J)
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HFSCNMS   1899     printed  Sep 23, 2025@19:55:03                                                                                                                                                                                                      Page 2
FSCNMS    ;SLC/STAFF NOIS Notification Mail Send ;1/13/98  13:55
 +1       ;;1.1;NOIS;;Sep 06, 1998
 +2       ;
MAIL(XMSUB) ; from FSCLMPNN
 +1        if '$DATA(XMSUB)
               QUIT 
           IF XMSUB[U
               SET XMSUB=$$REPLACE^FSCRU(XMSUB,U,"~U~")
 +2        NEW CNT,DIR,LINE,XMTEXT,XMY,Y
           KILL DIR,XMY,XMZ,^TMP("FSC MAIL",$JOB),^TMP("FSC TEXT",$JOB)
 +3        SET DIR(0)="YAO"
           SET DIR("A")="Do you want to load the list document into the message? "
           SET DIR("B")="NO"
 +4        SET DIR("?",1)="Enter YES to load the display into the message."
 +5        SET DIR("?",2)="Enter NO to just send a message without the display."
 +6        SET DIR("?",3)="When loading the display into the message, you can later edit the message"
 +7        SET DIR("?",4)="before sending.  Be aware that displays may have edited information."
 +8        SET DIR("?")="^D HELP^FSCU(.DIR)"
 +9        SET DIR("??")="FSC U1 NOIS"
 +10       DO ^DIR
           KILL DIR
 +11       IF $DATA(DIRUT)
               QUIT 
 +12       Begin DoDot:1
 +13           IF Y
                   Begin DoDot:2
 +14                   SET ^TMP("FSC MAIL",$JOB,1,0)=" "
 +15                   SET ^TMP("FSC MAIL",$JOB,2,0)="     *** NOIS INFORMATION ***"
 +16                   SET CNT=2
                       IF $GET(FSCCALLS)="EVALUES"
                           SET ^TMP("FSC MAIL",$JOB,3,0)=$GET(VALMHDR(1))
                           SET CNT=3
 +17                   SET LINE=0
                       FOR 
                           SET LINE=$ORDER(@VALMAR@(LINE))
                           if LINE<1
                               QUIT 
                           SET CNT=CNT+1
                           SET ^TMP("FSC MAIL",$JOB,CNT,0)=^(LINE,0)
 +18                   DO EDITWP^FSCEU("^TMP(""FSC MAIL"",$J)","You may edit this message.")
                   End DoDot:2
                   QUIT 
 +19           DO WP^FSCEU("MAIL","Enter your mail message.")
           End DoDot:1
 +20       SET XMTEXT=""
 +21       IF $ORDER(^TMP("FSC MAIL",$JOB,0))
               SET XMTEXT="^TMP(""FSC MAIL"",$J,"
 +22       IF $ORDER(^TMP("FSC TEXT",$JOB,"MAIL",0))
               SET XMTEXT="^TMP(""FSC TEXT"",$J,""MAIL"","
 +23       IF '$LENGTH(XMTEXT)
               QUIT 
 +24       DO EN^XM
           WRITE !,"This message will be sent to you."
           SET XMY(DUZ)=""
           DO DES^XMA21
 +25       IF '$DATA(XMY)
               QUIT 
 +26       NEW DIR,Y
           KILL DIR
 +27       SET DIR(0)="YAO"
           SET DIR("A")="Send notification message: "
           SET DIR("B")="YES"
 +28       SET DIR("?",1)="Enter YES to send this message."
 +29       SET DIR("?",2)="Enter NO or '^' to exit without sending the message, '??' for more help."
 +30       SET DIR("?")="^D HELP^FSCU(.DIR)"
 +31       SET DIR("??")="FSC U1 NOIS"
 +32       DO ^DIR
           KILL DIR
 +33       IF $DATA(DIRUT)
               QUIT 
 +34       IF Y'=1
               QUIT 
 +35       DO ^XMD
           IF $GET(XMZ)
               WRITE !,"Message #",XMZ," sent."
               HANG 2
 +36       DO KILL^XM
           KILL ^TMP("FSC MAIL",$JOB),^TMP("FSC TEXT",$JOB)
 +37       QUIT