XU8P246 ;ALB/BRM - XU*8*246 ENVIRONMENT CHK AND PREINSTALL ; 11/22/02 8:28am
 ;;8.0;KERNEL;**246**;Jul 10, 1995
 ;
 ; This routine is executed from the top for the environment check
 ; portion of the install.  The PRE tag is not executed as part of the
 ; ENVCHK process.
 ;
ENVCHK ;  Environment check to ensure the^DD(5.12,0,"UP") node does
 ; not exist prior to installation.  This node was found to have
 ; been defined in one of our test accounts.  The following check
 ; is covered by DBIA#3518.
 ;
 ; ensure that the ^XIP global has been initialized
 I '$D(^XIP) D  Q
 .D BMES^XPDUTL("     *******************************************************")
 .D MES^XPDUTL("              WARNING:  ^XIP global not initialized!")
 .D BMES^XPDUTL("       Please see the Pre-installation Instructions in the")
 .D MES^XPDUTL("         patch description for initialization instructions.")
 .D BMES^XPDUTL("                 >>>> Installation aborted <<<<")
 .D BMES^XPDUTL("     *******************************************************")
 .S XPDQUIT=2  ;terminate installation.
 ;
 ; check for UP node in the DD file
 Q:'$D(^DD(5.12,0,"UP"))
 D BMES^XPDUTL("     *******************************************************")
 D MES^XPDUTL("           Invalid Data Dictionary entry for file #5.12!")
 D BMES^XPDUTL("                Please contact NVS for assistance.")
 D BMES^XPDUTL("                  >>>> Installation aborted <<<<")
 D BMES^XPDUTL("     *******************************************************")
 S XPDQUIT=2  ;terminate installation.
 Q
 ;
PRE ; The PRE tag is meant to be run as a pre-install to
 ; patch XU*8*246.  It will add several missing county
 ; codes to the county sub-file within the state (#5) file.
 ; The following counties will be added:
 ;
 ; STATE  IEN     COUNTY NAME       COUNTY CODE
 ; MO     29      St Louis City         510
 ; NM     35      San Miguel            047
 ; VA     51      Manassas City         683
 ; VA     51      Manassas Park         685
 ; VA     51      Poquoson City         735
 ; AK      2      Skagway Yakutat Ango  231
 ; AZ      4      La Paz                012
 ;
 N FDA,TAG,CNTYDAT,CNTYNAM,CNTYCOD,ST,MSG,ERRMSG,DIERR
 D BMES^XPDUTL("*** Adding missing counties to the State file ***")
 F TAG="AK","AZ","MO","NM","VA1","VA2","VA3" D
 .S ST=$E(TAG,1,2)
 .S CNTYDAT=$P($T(@TAG),";;",2)
 .S CNTYNAM=$P(CNTYDAT,"^"),CNTYCOD=$P(CNTYDAT,"^",2)
 .S MSG="**ERROR: Missing or Corrupt State: "_ST_". This process could not add "_CNTYNAM
 .I '$D(^DIC(5,"C",ST)) D BMES^XPDUTL(MSG) Q
 .S IEN5=$O(^DIC(5,"C",ST,""))
 .I '+IEN5!'$D(^DIC(5,IEN5,1)) D BMES^XPDUTL(MSG) Q
 .I $D(^DIC(5,IEN5,1,"C",CNTYCOD)) D BMES^XPDUTL(CNTYNAM_", "_ST_" already exists - no action taken.") Q
 .S FDA(5.01,"+1,"_IEN5_",",.01)=CNTYNAM
 .S FDA(5.01,"+1,"_IEN5_",",2)=CNTYCOD
 .D UPDATE^DIE("","FDA","","ERRMSG")
 .I $D(ERRMSG) D BMES^XPDUTL("**ERROR: "_CNTYNAM_", "_ST_" was not added.") K ERRMSG,DIERR,CNTYDAT,CNTYNAM,IEN5 Q
 .D BMES^XPDUTL(CNTYNAM_", "_ST_" was added successfully.")
 .K CNTYDAT,CNTYNAM,IEN5
 Q
 ; pre-install data fields - DO NOT REMOVE!
AK ;;SKAGWAY YAKUTAT ANGO^231
AZ ;;LA PAZ^012
MO ;;ST LOUIS CITY^510
NM ;;SAN MIGUEL^047
VA1 ;;MANASSAS CITY^683
VA2 ;;MANASSAS PARK^685
VA3 ;;POQUOSON CITY^735
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXU8P246   3314     printed  Sep 23, 2025@19:43:10                                                                                                                                                                                                     Page 2
XU8P246   ;ALB/BRM - XU*8*246 ENVIRONMENT CHK AND PREINSTALL ; 11/22/02 8:28am
 +1       ;;8.0;KERNEL;**246**;Jul 10, 1995
 +2       ;
 +3       ; This routine is executed from the top for the environment check
 +4       ; portion of the install.  The PRE tag is not executed as part of the
 +5       ; ENVCHK process.
 +6       ;
ENVCHK    ;  Environment check to ensure the^DD(5.12,0,"UP") node does
 +1       ; not exist prior to installation.  This node was found to have
 +2       ; been defined in one of our test accounts.  The following check
 +3       ; is covered by DBIA#3518.
 +4       ;
 +5       ; ensure that the ^XIP global has been initialized
 +6        IF '$DATA(^XIP)
               Begin DoDot:1
 +7                DO BMES^XPDUTL("     *******************************************************")
 +8                DO MES^XPDUTL("              WARNING:  ^XIP global not initialized!")
 +9                DO BMES^XPDUTL("       Please see the Pre-installation Instructions in the")
 +10               DO MES^XPDUTL("         patch description for initialization instructions.")
 +11               DO BMES^XPDUTL("                 >>>> Installation aborted <<<<")
 +12               DO BMES^XPDUTL("     *******************************************************")
 +13      ;terminate installation.
                   SET XPDQUIT=2
               End DoDot:1
               QUIT 
 +14      ;
 +15      ; check for UP node in the DD file
 +16       if '$DATA(^DD(5.12,0,"UP"))
               QUIT 
 +17       DO BMES^XPDUTL("     *******************************************************")
 +18       DO MES^XPDUTL("           Invalid Data Dictionary entry for file #5.12!")
 +19       DO BMES^XPDUTL("                Please contact NVS for assistance.")
 +20       DO BMES^XPDUTL("                  >>>> Installation aborted <<<<")
 +21       DO BMES^XPDUTL("     *******************************************************")
 +22      ;terminate installation.
           SET XPDQUIT=2
 +23       QUIT 
 +24      ;
PRE       ; The PRE tag is meant to be run as a pre-install to
 +1       ; patch XU*8*246.  It will add several missing county
 +2       ; codes to the county sub-file within the state (#5) file.
 +3       ; The following counties will be added:
 +4       ;
 +5       ; STATE  IEN     COUNTY NAME       COUNTY CODE
 +6       ; MO     29      St Louis City         510
 +7       ; NM     35      San Miguel            047
 +8       ; VA     51      Manassas City         683
 +9       ; VA     51      Manassas Park         685
 +10      ; VA     51      Poquoson City         735
 +11      ; AK      2      Skagway Yakutat Ango  231
 +12      ; AZ      4      La Paz                012
 +13      ;
 +14       NEW FDA,TAG,CNTYDAT,CNTYNAM,CNTYCOD,ST,MSG,ERRMSG,DIERR
 +15       DO BMES^XPDUTL("*** Adding missing counties to the State file ***")
 +16       FOR TAG="AK","AZ","MO","NM","VA1","VA2","VA3"
               Begin DoDot:1
 +17               SET ST=$EXTRACT(TAG,1,2)
 +18               SET CNTYDAT=$PIECE($TEXT(@TAG),";;",2)
 +19               SET CNTYNAM=$PIECE(CNTYDAT,"^")
                   SET CNTYCOD=$PIECE(CNTYDAT,"^",2)
 +20               SET MSG="**ERROR: Missing or Corrupt State: "_ST_". This process could not add "_CNTYNAM
 +21               IF '$DATA(^DIC(5,"C",ST))
                       DO BMES^XPDUTL(MSG)
                       QUIT 
 +22               SET IEN5=$ORDER(^DIC(5,"C",ST,""))
 +23               IF '+IEN5!'$DATA(^DIC(5,IEN5,1))
                       DO BMES^XPDUTL(MSG)
                       QUIT 
 +24               IF $DATA(^DIC(5,IEN5,1,"C",CNTYCOD))
                       DO BMES^XPDUTL(CNTYNAM_", "_ST_" already exists - no action taken.")
                       QUIT 
 +25               SET FDA(5.01,"+1,"_IEN5_",",.01)=CNTYNAM
 +26               SET FDA(5.01,"+1,"_IEN5_",",2)=CNTYCOD
 +27               DO UPDATE^DIE("","FDA","","ERRMSG")
 +28               IF $DATA(ERRMSG)
                       DO BMES^XPDUTL("**ERROR: "_CNTYNAM_", "_ST_" was not added.")
                       KILL ERRMSG,DIERR,CNTYDAT,CNTYNAM,IEN5
                       QUIT 
 +29               DO BMES^XPDUTL(CNTYNAM_", "_ST_" was added successfully.")
 +30               KILL CNTYDAT,CNTYNAM,IEN5
               End DoDot:1
 +31       QUIT 
 +32      ; pre-install data fields - DO NOT REMOVE!
AK        ;;SKAGWAY YAKUTAT ANGO^231
AZ        ;;LA PAZ^012
MO        ;;ST LOUIS CITY^510
NM        ;;SAN MIGUEL^047
VA1       ;;MANASSAS CITY^683
VA2       ;;MANASSAS PARK^685
VA3       ;;POQUOSON CITY^735