RGUTALR ;CAIRO/DKM - Send alert to user(s) via kernel or mail;04-Sep-1998 11:26;DKM
 ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
 ;=================================================================
 ; Send an alert.
 ;   XQAMSG = Message to send
 ;   RGUSR  = A semicolon-delimited list of users to receive alert.
 ;=================================================================
ALERT(XQAMSG,RGUSR) ;
 N XQA,XQAOPT,XQAFLG,XQAROU,XQADATA,XQAID
 S @$$TRAP^RGZOSF("EXIT^RGUTALR"),RGUSR=$G(RGUSR,"*"),XQAMSG=$TR(XQAMSG,U,"~")
 D ENTRY^RGUTUSR(RGUSR,.XQA),SETUP^XQALERT:$D(XQA)
EXIT Q
 ;=================================================================
 ; Send a mail message
 ;   RGMSG  = Message to send (single node or array)
 ;   XMY    = A semicolon-delimited list (or array) of users
 ;   XMSUB  = Subject line (optional)
 ;   XMDUZ  = DUZ of sender (optional)
 ;=================================================================
MAIL(RGMSG,XMY,XMSUB,XMDUZ) ;
 N XMTEXT
 S:$D(RGMSG)=1 RGMSG(1)=RGMSG
 S XMTEXT="RGMSG(",@$$TRAP^RGZOSF("EXIT^RGUTALR"),XMY=$G(XMY)
 S:$G(XMSUB)="" XMSUB=RGMSG
 S:$G(XMDUZ)="" XMDUZ=$G(DUZ)
 F  Q:'$L(XMY)  S X=$P(XMY,";"),XMY=$P(XMY,";",2,999) S:$L(X) XMY(X)=""
 D ^XMD:$D(XMY)>9
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRGUTALR   1236     printed  Sep 23, 2025@20:13:30                                                                                                                                                                                                     Page 2
RGUTALR   ;CAIRO/DKM - Send alert to user(s) via kernel or mail;04-Sep-1998 11:26;DKM
 +1       ;;2.1;RUN TIME LIBRARY;;Mar 22, 1999
 +2       ;=================================================================
 +3       ; Send an alert.
 +4       ;   XQAMSG = Message to send
 +5       ;   RGUSR  = A semicolon-delimited list of users to receive alert.
 +6       ;=================================================================
ALERT(XQAMSG,RGUSR) ;
 +1        NEW XQA,XQAOPT,XQAFLG,XQAROU,XQADATA,XQAID
 +2        SET @$$TRAP^RGZOSF("EXIT^RGUTALR")
           SET RGUSR=$GET(RGUSR,"*")
           SET XQAMSG=$TRANSLATE(XQAMSG,U,"~")
 +3        DO ENTRY^RGUTUSR(RGUSR,.XQA)
           if $DATA(XQA)
               DO SETUP^XQALERT
EXIT       QUIT 
 +1       ;=================================================================
 +2       ; Send a mail message
 +3       ;   RGMSG  = Message to send (single node or array)
 +4       ;   XMY    = A semicolon-delimited list (or array) of users
 +5       ;   XMSUB  = Subject line (optional)
 +6       ;   XMDUZ  = DUZ of sender (optional)
 +7       ;=================================================================
MAIL(RGMSG,XMY,XMSUB,XMDUZ) ;
 +1        NEW XMTEXT
 +2        if $DATA(RGMSG)=1
               SET RGMSG(1)=RGMSG
 +3        SET XMTEXT="RGMSG("
           SET @$$TRAP^RGZOSF("EXIT^RGUTALR")
           SET XMY=$GET(XMY)
 +4        if $GET(XMSUB)=""
               SET XMSUB=RGMSG
 +5        if $GET(XMDUZ)=""
               SET XMDUZ=$GET(DUZ)
 +6        FOR 
               if '$LENGTH(XMY)
                   QUIT 
               SET X=$PIECE(XMY,";")
               SET XMY=$PIECE(XMY,";",2,999)
               if $LENGTH(X)
                   SET XMY(X)=""
 +7        if $DATA(XMY)>9
               DO ^XMD
 +8        QUIT