PSN134P ;BIR/DMA-find interactions that weren't sent ; 29 Mar 2007  11:39 AM
 ;;4.0; NATIONAL DRUG FILE;**134**; 30 Oct 98;Build 19
 ;
 ;Reads to the AUDIT file (#1.1), ^DIA, supported by DBIA #2602
 ;
 N HERE,LINE,PSN,PSN1,PSN2,PSN3,PSN4,PSNIIEN,PSNFLTY,XMDUZ,XMSUB,XMTEXT,XMY,Y
 S LINE=6 K HERE
 S PSNIIEN=$$KSP^XUPARAM("INST"),PSNFLTY=$$GET1^DIQ(4,PSNIIEN,.01)
 S PSN=$Q(^DIA(56,"C",3061026)) I $QS(PSN,2)'="C" S HERE(1,0)="There were no interactions created at "_PSNFLTY_" after 26 October 2006." G SEND
 S PSN=$QS(PSN,4) F  S PSN=$O(^DIA(56,PSN)) Q:'PSN  S PSN1=^(PSN,0) I $P(PSN1,"^",5)="A",PSN1>14999 Q
 I 'PSN S HERE(1,0)="There were no interactions created at "_PSNFLTY_" after 26 October 2006." G SEND
 S PSN1=+PSN1-1 F  S PSN1=$O(^PS(56,PSN1)) Q:'PSN1  S PSN2=^(PSN1,0),PSN3=$P(PSN2,"^"),PSN4=$P(PSN2,"^",4),$E(PSN3,70)=" "_$S(PSN4=1:"Crit",1:"Signif"),HERE(LINE,0)=PSN3,LINE=LINE+1
  I '$D(HERE) S HERE(1,0)="There were no interactions created at "_PSNFLTY_" after 26 October 2006." G SEND
 S HERE(1,0)="The following interactions were created at "_PSNFLTY_" after 26 October 2006.",HERE(2,0)=" ",HERE(3,0)="INTERACTION",$E(HERE(3,0),70)="SEVERITY",HERE(4,0)="===========",$E(HERE(4,0),70)="========",HERE(5,0)=" "
 ;
SEND ;
 S XMDUZ=DUZ K XMY
 X ^%ZOSF("UCI") S PSN=^%ZOSF("PROD") S:PSN'["," Y=$P(Y,",") I Y=PSN S XMY("G.NDF SUPPORT@ISCPNDF.FO-BIRM.DOMAIN.EXT")=""
 S XMY("G.NDF DATA@"_^XMB("NETNAME"))=""
 S PSN=0 F  S PSN=$O(^XUSEC("PSNMGR",PSN)) Q:'PSN  S XMY(PSN)=""
 I $D(DUZ) S XMY(DUZ)=""
 S XMSUB="Local Drug Interactions Added at "_PSNFLTY_" since 26 Oct 2006."
 S XMTEXT="HERE(" N DIFROM D ^XMD
QUIT K HERE,LINE,PSN,PSN1,PSN2,PSN3,PSN4,PSNIIEN,PSNFLTY,XMDUZ,XMSUB,XMTEXT,XMY,Y
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSN134P   1724     printed  Sep 23, 2025@19:52:49                                                                                                                                                                                                     Page 2
PSN134P   ;BIR/DMA-find interactions that weren't sent ; 29 Mar 2007  11:39 AM
 +1       ;;4.0; NATIONAL DRUG FILE;**134**; 30 Oct 98;Build 19
 +2       ;
 +3       ;Reads to the AUDIT file (#1.1), ^DIA, supported by DBIA #2602
 +4       ;
 +5        NEW HERE,LINE,PSN,PSN1,PSN2,PSN3,PSN4,PSNIIEN,PSNFLTY,XMDUZ,XMSUB,XMTEXT,XMY,Y
 +6        SET LINE=6
           KILL HERE
 +7        SET PSNIIEN=$$KSP^XUPARAM("INST")
           SET PSNFLTY=$$GET1^DIQ(4,PSNIIEN,.01)
 +8        SET PSN=$QUERY(^DIA(56,"C",3061026))
           IF $QSUBSCRIPT(PSN,2)'="C"
               SET HERE(1,0)="There were no interactions created at "_PSNFLTY_" after 26 October 2006."
               GOTO SEND
 +9        SET PSN=$QSUBSCRIPT(PSN,4)
           FOR 
               SET PSN=$ORDER(^DIA(56,PSN))
               if 'PSN
                   QUIT 
               SET PSN1=^(PSN,0)
               IF $PIECE(PSN1,"^",5)="A"
                   IF PSN1>14999
                       QUIT 
 +10       IF 'PSN
               SET HERE(1,0)="There were no interactions created at "_PSNFLTY_" after 26 October 2006."
               GOTO SEND
 +11       SET PSN1=+PSN1-1
           FOR 
               SET PSN1=$ORDER(^PS(56,PSN1))
               if 'PSN1
                   QUIT 
               SET PSN2=^(PSN1,0)
               SET PSN3=$PIECE(PSN2,"^")
               SET PSN4=$PIECE(PSN2,"^",4)
               SET $EXTRACT(PSN3,70)=" "_$SELECT(PSN4=1:"Crit",1:"Signif")
               SET HERE(LINE,0)=PSN3
               SET LINE=LINE+1
 +12       IF '$DATA(HERE)
               SET HERE(1,0)="There were no interactions created at "_PSNFLTY_" after 26 October 2006."
               GOTO SEND
 +13       SET HERE(1,0)="The following interactions were created at "_PSNFLTY_" after 26 October 2006."
           SET HERE(2,0)=" "
           SET HERE(3,0)="INTERACTION"
           SET $EXTRACT(HERE(3,0),70)="SEVERITY"
           SET HERE(4,0)="==========="
           SET $EXTRACT(HERE(4,0),70)="========"
           SET HERE(5,0)=" "
 +14      ;
SEND      ;
 +1        SET XMDUZ=DUZ
           KILL XMY
 +2        XECUTE ^%ZOSF("UCI")
           SET PSN=^%ZOSF("PROD")
           if PSN'[","
               SET Y=$PIECE(Y,",")
           IF Y=PSN
               SET XMY("G.NDF SUPPORT@ISCPNDF.FO-BIRM.DOMAIN.EXT")=""
 +3        SET XMY("G.NDF DATA@"_^XMB("NETNAME"))=""
 +4        SET PSN=0
           FOR 
               SET PSN=$ORDER(^XUSEC("PSNMGR",PSN))
               if 'PSN
                   QUIT 
               SET XMY(PSN)=""
 +5        IF $DATA(DUZ)
               SET XMY(DUZ)=""
 +6        SET XMSUB="Local Drug Interactions Added at "_PSNFLTY_" since 26 Oct 2006."
 +7        SET XMTEXT="HERE("
           NEW DIFROM
           DO ^XMD
QUIT       KILL HERE,LINE,PSN,PSN1,PSN2,PSN3,PSN4,PSNIIEN,PSNFLTY,XMDUZ,XMSUB,XMTEXT,XMY,Y