SD53P765 ;TMP/GN - TMP POST INSTALL FOR PATCH SD*5.3*765;July 30, 2018
 ;;5.3;Scheduling;**765**;May 29, 2018;Build 13
 ;
 ;Post install routine for SD*5.3*765 to load new Stop codes to the TMP file SD TELE HEALTH STOP CODE FILE #40.6.
 ;** this post install can be rerun with no harm, will report already on file if codes already there.
 ;
TMP28 ;Begin Post Install FOR TMP-28 ISSUE
 N ERRCNT,QQ,STP,STP1,STP2 S ERRCNT=0
 D MES^XPDUTL("")
 D MES^XPDUTL("Beginning update of SD TELE HEALTH STOP CODE FILE...")
 D MES^XPDUTL("") H 1
 F QQ=1:1 S STP=$P($T(STPCODES+QQ),";;",2) Q:STP=""  D
 .K DIE,FDA,SDIEN,TMPERR
 .I $O(^SD(40.6,"B",STP,"")) D MES^XPDUTL(STP_"    already on file") Q   ;skip already on file
 .I $L(STP)=3 D  Q
 ..I '$$CHKSTOP^SDTMPHLA(STP) D MES^XPDUTL(STP_"    ** Not added, invalid stop code") Q
 ..S FDA(40.6,"+1,",.01)=STP D UPDATE^DIE("","FDA","SDIEN","TMPERR") D:'$D(TMPERR) MES^XPDUTL(STP_"    added stop code")
 ..I $D(TMPERR) S ERRCNT=ERRCNT+1 D MES^XPDUTL(STP_" failed an attempt to add to the file.")
 .I $L(STP)=6 D  Q
 ..S STP1=$E(STP,1,3),STP2=$E(STP,4,6) I ('$$CHKSTOP^SDTMPHLA(STP1))!('$$CHKSTOP^SDTMPHLA(STP2)) D MES^XPDUTL(STP_" ** Not added, one or both stop codes in pair is invalid") Q
 ..S FDA(40.6,"+1,",.01)=STP D UPDATE^DIE("","FDA","SDIEN","TMPERR") D:'$D(TMPERR) MES^XPDUTL(STP_" added stop code pair")
 ..I $D(TMPERR) S ERRCNT=ERRCNT+1 D MES^XPDUTL(STP_" failed an attempt to add to the file.")
 .K DIE,FDA,SDIEN,TMPERR
 D MES^XPDUTL("")
 D MES^XPDUTL("Stop Code Update completed. "_ERRCNT_" error(s) found.")
 D MES^XPDUTL("")
 ;
 D POST^SDPAWS
 Q
STPCODES ;Add Clinic/Telephone stop codes not already on file (only if Valid stop codes on file 40.7 1st)
 ;;137;;Clinic stop codes begin
 ;;225
 ;;322
 ;;323531
 ;;440
 ;;444
 ;;445
 ;;446
 ;;447
 ;;644
 ;;645
 ;;646
 ;;647
 ;;679
 ;;718
 ;;723
 ;;724
 ;;103;;Telephone stop codes begin
 ;;103801
 ;;103802
 ;;103803
 ;;147
 ;;148
 ;;169
 ;;178
 ;;181
 ;;182
 ;;199
 ;;216
 ;;221
 ;;224
 ;;229
 ;;324
 ;;325
 ;;326
 ;;338
 ;;338531
 ;;424
 ;;425
 ;;428
 ;;441
 ;;527
 ;;528
 ;;530
 ;;536
 ;;542
 ;;545
 ;;546
 ;;579
 ;;584
 ;;597
 ;;611
 ;;686
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSD53P765   2221     printed  Sep 23, 2025@20:23:02                                                                                                                                                                                                    Page 2
SD53P765  ;TMP/GN - TMP POST INSTALL FOR PATCH SD*5.3*765;July 30, 2018
 +1       ;;5.3;Scheduling;**765**;May 29, 2018;Build 13
 +2       ;
 +3       ;Post install routine for SD*5.3*765 to load new Stop codes to the TMP file SD TELE HEALTH STOP CODE FILE #40.6.
 +4       ;** this post install can be rerun with no harm, will report already on file if codes already there.
 +5       ;
TMP28     ;Begin Post Install FOR TMP-28 ISSUE
 +1        NEW ERRCNT,QQ,STP,STP1,STP2
           SET ERRCNT=0
 +2        DO MES^XPDUTL("")
 +3        DO MES^XPDUTL("Beginning update of SD TELE HEALTH STOP CODE FILE...")
 +4        DO MES^XPDUTL("")
           HANG 1
 +5        FOR QQ=1:1
               SET STP=$PIECE($TEXT(STPCODES+QQ),";;",2)
               if STP=""
                   QUIT 
               Begin DoDot:1
 +6                KILL DIE,FDA,SDIEN,TMPERR
 +7       ;skip already on file
                   IF $ORDER(^SD(40.6,"B",STP,""))
                       DO MES^XPDUTL(STP_"    already on file")
                       QUIT 
 +8                IF $LENGTH(STP)=3
                       Begin DoDot:2
 +9                        IF '$$CHKSTOP^SDTMPHLA(STP)
                               DO MES^XPDUTL(STP_"    ** Not added, invalid stop code")
                               QUIT 
 +10                       SET FDA(40.6,"+1,",.01)=STP
                           DO UPDATE^DIE("","FDA","SDIEN","TMPERR")
                           if '$DATA(TMPERR)
                               DO MES^XPDUTL(STP_"    added stop code")
 +11                       IF $DATA(TMPERR)
                               SET ERRCNT=ERRCNT+1
                               DO MES^XPDUTL(STP_" failed an attempt to add to the file.")
                       End DoDot:2
                       QUIT 
 +12               IF $LENGTH(STP)=6
                       Begin DoDot:2
 +13                       SET STP1=$EXTRACT(STP,1,3)
                           SET STP2=$EXTRACT(STP,4,6)
                           IF ('$$CHKSTOP^SDTMPHLA(STP1))!('$$CHKSTOP^SDTMPHLA(STP2))
                               DO MES^XPDUTL(STP_" ** Not added, one or both stop codes in pair is invalid")
                               QUIT 
 +14                       SET FDA(40.6,"+1,",.01)=STP
                           DO UPDATE^DIE("","FDA","SDIEN","TMPERR")
                           if '$DATA(TMPERR)
                               DO MES^XPDUTL(STP_" added stop code pair")
 +15                       IF $DATA(TMPERR)
                               SET ERRCNT=ERRCNT+1
                               DO MES^XPDUTL(STP_" failed an attempt to add to the file.")
                       End DoDot:2
                       QUIT 
 +16               KILL DIE,FDA,SDIEN,TMPERR
               End DoDot:1
 +17       DO MES^XPDUTL("")
 +18       DO MES^XPDUTL("Stop Code Update completed. "_ERRCNT_" error(s) found.")
 +19       DO MES^XPDUTL("")
 +20      ;
 +21       DO POST^SDPAWS
 +22       QUIT 
STPCODES  ;Add Clinic/Telephone stop codes not already on file (only if Valid stop codes on file 40.7 1st)
 +1       ;;137;;Clinic stop codes begin
 +2       ;;225
 +3       ;;322
 +4       ;;323531
 +5       ;;440
 +6       ;;444
 +7       ;;445
 +8       ;;446
 +9       ;;447
 +10      ;;644
 +11      ;;645
 +12      ;;646
 +13      ;;647
 +14      ;;679
 +15      ;;718
 +16      ;;723
 +17      ;;724
 +18      ;;103;;Telephone stop codes begin
 +19      ;;103801
 +20      ;;103802
 +21      ;;103803
 +22      ;;147
 +23      ;;148
 +24      ;;169
 +25      ;;178
 +26      ;;181
 +27      ;;182
 +28      ;;199
 +29      ;;216
 +30      ;;221
 +31      ;;224
 +32      ;;229
 +33      ;;324
 +34      ;;325
 +35      ;;326
 +36      ;;338
 +37      ;;338531
 +38      ;;424
 +39      ;;425
 +40      ;;428
 +41      ;;441
 +42      ;;527
 +43      ;;528
 +44      ;;530
 +45      ;;536
 +46      ;;542
 +47      ;;545
 +48      ;;546
 +49      ;;579
 +50      ;;584
 +51      ;;597
 +52      ;;611
 +53      ;;686