PSOTPENV ;BIR/RTR-Patch 146 Environment Check routine ;07/27/03
 ;;7.0;OUTPATIENT PHARMACY;**146**;DEC 1997
 ;External reference to 4.2 supported by DBIA 3779
 ;
 ;Check for Domain
 N DIR,DIC,DA,X,Y
 K DIC S DIC(0)="X",DIC=4.2,X="TPB-AUSTIN.DOMAIN.EXT" D ^DIC K DIC
 I +Y'>0 W !!,"Aborting Install!",!,"You will need to create a domain name of 'TPB-AUSTIN.DOMAIN.EXT' for the",!,"HL7 extracts of TPB Patient information. See patch 'XM*DBA*155' for details." D  S XPDABORT=2 Q
 .W ! K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR K DIR
 K Y
 ;
 I $$PATCH^XPDUTL("PSO*7.0*146") G SUB
 N PSOTPLL,DIR
 S PSOTPLL="" F  S PSOTPLL=$O(^PS(53,"B",PSOTPLL)) Q:PSOTPLL=""!($G(XPDABORT)=2)  D
 .I $$UP^XLFSTR(PSOTPLL)="NON-VA" S XPDABORT=2 D
 ..W !!,"You already have an entry in the RX PATIENT STATUS File (#53) named 'NON-VA'.",!,"This patch exports an entry with that same name, so the current entry",!,"must be changed using VA FileMan, before this patch can be installed.",!
 ..K DIR S DIR(0)="E",DIR("A")="Press Return to Continue" D ^DIR S XPDABORT=2 K DIR
 I $G(XPDABORT)=2 Q
SUB ;For multiple installs
 Q:'$G(XPDENV)
 W ! K %DT D NOW^%DTC S %DT="RAEX",%DT(0)=%,%DT("A")="Queue the Post-Install to run at what Date@Time: "
 D ^%DT K %DT I $D(DTOUT)!(Y<0) W !!,"Cannot install the patch without queuing the post-install, install aborted!",! S XPDABORT=2 Q
 S @XPDGREF@("PSOQ146")=Y
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPSOTPENV   1419     printed  Sep 23, 2025@20:12:19                                                                                                                                                                                                    Page 2
PSOTPENV  ;BIR/RTR-Patch 146 Environment Check routine ;07/27/03
 +1       ;;7.0;OUTPATIENT PHARMACY;**146**;DEC 1997
 +2       ;External reference to 4.2 supported by DBIA 3779
 +3       ;
 +4       ;Check for Domain
 +5        NEW DIR,DIC,DA,X,Y
 +6        KILL DIC
           SET DIC(0)="X"
           SET DIC=4.2
           SET X="TPB-AUSTIN.DOMAIN.EXT"
           DO ^DIC
           KILL DIC
 +7        IF +Y'>0
               WRITE !!,"Aborting Install!",!,"You will need to create a domain name of 'TPB-AUSTIN.DOMAIN.EXT' for the",!,"HL7 extracts of TPB Patient information. See patch 'XM*DBA*155' for details."
               Begin DoDot:1
 +8                WRITE !
                   KILL DIR
                   SET DIR(0)="E"
                   SET DIR("A")="Press Return to Continue"
                   DO ^DIR
                   KILL DIR
               End DoDot:1
               SET XPDABORT=2
               QUIT 
 +9        KILL Y
 +10      ;
 +11       IF $$PATCH^XPDUTL("PSO*7.0*146")
               GOTO SUB
 +12       NEW PSOTPLL,DIR
 +13       SET PSOTPLL=""
           FOR 
               SET PSOTPLL=$ORDER(^PS(53,"B",PSOTPLL))
               if PSOTPLL=""!($GET(XPDABORT)=2)
                   QUIT 
               Begin DoDot:1
 +14               IF $$UP^XLFSTR(PSOTPLL)="NON-VA"
                       SET XPDABORT=2
                       Begin DoDot:2
 +15                       WRITE !!,"You already have an entry in the RX PATIENT STATUS File (#53) named 'NON-VA'.",!,"This patch exports an entry with that same name, so the current entry",!,"must be changed using VA FileMan, before this patch can be ins
talled.",!
 +16                       KILL DIR
                           SET DIR(0)="E"
                           SET DIR("A")="Press Return to Continue"
                           DO ^DIR
                           SET XPDABORT=2
                           KILL DIR
                       End DoDot:2
               End DoDot:1
 +17       IF $GET(XPDABORT)=2
               QUIT 
SUB       ;For multiple installs
 +1        if '$GET(XPDENV)
               QUIT 
 +2        WRITE !
           KILL %DT
           DO NOW^%DTC
           SET %DT="RAEX"
           SET %DT(0)=%
           SET %DT("A")="Queue the Post-Install to run at what Date@Time: "
 +3        DO ^%DT
           KILL %DT
           IF $DATA(DTOUT)!(Y<0)
               WRITE !!,"Cannot install the patch without queuing the post-install, install aborted!",!
               SET XPDABORT=2
               QUIT 
 +4        SET @XPDGREF@("PSOQ146")=Y
 +5        QUIT