LR565PST ;HDSO/DSK - LR*5.2*565 Post-install routine; Mar 21, 2023@14:00
 ;;5.2;LAB SERVICE;**565**;Sep 27, 1994;Build 7
 ;
 Q
 ;
EN ;
 ;This post-install routine for LR*5.2*565 will correct the spelling
 ;of "TRIMETHAPRIM" to "TRIMETHOPRIM" in several fields - if incorrect
 ;spelling exists.
 ;
 ;1. Delete the INTERNAL NAME (#5) field entry from the ANTIMICROBIAL
 ;   SUSCEPTIBILITY (#62.06) file entry for "TRIMETHAPRIM/SULFAMETHOXAZOLE"
 ;   and "TRIMETHAPRIMSULFAMETHOXAZOLE". (Not all sites have the second
 ;   misspelling without the "/".)
 ;
 ;2. In the ORGANISM (#63.3) sub-file of the MICROBIOLOGY (#5) sub-file of
 ;   the LAB DATA (#63) file, correct spellings for "TRIMETHAPRIM/SULFA INTERP",
 ;   "TRIMETHAPRIM/SULFA SCREEN", "TRIMETHAPRIM/SULFAMETHOXAZOLE" and
 ;   "TRIMETHAPRIMSULFAMETHOXAZOLE"
 ;
 ;3. Re-file the INTERNAL NAME(#5) field of the ANTIMICROBIAL SUSCEPTIBILITY
 ;   (#62.06) file entry from step 2.
 ;
 ;A MailMan message is sent to the installer and members of the LMI MailMan group
 ;for one of the following outcomes:
 ;
 ;1. File updates were performed successfully for files 62.06 and 63.3.
 ;   or
 ;2. No entries containing incorrect spelling currently exist, so no
 ;   corrections were needed by the post-install routine.
 ;
 ;The routine is not deleted after install because the backout section
 ;needs to remain.
 ;
 D BMES^XPDUTL($$CJ^XLFSTR("LR*5.2*565 post-install routine beginning....",80))
 ;
 N LRSEQ,LRLINE,LRDA633,LRDA6206,LRSAVE,LRMZ,LRSL,LRNOSL
 S LRSEQ=16
 ;Killing ^XTMP in case routine is run more than once during testing.
 K ^XTMP("LR*5.2*565 POST INSTALL")
 S ^XTMP("LR*5.2*565 POST INSTALL",0)=$$FMADD^XLFDT(DT,90)_"^"_DT_"^LR*5.2*565 POST INSTALL"
 S ^XTMP("LR*5.2*565 POST INSTALL",1)="If Laboratory files contained the incorrect spelling ""TRIMETHAPRIM/"
 S ^XTMP("LR*5.2*565 POST INSTALL",2)="SULFAMETHOXAZOLE"", the LR*5.2*565 post-install routine corrected the"
 S ^XTMP("LR*5.2*565 POST INSTALL",3)="spelling to ""TRIMETHOPRIM/SULFAMETHOXAZOLE""."
 S ^XTMP("LR*5.2*565 POST INSTALL",4)=" "
 S ^XTMP("LR*5.2*565 POST INSTALL",5)="Fields which were checked:"
 S ^XTMP("LR*5.2*565 POST INSTALL",6)=" "
 S ^XTMP("LR*5.2*565 POST INSTALL",7)="LAB DATA (#63) file, MICROBIOLOGY (#5) sub-file, ORGANISM (#63.3) sub-file"
 S ^XTMP("LR*5.2*565 POST INSTALL",8)="   TRIMETHOPRIM/SULFAMETHOXAZOLE (#75) field"
 S ^XTMP("LR*5.2*565 POST INSTALL",9)="   TRIMETHOPRIM/SULFA INTERP (#75.1) field"
 S ^XTMP("LR*5.2*565 POST INSTALL",10)="   TRIMETHOPRIM/SULFA SCREEN (#75.2) field"
 S ^XTMP("LR*5.2*565 POST INSTALL",11)=" "
 S ^XTMP("LR*5.2*565 POST INSTALL",12)="ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file"
 S ^XTMP("LR*5.2*565 POST INSTALL",13)="   ""C"" cross reference (points to field #75 in sub-file #63.3)"
 S ^XTMP("LR*5.2*565 POST INSTALL",14)=" "
 S ^XTMP("LR*5.2*565 POST INSTALL",15)="Results of post-install routine:"
 S ^XTMP("LR*5.2*565 POST INSTALL",16)="-------------------------------"
 D DEL6206,TRI633,F6206
 D MAIL,BMES
 Q
 ;
BMES ;
 D BMES^XPDUTL($$CJ^XLFSTR("LR*5.2*565 post-install routine complete.",80))
 D BMES^XPDUTL($$CJ^XLFSTR("MailMan message number #"_LRMZ_" sent to installer",80))
 D BMES^XPDUTL($$CJ^XLFSTR("and members of the LMI MailMan group.",80))
 Q
 ;
DEL6206 ;
 ;Several scenarios found at sites in the "C" cross reference:
 ;1. No misspellings found.
 ;2. Misspelling of "TRIMETHAPRIM/SULFAMETHOXAZOLE" found.
 ;3. Misspelling of "TRIMETHAPRIMSULFAMETHOXAZOLE" found.
 ;4. One or both of the above misspellings found.
 ;
 ;First, have to delete the field so that the incorrect "C" cross reference
 ;will be killed. The cross reference logic retrieves the current
 ;name from file 63.3 so simply refiling later will not kill the
 ;misspelled name.
 S LRSL=$O(^LAB(62.06,"C","TRIMETHAPRIM/SULFAMETHOXAZOLE",""))
 S LRNOSL=$O(^LAB(62.06,"C","TRIMETHAPRIMSULFAMETHOXAZOLE",""))
 ;Quit if no misspellings found.
 I 'LRSL,'LRNOSL D  Q
 . ;Save text so will display after file 63.3 message(s).
 . S LRSAVE(1)="Correction not needed in the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file"
 . S LRSAVE(2)="""C"" cross reference."
 . S LRSAVE(3)=" "
 ;Delete the current INTERNAL NAME entry.
 N LRHIT
 S LRHIT=0
 F LRDA6206=LRSL,LRNOSL I 'LRHIT,LRDA6206,$D(^LAB(62.06,LRDA6206,0)) D
 . N DIE,DR,DA
 . S DIE="^LAB(62.06,",DR="5////@"
 . S DA=LRDA6206
 . D ^DIE
 . ;Do not file twice if IEN's are the same.
 . I LRSL=LRNOSL S LRHIT=1
 ;Make sure all stray cross references are audited and then killed. Some sites have both.
 I LRSL D
 . S ^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C","TRIMETHAPRIM/SULFAMETHOXAZOLE",LRSL)=""
 . K ^LAB(62.06,"C","TRIMETHAPRIM/SULFAMETHOXAZOLE")
 I LRNOSL D
 . S ^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C","TRIMETHAPRIMSULFAMETHOXAZOLE",LRNOSL)=""
 . K ^LAB(62.06,"C","TRIMETHAPRIMSULFAMETHOXAZOLE")
 Q
 ;
TRI633 ;
 ;Correct spelling in file 63.3.
 ;No sites appear to have a "B" index spelled "TRIMETHAPRIMSULFAMETHOXAZOLE"
 ;so not checking for that.
 N DIE,DR,LRHIT
 S LRHIT=0
 S DIE="^DD(63.3,"
 S LRDA633=$O(^DD(63.3,"B","TRIMETHAPRIM/SULFAMETHOXAZOLE",""))
 I LRDA633 D
 . S DR=".01////TRIMETHOPRIM/SULFAMETHOXAZOLE"
 . D F633
 . D INIT633
 . S LRLINE="   TRIMETHOPRIM/SULFAMETHOXAZOLE (#75) field"
 . D XTMP
 . ;Line below is kept in case back out is needed.
 . S ^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF")=LRDA633
 S LRDA633=$O(^DD(63.3,"B","TRIMETHAPRIM/SULFA INTERP",""))
 I LRDA633 D
 . S DR=".01////TRIMETHOPRIM/SULFA INTERP"
 . D F633
 . I 'LRHIT D INIT633
 . S LRLINE="   TRIMETHOPRIM/SULFA INTERP (#75.1) field"
 . D XTMP
 . ;Line below is kept in case back out is needed.
 . S ^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF INTERP")=LRDA633
 S LRDA633=$O(^DD(63.3,"B","TRIMETHAPRIM/SULFA SCREEN",""))
 I LRDA633 D
 . S DR=".01////TRIMETHOPRIM/SULFA SCREEN"
 . D F633
 . I 'LRHIT D INIT633
 . S LRLINE="   TRIMETHOPRIM/SULFA SCREEN (#75.2) field"
 . D XTMP
 . ;Line below is kept in case back out is needed.
 . S ^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF SCREEN")=LRDA633
 I 'LRHIT D
 . S LRLINE="Corrections not needed in the ORGANISM (#63.3) sub-file."
 . D XTMP
 S LRLINE=" "
 D XTMP
 ;Retrieve field 75 IEN again for use when correcting file 62.06.
 S LRDA633=$O(^DD(63.3,"B","TRIMETHOPRIM/SULFAMETHOXAZOLE",""))
 Q
 ;
INIT633 ;
 S LRLINE="Incorrect spelling found and corrected in the ORGANISM (#63.3) sub-file:"
 D XTMP
 S LRHIT=1
 Q
 ;
F633 ;
 N DA
 S DA=LRDA633 D ^DIE
 Q
 ;
F6206 ;
 ;Now re-set 62.06
 N DIE,DA,DR,LRDA6206,LRINIT,LRHIT
 S DIE="^LAB(62.06,"
 S (LRINIT,LRHIT)=0
 S DR="5////"_LRDA633
 ;Performing a $D on the zero node because some sites appear to
 ;have killed the zero node but left the "C" cross reference.
 F LRDA6206=LRSL,LRNOSL I 'LRHIT,LRDA6206,$D(^LAB(62.06,LRDA6206,0)) D
 . S DA=LRDA6206
 . D ^DIE
 . ;Don't file twice if IEN's are the same.
 . I LRSL=LRNOSL S LRHIT=1
 . I 'LRINIT D
 . . S LRLINE="Incorrect spelling found and corrected in the ""C"" cross"
 . . D XTMP
 . . S LRLINE="reference of the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file."
 . . D XTMP
 . . S LRINIT=1
 . ;Line below is kept in case back out is needed.
 . S ^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN",LRDA6206)=""
 S LRLINE=" "
 D XTMP
 Q
 ;
XTMP ;
 S LRSEQ=LRSEQ+1
 S ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ)=LRLINE
 Q
 ;
MAIL ;
 N LRTEXT,LRMY,LRSUB,LRMIN
 I $O(LRSAVE("")) D
 . N LRSQX
 . S LRSQX=""
 . F  S LRSQX=$O(LRSAVE(LRSQX)) Q:LRSQX=""  D
 . . S LRSEQ=LRSEQ+1
 . . S ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ)=LRSAVE(LRSQX)
 S ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ+1)="The text of this message will be stored in the global"
 S ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ+2)="^XTMP(""LR*5.2*565 POST INSTALL"" for 90 days."
 S LRTEXT="^XTMP(""LR*5.2*565 POST INSTALL"")"
 S LRMY("G.LMI")=""
 S LRMY(DUZ)=""
 S LRSUB="LR*5.2*565 Post-Install Information"
 S LRMIN("FROM")="LR*5.2*565 Post-Install"
 D SENDMSG^XMXAPI(DUZ,LRSUB,LRTEXT,.LRMY,.LRMIN,.LRMZ,"")
 Q
 ;
BACKOUT ;
 ;This section is invoked manually from the programmer's prompt if backout is needed.
 ;
 ;The backout will revert the spelling of "TRIMETHOPRIM" to "TRIMETHAPRIM" in several fields.
 ;
 ;Only if changes were made by the patch install:
 ;
 ;1. Delete the INTERNAL NAME (#5) field entry from the ANTIMICROBIAL
 ;   SUSCEPTIBILITY (#62.06) file entry for "TRIMETHOPRIM/SULFAMETHOXAZOLE".
 ;2. In the ORGANISM (#63.3) sub-file of the MICROBIOLOGY (#5) sub-file of
 ;   the LAB DATA (#63) file, revert spellings for "TRIMETHOPRIM/SULFA INTERP",
 ;   "TRIMETHOPRIM/SULFA SCREEN", and "TRIMETHOPRIM/SULFAMETHOXAZOLE".
 ;3. Re-file the INTERNAL NAME(#5) field of the ANTIMICROBIAL SUSCEPTIBILITY
 ;   (#62.06) file entry from step 2. (This is necessary to re-set the
 ;   "C" cross reference.)
 ;4. Re-set stray cross references.
 ;
 N DIR,Y
 S DIR("A",1)="This action will back out the file modifications that were performed"
 S DIR("A",2)="after the install of LR*5.2*565."
 S DIR("A")="Are you sure you wish to proceed",DIR("B")="NO",DIR(0)="Y"
 D ^DIR
 Q:Y<1
 ;
 N LRSEQ,LRDA633,LRDA6206,LRLINE,LRHIT,LRSTRAY
 S LRSEQ=4
 ;Killing ^XTMP in case routine is run more than once during testing.
 K ^XTMP("LR*5.2*565 BACKOUT")
 S ^XTMP("LR*5.2*565 BACKOUT",0)=$$FMADD^XLFDT(DT,90)_"^"_DT_"^LR*5.2*565 BACKOUT"
 S ^XTMP("LR*5.2*565 BACKOUT",1)="Backout of LR*5.2*565 restored field entries in two files to contain"
 S ^XTMP("LR*5.2*565 BACKOUT",2)="""TRIMETHAPRIM"" instead of ""TRIMETHOPRIM"" if those fields were modified"
 S ^XTMP("LR*5.2*565 BACKOUT",3)="by the patch install."
 S ^XTMP("LR*5.2*565 BACKOUT",4)=" "
 D:$D(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN")) BDEL6206
 D BCK633
 D:$D(^XTMP("LR*5.2*565 POST INSTALL",0,62.06)) BF6206
 ;Ensure that stray cross-references are reset.
 S LRSTRAY="",LRHIT=0
 F  S LRSTRAY=$O(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C",LRSTRAY)) Q:LRSTRAY=""  D
 . S LRDA6206=""
 . F  S LRDA6206=$O(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C",LRSTRAY,LRDA6206)) Q:LRDA6206=""  D
 . . I '$D(^LAB(62.06,"C",LRSTRAY,LRDA6206)) D
 . . . S ^LAB(62.06,"C",LRSTRAY,LRDA6206)=""
 I '$D(^XTMP("LR*5.2*565 POST INSTALL",0,62.06)) D
 . S LRLINE="Backout not performed for the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file"
 . D BXTMP
 . S LRLINE="since misspellings did not exist before patch install."
 . D BXTMP
 . S LRLINE=" "
 . D BXTMP
 D END
 Q
 ;
BDEL6206 ;
 ;Check if 62.06 was refiled during install.
 Q:'$D(^XTMP("LR*5.2*565 POST INSTALL",0,62.06))
 N LRDA6206,DA,DR
 S LRDA6206=""
 F  S LRDA6206=$O(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN",LRDA6206)) Q:LRDA6206=""  D
 . ;Delete internal name from file 62.06.
 . S DIE="^LAB(62.06,",DR="5////@"
 . S DA=LRDA6206
 . D ^DIE
 Q
 ;
BF633INIT ;
 S LRLINE="In the ORGANISM (#63.3) sub-file of the MICROBIOLOGY (#5) sub-file of the"
 D BXTMP
 S LRLINE="LAB DATA (#63) file, the LR*5.2*565 backout process restored the following"
 D BXTMP
 S LRLINE="field(s) to contain ""TRIMETHAPRIM"":"
 D BXTMP
 S LRLINE=" "
 D BXTMP
 S LRHIT=1
 Q
 ;
BCK633 ;
 ;Not performing $D checks to determine if the IEN's exist since
 ;sites do not delete entries from file 63.3.
 N LRHIT
 S LRHIT=0
 ;Restore the original spelling in file 63.3.
 S DIE="^DD(63.3,"
 S LRDA633=$G(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF"))
 I LRDA633 D
 . S DR=".01////TRIMETHAPRIM/SULFAMETHOXAZOLE"
 . D BF633,BF633INIT
 . S LRLINE="    TRIMETHAPRIM/SULFAMETHOXAZOLE (#75) field"
 . D BXTMP
 . ;Keeping audit of backout in case questions arise later.
 . S ^XTMP("LR*5.2*565 BACKOUT",0,633,"TRSULF")=LRDA633
 S LRDA633=$G(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF INTERP"))
 I LRDA633 D
 . S DR=".01////TRIMETHAPRIM/SULFA INTERP"
 . D BF633
 . I 'LRHIT D BF633INIT
 . S LRLINE="    TRIMETHAPRIM/SULFA INTERP (#75.1) field"
 . D BXTMP
 . ;Keeping audit of backout in case questions arise later.
 . S ^XTMP("LR*5.2*565 BACKOUT",0,633,"TRSULF INTERP")=LRDA633
 S LRDA633=$G(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF SCREEN"))
 I LRDA633 D
 . S DR=".01////TRIMETHAPRIM/SULFA SCREEN"
 . D BF633
 . I 'LRHIT D BF633INIT
 . S LRLINE="    TRIMETHAPRIM/SULFA SCREEN (#75.2) field"
 . D BXTMP
 . ;Keeping audit of backout in case questions arise later.
 . S ^XTMP("LR*5.2*565 BACKOUT",0,633,"TRSULF SCREEN")=LRDA633
 I 'LRHIT D
 . S LRLINE="Backout not performed for the ORGANISM (#63.3) sub-file of the"
 . D BXTMP
 . S LRLINE="MICROBIOLOGY (#5) sub-file of the LAB DATA (#63) file since no"
 . D BXTMP
 . S LRLINE="fields were modified during patch install."
 . D BXTMP
 S LRLINE=" "
 D BXTMP
 Q
 ;
BF633 ;
 S DA=LRDA633 D ^DIE
 Q
 ;
BF6206 ;
 ;Now re-set 62.06
 Q:'$D(^XTMP("LR*5.2*565 POST INSTALL",0,62.06))
 N LRDA6206,LRHIT,DIE,DA,DR,LRDA633
 S LRDA6206="",LRHIT=0
 S DIE="^LAB(62.06,"
 S LRDA633=$G(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF"))
 ;LRDA633 should not be null, but checking to be sure.
 Q:'LRDA633
 S DR="5////"_LRDA633
 S LRDA6206="",LRHIT=0
 F  S LRDA6206=$O(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN",LRDA6206)) Q:LRDA6206=""  D
 . ;Stop in case site deleted this IEN after install but before backout.
 . Q:'$D(^LAB(62.06,LRDA6206,0))
 . S DA=LRDA6206 D ^DIE
 . I 'LRHIT D
 . . S LRLINE="In the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file, the ""C"""
 . . D BXTMP
 . . S LRLINE="cross reference spelling was restored."
 . . D BXTMP
 . S LRHIT=1
 . ;Keeping audit of backout in case questions arise later.
 . S ^XTMP("LR*5.2*565 BACKOUT",0,62.06,"IEN",LRDA6206)=""
 S LRLINE=" "
 D BXTMP
 Q
 ;
BXTMP ;
 S LRSEQ=LRSEQ+1
 S ^XTMP("LR*5.2*565 BACKOUT",LRSEQ)=LRLINE
 Q
 ;
END ;
 W !!,"Backout is complete.",!
 N LRTEXT,LRMY,LRSUB,LRMIN,LRMZ,DIR
 S ^XTMP("LR*5.2*565 BACKOUT",LRSEQ+1)="The text of this message will be stored in the global"
 S ^XTMP("LR*5.2*565 BACKOUT",LRSEQ+2)="^XTMP(""LR*5.2*565 BACKOUT"" for 90 days."
 S LRTEXT="^XTMP(""LR*5.2*565 BACKOUT"")"
 S LRMY("G.LMI")=""
 S LRMY(DUZ)=""
 S LRSUB="LR*5.2*565 Backout Information"
 S LRMIN("FROM")="LR*5.2*565 BACKOUT"
 D SENDMSG^XMXAPI(DUZ,LRSUB,LRTEXT,.LRMY,.LRMIN,.LRMZ,"")
 S DIR("A",1)="MailMan message #"_LRMZ_" has been sent to you as well as"
 S DIR("A",2)="holders of the LMI security key."
 S DIR("A")="Press any key to continue"
 S DIR(0)="E"
 D ^DIR
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLR565PST   14491     printed  Sep 23, 2025@19:40:13                                                                                                                                                                                                   Page 2
LR565PST  ;HDSO/DSK - LR*5.2*565 Post-install routine; Mar 21, 2023@14:00
 +1       ;;5.2;LAB SERVICE;**565**;Sep 27, 1994;Build 7
 +2       ;
 +3        QUIT 
 +4       ;
EN        ;
 +1       ;This post-install routine for LR*5.2*565 will correct the spelling
 +2       ;of "TRIMETHAPRIM" to "TRIMETHOPRIM" in several fields - if incorrect
 +3       ;spelling exists.
 +4       ;
 +5       ;1. Delete the INTERNAL NAME (#5) field entry from the ANTIMICROBIAL
 +6       ;   SUSCEPTIBILITY (#62.06) file entry for "TRIMETHAPRIM/SULFAMETHOXAZOLE"
 +7       ;   and "TRIMETHAPRIMSULFAMETHOXAZOLE". (Not all sites have the second
 +8       ;   misspelling without the "/".)
 +9       ;
 +10      ;2. In the ORGANISM (#63.3) sub-file of the MICROBIOLOGY (#5) sub-file of
 +11      ;   the LAB DATA (#63) file, correct spellings for "TRIMETHAPRIM/SULFA INTERP",
 +12      ;   "TRIMETHAPRIM/SULFA SCREEN", "TRIMETHAPRIM/SULFAMETHOXAZOLE" and
 +13      ;   "TRIMETHAPRIMSULFAMETHOXAZOLE"
 +14      ;
 +15      ;3. Re-file the INTERNAL NAME(#5) field of the ANTIMICROBIAL SUSCEPTIBILITY
 +16      ;   (#62.06) file entry from step 2.
 +17      ;
 +18      ;A MailMan message is sent to the installer and members of the LMI MailMan group
 +19      ;for one of the following outcomes:
 +20      ;
 +21      ;1. File updates were performed successfully for files 62.06 and 63.3.
 +22      ;   or
 +23      ;2. No entries containing incorrect spelling currently exist, so no
 +24      ;   corrections were needed by the post-install routine.
 +25      ;
 +26      ;The routine is not deleted after install because the backout section
 +27      ;needs to remain.
 +28      ;
 +29       DO BMES^XPDUTL($$CJ^XLFSTR("LR*5.2*565 post-install routine beginning....",80))
 +30      ;
 +31       NEW LRSEQ,LRLINE,LRDA633,LRDA6206,LRSAVE,LRMZ,LRSL,LRNOSL
 +32       SET LRSEQ=16
 +33      ;Killing ^XTMP in case routine is run more than once during testing.
 +34       KILL ^XTMP("LR*5.2*565 POST INSTALL")
 +35       SET ^XTMP("LR*5.2*565 POST INSTALL",0)=$$FMADD^XLFDT(DT,90)_"^"_DT_"^LR*5.2*565 POST INSTALL"
 +36       SET ^XTMP("LR*5.2*565 POST INSTALL",1)="If Laboratory files contained the incorrect spelling ""TRIMETHAPRIM/"
 +37       SET ^XTMP("LR*5.2*565 POST INSTALL",2)="SULFAMETHOXAZOLE"", the LR*5.2*565 post-install routine corrected the"
 +38       SET ^XTMP("LR*5.2*565 POST INSTALL",3)="spelling to ""TRIMETHOPRIM/SULFAMETHOXAZOLE""."
 +39       SET ^XTMP("LR*5.2*565 POST INSTALL",4)=" "
 +40       SET ^XTMP("LR*5.2*565 POST INSTALL",5)="Fields which were checked:"
 +41       SET ^XTMP("LR*5.2*565 POST INSTALL",6)=" "
 +42       SET ^XTMP("LR*5.2*565 POST INSTALL",7)="LAB DATA (#63) file, MICROBIOLOGY (#5) sub-file, ORGANISM (#63.3) sub-file"
 +43       SET ^XTMP("LR*5.2*565 POST INSTALL",8)="   TRIMETHOPRIM/SULFAMETHOXAZOLE (#75) field"
 +44       SET ^XTMP("LR*5.2*565 POST INSTALL",9)="   TRIMETHOPRIM/SULFA INTERP (#75.1) field"
 +45       SET ^XTMP("LR*5.2*565 POST INSTALL",10)="   TRIMETHOPRIM/SULFA SCREEN (#75.2) field"
 +46       SET ^XTMP("LR*5.2*565 POST INSTALL",11)=" "
 +47       SET ^XTMP("LR*5.2*565 POST INSTALL",12)="ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file"
 +48       SET ^XTMP("LR*5.2*565 POST INSTALL",13)="   ""C"" cross reference (points to field #75 in sub-file #63.3)"
 +49       SET ^XTMP("LR*5.2*565 POST INSTALL",14)=" "
 +50       SET ^XTMP("LR*5.2*565 POST INSTALL",15)="Results of post-install routine:"
 +51       SET ^XTMP("LR*5.2*565 POST INSTALL",16)="-------------------------------"
 +52       DO DEL6206
           DO TRI633
           DO F6206
 +53       DO MAIL
           DO BMES
 +54       QUIT 
 +55      ;
BMES      ;
 +1        DO BMES^XPDUTL($$CJ^XLFSTR("LR*5.2*565 post-install routine complete.",80))
 +2        DO BMES^XPDUTL($$CJ^XLFSTR("MailMan message number #"_LRMZ_" sent to installer",80))
 +3        DO BMES^XPDUTL($$CJ^XLFSTR("and members of the LMI MailMan group.",80))
 +4        QUIT 
 +5       ;
DEL6206   ;
 +1       ;Several scenarios found at sites in the "C" cross reference:
 +2       ;1. No misspellings found.
 +3       ;2. Misspelling of "TRIMETHAPRIM/SULFAMETHOXAZOLE" found.
 +4       ;3. Misspelling of "TRIMETHAPRIMSULFAMETHOXAZOLE" found.
 +5       ;4. One or both of the above misspellings found.
 +6       ;
 +7       ;First, have to delete the field so that the incorrect "C" cross reference
 +8       ;will be killed. The cross reference logic retrieves the current
 +9       ;name from file 63.3 so simply refiling later will not kill the
 +10      ;misspelled name.
 +11       SET LRSL=$ORDER(^LAB(62.06,"C","TRIMETHAPRIM/SULFAMETHOXAZOLE",""))
 +12       SET LRNOSL=$ORDER(^LAB(62.06,"C","TRIMETHAPRIMSULFAMETHOXAZOLE",""))
 +13      ;Quit if no misspellings found.
 +14       IF 'LRSL
               IF 'LRNOSL
                   Begin DoDot:1
 +15      ;Save text so will display after file 63.3 message(s).
 +16                   SET LRSAVE(1)="Correction not needed in the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file"
 +17                   SET LRSAVE(2)="""C"" cross reference."
 +18                   SET LRSAVE(3)=" "
                   End DoDot:1
                   QUIT 
 +19      ;Delete the current INTERNAL NAME entry.
 +20       NEW LRHIT
 +21       SET LRHIT=0
 +22       FOR LRDA6206=LRSL,LRNOSL
               IF 'LRHIT
                   IF LRDA6206
                       IF $DATA(^LAB(62.06,LRDA6206,0))
                           Begin DoDot:1
 +23                           NEW DIE,DR,DA
 +24                           SET DIE="^LAB(62.06,"
                               SET DR="5////@"
 +25                           SET DA=LRDA6206
 +26                           DO ^DIE
 +27      ;Do not file twice if IEN's are the same.
 +28                           IF LRSL=LRNOSL
                                   SET LRHIT=1
                           End DoDot:1
 +29      ;Make sure all stray cross references are audited and then killed. Some sites have both.
 +30       IF LRSL
               Begin DoDot:1
 +31               SET ^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C","TRIMETHAPRIM/SULFAMETHOXAZOLE",LRSL)=""
 +32               KILL ^LAB(62.06,"C","TRIMETHAPRIM/SULFAMETHOXAZOLE")
               End DoDot:1
 +33       IF LRNOSL
               Begin DoDot:1
 +34               SET ^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C","TRIMETHAPRIMSULFAMETHOXAZOLE",LRNOSL)=""
 +35               KILL ^LAB(62.06,"C","TRIMETHAPRIMSULFAMETHOXAZOLE")
               End DoDot:1
 +36       QUIT 
 +37      ;
TRI633    ;
 +1       ;Correct spelling in file 63.3.
 +2       ;No sites appear to have a "B" index spelled "TRIMETHAPRIMSULFAMETHOXAZOLE"
 +3       ;so not checking for that.
 +4        NEW DIE,DR,LRHIT
 +5        SET LRHIT=0
 +6        SET DIE="^DD(63.3,"
 +7        SET LRDA633=$ORDER(^DD(63.3,"B","TRIMETHAPRIM/SULFAMETHOXAZOLE",""))
 +8        IF LRDA633
               Begin DoDot:1
 +9                SET DR=".01////TRIMETHOPRIM/SULFAMETHOXAZOLE"
 +10               DO F633
 +11               DO INIT633
 +12               SET LRLINE="   TRIMETHOPRIM/SULFAMETHOXAZOLE (#75) field"
 +13               DO XTMP
 +14      ;Line below is kept in case back out is needed.
 +15               SET ^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF")=LRDA633
               End DoDot:1
 +16       SET LRDA633=$ORDER(^DD(63.3,"B","TRIMETHAPRIM/SULFA INTERP",""))
 +17       IF LRDA633
               Begin DoDot:1
 +18               SET DR=".01////TRIMETHOPRIM/SULFA INTERP"
 +19               DO F633
 +20               IF 'LRHIT
                       DO INIT633
 +21               SET LRLINE="   TRIMETHOPRIM/SULFA INTERP (#75.1) field"
 +22               DO XTMP
 +23      ;Line below is kept in case back out is needed.
 +24               SET ^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF INTERP")=LRDA633
               End DoDot:1
 +25       SET LRDA633=$ORDER(^DD(63.3,"B","TRIMETHAPRIM/SULFA SCREEN",""))
 +26       IF LRDA633
               Begin DoDot:1
 +27               SET DR=".01////TRIMETHOPRIM/SULFA SCREEN"
 +28               DO F633
 +29               IF 'LRHIT
                       DO INIT633
 +30               SET LRLINE="   TRIMETHOPRIM/SULFA SCREEN (#75.2) field"
 +31               DO XTMP
 +32      ;Line below is kept in case back out is needed.
 +33               SET ^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF SCREEN")=LRDA633
               End DoDot:1
 +34       IF 'LRHIT
               Begin DoDot:1
 +35               SET LRLINE="Corrections not needed in the ORGANISM (#63.3) sub-file."
 +36               DO XTMP
               End DoDot:1
 +37       SET LRLINE=" "
 +38       DO XTMP
 +39      ;Retrieve field 75 IEN again for use when correcting file 62.06.
 +40       SET LRDA633=$ORDER(^DD(63.3,"B","TRIMETHOPRIM/SULFAMETHOXAZOLE",""))
 +41       QUIT 
 +42      ;
INIT633   ;
 +1        SET LRLINE="Incorrect spelling found and corrected in the ORGANISM (#63.3) sub-file:"
 +2        DO XTMP
 +3        SET LRHIT=1
 +4        QUIT 
 +5       ;
F633      ;
 +1        NEW DA
 +2        SET DA=LRDA633
           DO ^DIE
 +3        QUIT 
 +4       ;
F6206     ;
 +1       ;Now re-set 62.06
 +2        NEW DIE,DA,DR,LRDA6206,LRINIT,LRHIT
 +3        SET DIE="^LAB(62.06,"
 +4        SET (LRINIT,LRHIT)=0
 +5        SET DR="5////"_LRDA633
 +6       ;Performing a $D on the zero node because some sites appear to
 +7       ;have killed the zero node but left the "C" cross reference.
 +8        FOR LRDA6206=LRSL,LRNOSL
               IF 'LRHIT
                   IF LRDA6206
                       IF $DATA(^LAB(62.06,LRDA6206,0))
                           Begin DoDot:1
 +9                            SET DA=LRDA6206
 +10                           DO ^DIE
 +11      ;Don't file twice if IEN's are the same.
 +12                           IF LRSL=LRNOSL
                                   SET LRHIT=1
 +13                           IF 'LRINIT
                                   Begin DoDot:2
 +14                                   SET LRLINE="Incorrect spelling found and corrected in the ""C"" cross"
 +15                                   DO XTMP
 +16                                   SET LRLINE="reference of the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file."
 +17                                   DO XTMP
 +18                                   SET LRINIT=1
                                   End DoDot:2
 +19      ;Line below is kept in case back out is needed.
 +20                           SET ^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN",LRDA6206)=""
                           End DoDot:1
 +21       SET LRLINE=" "
 +22       DO XTMP
 +23       QUIT 
 +24      ;
XTMP      ;
 +1        SET LRSEQ=LRSEQ+1
 +2        SET ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ)=LRLINE
 +3        QUIT 
 +4       ;
MAIL      ;
 +1        NEW LRTEXT,LRMY,LRSUB,LRMIN
 +2        IF $ORDER(LRSAVE(""))
               Begin DoDot:1
 +3                NEW LRSQX
 +4                SET LRSQX=""
 +5                FOR 
                       SET LRSQX=$ORDER(LRSAVE(LRSQX))
                       if LRSQX=""
                           QUIT 
                       Begin DoDot:2
 +6                        SET LRSEQ=LRSEQ+1
 +7                        SET ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ)=LRSAVE(LRSQX)
                       End DoDot:2
               End DoDot:1
 +8        SET ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ+1)="The text of this message will be stored in the global"
 +9        SET ^XTMP("LR*5.2*565 POST INSTALL",LRSEQ+2)="^XTMP(""LR*5.2*565 POST INSTALL"" for 90 days."
 +10       SET LRTEXT="^XTMP(""LR*5.2*565 POST INSTALL"")"
 +11       SET LRMY("G.LMI")=""
 +12       SET LRMY(DUZ)=""
 +13       SET LRSUB="LR*5.2*565 Post-Install Information"
 +14       SET LRMIN("FROM")="LR*5.2*565 Post-Install"
 +15       DO SENDMSG^XMXAPI(DUZ,LRSUB,LRTEXT,.LRMY,.LRMIN,.LRMZ,"")
 +16       QUIT 
 +17      ;
BACKOUT   ;
 +1       ;This section is invoked manually from the programmer's prompt if backout is needed.
 +2       ;
 +3       ;The backout will revert the spelling of "TRIMETHOPRIM" to "TRIMETHAPRIM" in several fields.
 +4       ;
 +5       ;Only if changes were made by the patch install:
 +6       ;
 +7       ;1. Delete the INTERNAL NAME (#5) field entry from the ANTIMICROBIAL
 +8       ;   SUSCEPTIBILITY (#62.06) file entry for "TRIMETHOPRIM/SULFAMETHOXAZOLE".
 +9       ;2. In the ORGANISM (#63.3) sub-file of the MICROBIOLOGY (#5) sub-file of
 +10      ;   the LAB DATA (#63) file, revert spellings for "TRIMETHOPRIM/SULFA INTERP",
 +11      ;   "TRIMETHOPRIM/SULFA SCREEN", and "TRIMETHOPRIM/SULFAMETHOXAZOLE".
 +12      ;3. Re-file the INTERNAL NAME(#5) field of the ANTIMICROBIAL SUSCEPTIBILITY
 +13      ;   (#62.06) file entry from step 2. (This is necessary to re-set the
 +14      ;   "C" cross reference.)
 +15      ;4. Re-set stray cross references.
 +16      ;
 +17       NEW DIR,Y
 +18       SET DIR("A",1)="This action will back out the file modifications that were performed"
 +19       SET DIR("A",2)="after the install of LR*5.2*565."
 +20       SET DIR("A")="Are you sure you wish to proceed"
           SET DIR("B")="NO"
           SET DIR(0)="Y"
 +21       DO ^DIR
 +22       if Y<1
               QUIT 
 +23      ;
 +24       NEW LRSEQ,LRDA633,LRDA6206,LRLINE,LRHIT,LRSTRAY
 +25       SET LRSEQ=4
 +26      ;Killing ^XTMP in case routine is run more than once during testing.
 +27       KILL ^XTMP("LR*5.2*565 BACKOUT")
 +28       SET ^XTMP("LR*5.2*565 BACKOUT",0)=$$FMADD^XLFDT(DT,90)_"^"_DT_"^LR*5.2*565 BACKOUT"
 +29       SET ^XTMP("LR*5.2*565 BACKOUT",1)="Backout of LR*5.2*565 restored field entries in two files to contain"
 +30       SET ^XTMP("LR*5.2*565 BACKOUT",2)="""TRIMETHAPRIM"" instead of ""TRIMETHOPRIM"" if those fields were modified"
 +31       SET ^XTMP("LR*5.2*565 BACKOUT",3)="by the patch install."
 +32       SET ^XTMP("LR*5.2*565 BACKOUT",4)=" "
 +33       if $DATA(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN"))
               DO BDEL6206
 +34       DO BCK633
 +35       if $DATA(^XTMP("LR*5.2*565 POST INSTALL",0,62.06))
               DO BF6206
 +36      ;Ensure that stray cross-references are reset.
 +37       SET LRSTRAY=""
           SET LRHIT=0
 +38       FOR 
               SET LRSTRAY=$ORDER(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C",LRSTRAY))
               if LRSTRAY=""
                   QUIT 
               Begin DoDot:1
 +39               SET LRDA6206=""
 +40               FOR 
                       SET LRDA6206=$ORDER(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"C",LRSTRAY,LRDA6206))
                       if LRDA6206=""
                           QUIT 
                       Begin DoDot:2
 +41                       IF '$DATA(^LAB(62.06,"C",LRSTRAY,LRDA6206))
                               Begin DoDot:3
 +42                               SET ^LAB(62.06,"C",LRSTRAY,LRDA6206)=""
                               End DoDot:3
                       End DoDot:2
               End DoDot:1
 +43       IF '$DATA(^XTMP("LR*5.2*565 POST INSTALL",0,62.06))
               Begin DoDot:1
 +44               SET LRLINE="Backout not performed for the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file"
 +45               DO BXTMP
 +46               SET LRLINE="since misspellings did not exist before patch install."
 +47               DO BXTMP
 +48               SET LRLINE=" "
 +49               DO BXTMP
               End DoDot:1
 +50       DO END
 +51       QUIT 
 +52      ;
BDEL6206  ;
 +1       ;Check if 62.06 was refiled during install.
 +2        if '$DATA(^XTMP("LR*5.2*565 POST INSTALL",0,62.06))
               QUIT 
 +3        NEW LRDA6206,DA,DR
 +4        SET LRDA6206=""
 +5        FOR 
               SET LRDA6206=$ORDER(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN",LRDA6206))
               if LRDA6206=""
                   QUIT 
               Begin DoDot:1
 +6       ;Delete internal name from file 62.06.
 +7                SET DIE="^LAB(62.06,"
                   SET DR="5////@"
 +8                SET DA=LRDA6206
 +9                DO ^DIE
               End DoDot:1
 +10       QUIT 
 +11      ;
BF633INIT ;
 +1        SET LRLINE="In the ORGANISM (#63.3) sub-file of the MICROBIOLOGY (#5) sub-file of the"
 +2        DO BXTMP
 +3        SET LRLINE="LAB DATA (#63) file, the LR*5.2*565 backout process restored the following"
 +4        DO BXTMP
 +5        SET LRLINE="field(s) to contain ""TRIMETHAPRIM"":"
 +6        DO BXTMP
 +7        SET LRLINE=" "
 +8        DO BXTMP
 +9        SET LRHIT=1
 +10       QUIT 
 +11      ;
BCK633    ;
 +1       ;Not performing $D checks to determine if the IEN's exist since
 +2       ;sites do not delete entries from file 63.3.
 +3        NEW LRHIT
 +4        SET LRHIT=0
 +5       ;Restore the original spelling in file 63.3.
 +6        SET DIE="^DD(63.3,"
 +7        SET LRDA633=$GET(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF"))
 +8        IF LRDA633
               Begin DoDot:1
 +9                SET DR=".01////TRIMETHAPRIM/SULFAMETHOXAZOLE"
 +10               DO BF633
                   DO BF633INIT
 +11               SET LRLINE="    TRIMETHAPRIM/SULFAMETHOXAZOLE (#75) field"
 +12               DO BXTMP
 +13      ;Keeping audit of backout in case questions arise later.
 +14               SET ^XTMP("LR*5.2*565 BACKOUT",0,633,"TRSULF")=LRDA633
               End DoDot:1
 +15       SET LRDA633=$GET(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF INTERP"))
 +16       IF LRDA633
               Begin DoDot:1
 +17               SET DR=".01////TRIMETHAPRIM/SULFA INTERP"
 +18               DO BF633
 +19               IF 'LRHIT
                       DO BF633INIT
 +20               SET LRLINE="    TRIMETHAPRIM/SULFA INTERP (#75.1) field"
 +21               DO BXTMP
 +22      ;Keeping audit of backout in case questions arise later.
 +23               SET ^XTMP("LR*5.2*565 BACKOUT",0,633,"TRSULF INTERP")=LRDA633
               End DoDot:1
 +24       SET LRDA633=$GET(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF SCREEN"))
 +25       IF LRDA633
               Begin DoDot:1
 +26               SET DR=".01////TRIMETHAPRIM/SULFA SCREEN"
 +27               DO BF633
 +28               IF 'LRHIT
                       DO BF633INIT
 +29               SET LRLINE="    TRIMETHAPRIM/SULFA SCREEN (#75.2) field"
 +30               DO BXTMP
 +31      ;Keeping audit of backout in case questions arise later.
 +32               SET ^XTMP("LR*5.2*565 BACKOUT",0,633,"TRSULF SCREEN")=LRDA633
               End DoDot:1
 +33       IF 'LRHIT
               Begin DoDot:1
 +34               SET LRLINE="Backout not performed for the ORGANISM (#63.3) sub-file of the"
 +35               DO BXTMP
 +36               SET LRLINE="MICROBIOLOGY (#5) sub-file of the LAB DATA (#63) file since no"
 +37               DO BXTMP
 +38               SET LRLINE="fields were modified during patch install."
 +39               DO BXTMP
               End DoDot:1
 +40       SET LRLINE=" "
 +41       DO BXTMP
 +42       QUIT 
 +43      ;
BF633     ;
 +1        SET DA=LRDA633
           DO ^DIE
 +2        QUIT 
 +3       ;
BF6206    ;
 +1       ;Now re-set 62.06
 +2        if '$DATA(^XTMP("LR*5.2*565 POST INSTALL",0,62.06))
               QUIT 
 +3        NEW LRDA6206,LRHIT,DIE,DA,DR,LRDA633
 +4        SET LRDA6206=""
           SET LRHIT=0
 +5        SET DIE="^LAB(62.06,"
 +6        SET LRDA633=$GET(^XTMP("LR*5.2*565 POST INSTALL",0,633,"TRSULF"))
 +7       ;LRDA633 should not be null, but checking to be sure.
 +8        if 'LRDA633
               QUIT 
 +9        SET DR="5////"_LRDA633
 +10       SET LRDA6206=""
           SET LRHIT=0
 +11       FOR 
               SET LRDA6206=$ORDER(^XTMP("LR*5.2*565 POST INSTALL",0,62.06,"IEN",LRDA6206))
               if LRDA6206=""
                   QUIT 
               Begin DoDot:1
 +12      ;Stop in case site deleted this IEN after install but before backout.
 +13               if '$DATA(^LAB(62.06,LRDA6206,0))
                       QUIT 
 +14               SET DA=LRDA6206
                   DO ^DIE
 +15               IF 'LRHIT
                       Begin DoDot:2
 +16                       SET LRLINE="In the ANTIMICROBIAL SUSCEPTIBILITY (#62.06) file, the ""C"""
 +17                       DO BXTMP
 +18                       SET LRLINE="cross reference spelling was restored."
 +19                       DO BXTMP
                       End DoDot:2
 +20               SET LRHIT=1
 +21      ;Keeping audit of backout in case questions arise later.
 +22               SET ^XTMP("LR*5.2*565 BACKOUT",0,62.06,"IEN",LRDA6206)=""
               End DoDot:1
 +23       SET LRLINE=" "
 +24       DO BXTMP
 +25       QUIT 
 +26      ;
BXTMP     ;
 +1        SET LRSEQ=LRSEQ+1
 +2        SET ^XTMP("LR*5.2*565 BACKOUT",LRSEQ)=LRLINE
 +3        QUIT 
 +4       ;
END       ;
 +1        WRITE !!,"Backout is complete.",!
 +2        NEW LRTEXT,LRMY,LRSUB,LRMIN,LRMZ,DIR
 +3        SET ^XTMP("LR*5.2*565 BACKOUT",LRSEQ+1)="The text of this message will be stored in the global"
 +4        SET ^XTMP("LR*5.2*565 BACKOUT",LRSEQ+2)="^XTMP(""LR*5.2*565 BACKOUT"" for 90 days."
 +5        SET LRTEXT="^XTMP(""LR*5.2*565 BACKOUT"")"
 +6        SET LRMY("G.LMI")=""
 +7        SET LRMY(DUZ)=""
 +8        SET LRSUB="LR*5.2*565 Backout Information"
 +9        SET LRMIN("FROM")="LR*5.2*565 BACKOUT"
 +10       DO SENDMSG^XMXAPI(DUZ,LRSUB,LRTEXT,.LRMY,.LRMIN,.LRMZ,"")
 +11       SET DIR("A",1)="MailMan message #"_LRMZ_" has been sent to you as well as"
 +12       SET DIR("A",2)="holders of the LMI security key."
 +13       SET DIR("A")="Press any key to continue"
 +14       SET DIR(0)="E"
 +15       DO ^DIR
 +16       QUIT 
 +17      ;