DG53P597 ; BAY/JAP- Patch DG*5.3*597 Post-Installation ; 04/19/2004
 ;;5.3;Registration;**597**;AUG 13, 1993
 ;
 ;be sure that all existing 1010EZ applications in 1010EZ HOLDING file (#712)
 ;are linked to file #2 thru the new field MOST RECENT 1010EZ (#1010.156);
 ;also update APPOINTMENT REQUEST ON 1010EZ field (#1010.159) using data from field #4.4/file #712
 ;and EMAIL ADDRESS field (#.133) using data from field #4.3/file #712
 ;in the applicant's file #2 record.
 ;
POST ;
 ;queue the task to background for 5:00 AM following date of install
 ;ZTRTN="QUE^DG53P597"
 N QUETIME,X1,X2
 S X1=DT,X2=1 D C^%DTC
 S QUETIME=X_".05"
 S ZTDTH=QUETIME
 S ZTIO="",ZTDESC="DG*5.3*597 POST-INSTALLATION TASK"
 S ZTRTN="QUE^DG53P597"
 D ^%ZTLOAD
 I '$G(ZTSK) W !!,"POST-INSTALL BACKGROUND TASK NOT QUEUED",! D NOTASK
 Q
 ;
QUE ;entry point from TaskManager
 ;
 ;only update file #2 with data from file #712 record if date filed exists
 ;(#3.4) LINK TO FILE #2 [10P:2]
 ;(#4.3) APPLICANT E-MAIL [4F]
 ;(#4.4) APPOINTMENT REQUESTED [5S]
 ;(#7.1) FILING DATE [5D]
 S START=$$NOW^XLFDT()
 S REC712=0,TOTAL=0,UPDATES=0
 F  S REC712=$O(^EAS(712,REC712)) Q:'REC712  D
 .S TOTAL=TOTAL+1,NEW=0
 .S DFN=+$P(^EAS(712,REC712,0),U,10),FILED=+$P($G(^EAS(712,REC712,2)),U,5)
 .Q:'DFN
 .Q:'$D(^DPT(DFN,0))
 .Q:'FILED
 .S EMAIL=$P($G(^EAS(712,REC712,1)),U,4),APPTREQ=$P($G(^EAS(712,REC712,1)),U,5)
 .I $P($G(^DPT(DFN,1010.15)),U,6)="" S NEW=1
 .S IENS=DFN_","
 .K DATA S DATA(2,IENS,.133)=EMAIL,DATA(2,IENS,1010.156)=REC712,DATA(2,IENS,1010.159)=APPTREQ
 .K ERRMSG D FILE^DIE("","DATA","ERRMSG")
 .I '$D(ERRMSG),NEW S UPDATES=UPDATES+1
 ;when process of file #712 is complete
 D MESS(TOTAL,UPDATES,$G(ZTSK),START)
 Q
 ;
MESS(TOTAL,UPDATES,ZTSK,START) ;
 ;send MailMan message to members of G.VA1010EZ as well installer of patch
 ;to inform that job has completed and number of file #2 records updated.
 ;
 S Y=START D DD^%DT S START=Y
 I $G(ZTSK) S MSG(1)="The post-installation background task (#"_ZTSK_") for DG*5.3*597,"
 I '$G(ZTSK) S MSG(1)="A post-installation update process for DG*5.3*597,"
 S MSG(2)="which started on "_START_", has completed."
 S MSG(3)=" "
 S MSG(4)="A total of "_TOTAL_" records in the 1010EZ HOLDING file (#712)"
 S MSG(5)="were processed."
 S MSG(6)=" "
 S MSG(7)=UPDATES_" records in the PATIENT file (#2) were updated as follows:"
 S MSG(8)="   Field #.133 from #712/#4.3"
 S MSG(9)="   Field #1010.156 from #712 IEN"
 S MSG(10)="   Field #1010.159 from #712/#4.4"
 S MSG(11)=" "
 K XMY
 S XMDUZ=.5,XMTEXT="MSG(",XMY(DUZ)="",WHERE=^XMB("NETNAME"),XMY("G.VA1010EZ@"_WHERE)=""
 S XMSUB="DG*5.3*597 Post-Installation Task Complete"
 D ^XMD
 K DFN,MSG,NEW,REC712,TOTAL,UPDATES,WHERE,XMZ,XMY,XMDUZ
 Q
 ;
NOTASK ;
 ;send MailMan message to members of G.VA1010EZ as well installer of patch
 ;to inform that post-install job was not successfully tasked.
 ;
 S MSG(1)="The post-installation background job for DG*5.3*597"
 S MSG(2)="was not successfully queued."
 S MSG(3)=" "
 S MSG(4)="Please have a member of IRM Service at your facility"
 S MSG(5)="run the post-installation update directly from"
 S MSG(6)="programmer mode by entering the following command:"
 S MSG(7)=" "
 S MSG(8)="D QUE^DG53P597"
 S MSG(9)=" "
 S MSG(10)="The process should take less than 30 minutes to complete."
 K XMY
 S XMDUZ=.5,XMTEXT="MSG(",XMY(DUZ)="",WHERE=^XMB("NETNAME"),XMY("G.VA1010EZ@"_WHERE)=""
 S XMSUB="DG*5.3*597 Post-Installation Failure"
 D ^XMD
 K MSG,WHERE,XMZ,XMY,XMDUZ
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDG53P597   3563     printed  Sep 23, 2025@20:15:44                                                                                                                                                                                                    Page 2
DG53P597  ; BAY/JAP- Patch DG*5.3*597 Post-Installation ; 04/19/2004
 +1       ;;5.3;Registration;**597**;AUG 13, 1993
 +2       ;
 +3       ;be sure that all existing 1010EZ applications in 1010EZ HOLDING file (#712)
 +4       ;are linked to file #2 thru the new field MOST RECENT 1010EZ (#1010.156);
 +5       ;also update APPOINTMENT REQUEST ON 1010EZ field (#1010.159) using data from field #4.4/file #712
 +6       ;and EMAIL ADDRESS field (#.133) using data from field #4.3/file #712
 +7       ;in the applicant's file #2 record.
 +8       ;
POST      ;
 +1       ;queue the task to background for 5:00 AM following date of install
 +2       ;ZTRTN="QUE^DG53P597"
 +3        NEW QUETIME,X1,X2
 +4        SET X1=DT
           SET X2=1
           DO C^%DTC
 +5        SET QUETIME=X_".05"
 +6        SET ZTDTH=QUETIME
 +7        SET ZTIO=""
           SET ZTDESC="DG*5.3*597 POST-INSTALLATION TASK"
 +8        SET ZTRTN="QUE^DG53P597"
 +9        DO ^%ZTLOAD
 +10       IF '$GET(ZTSK)
               WRITE !!,"POST-INSTALL BACKGROUND TASK NOT QUEUED",!
               DO NOTASK
 +11       QUIT 
 +12      ;
QUE       ;entry point from TaskManager
 +1       ;
 +2       ;only update file #2 with data from file #712 record if date filed exists
 +3       ;(#3.4) LINK TO FILE #2 [10P:2]
 +4       ;(#4.3) APPLICANT E-MAIL [4F]
 +5       ;(#4.4) APPOINTMENT REQUESTED [5S]
 +6       ;(#7.1) FILING DATE [5D]
 +7        SET START=$$NOW^XLFDT()
 +8        SET REC712=0
           SET TOTAL=0
           SET UPDATES=0
 +9        FOR 
               SET REC712=$ORDER(^EAS(712,REC712))
               if 'REC712
                   QUIT 
               Begin DoDot:1
 +10               SET TOTAL=TOTAL+1
                   SET NEW=0
 +11               SET DFN=+$PIECE(^EAS(712,REC712,0),U,10)
                   SET FILED=+$PIECE($GET(^EAS(712,REC712,2)),U,5)
 +12               if 'DFN
                       QUIT 
 +13               if '$DATA(^DPT(DFN,0))
                       QUIT 
 +14               if 'FILED
                       QUIT 
 +15               SET EMAIL=$PIECE($GET(^EAS(712,REC712,1)),U,4)
                   SET APPTREQ=$PIECE($GET(^EAS(712,REC712,1)),U,5)
 +16               IF $PIECE($GET(^DPT(DFN,1010.15)),U,6)=""
                       SET NEW=1
 +17               SET IENS=DFN_","
 +18               KILL DATA
                   SET DATA(2,IENS,.133)=EMAIL
                   SET DATA(2,IENS,1010.156)=REC712
                   SET DATA(2,IENS,1010.159)=APPTREQ
 +19               KILL ERRMSG
                   DO FILE^DIE("","DATA","ERRMSG")
 +20               IF '$DATA(ERRMSG)
                       IF NEW
                           SET UPDATES=UPDATES+1
               End DoDot:1
 +21      ;when process of file #712 is complete
 +22       DO MESS(TOTAL,UPDATES,$GET(ZTSK),START)
 +23       QUIT 
 +24      ;
MESS(TOTAL,UPDATES,ZTSK,START) ;
 +1       ;send MailMan message to members of G.VA1010EZ as well installer of patch
 +2       ;to inform that job has completed and number of file #2 records updated.
 +3       ;
 +4        SET Y=START
           DO DD^%DT
           SET START=Y
 +5        IF $GET(ZTSK)
               SET MSG(1)="The post-installation background task (#"_ZTSK_") for DG*5.3*597,"
 +6        IF '$GET(ZTSK)
               SET MSG(1)="A post-installation update process for DG*5.3*597,"
 +7        SET MSG(2)="which started on "_START_", has completed."
 +8        SET MSG(3)=" "
 +9        SET MSG(4)="A total of "_TOTAL_" records in the 1010EZ HOLDING file (#712)"
 +10       SET MSG(5)="were processed."
 +11       SET MSG(6)=" "
 +12       SET MSG(7)=UPDATES_" records in the PATIENT file (#2) were updated as follows:"
 +13       SET MSG(8)="   Field #.133 from #712/#4.3"
 +14       SET MSG(9)="   Field #1010.156 from #712 IEN"
 +15       SET MSG(10)="   Field #1010.159 from #712/#4.4"
 +16       SET MSG(11)=" "
 +17       KILL XMY
 +18       SET XMDUZ=.5
           SET XMTEXT="MSG("
           SET XMY(DUZ)=""
           SET WHERE=^XMB("NETNAME")
           SET XMY("G.VA1010EZ@"_WHERE)=""
 +19       SET XMSUB="DG*5.3*597 Post-Installation Task Complete"
 +20       DO ^XMD
 +21       KILL DFN,MSG,NEW,REC712,TOTAL,UPDATES,WHERE,XMZ,XMY,XMDUZ
 +22       QUIT 
 +23      ;
NOTASK    ;
 +1       ;send MailMan message to members of G.VA1010EZ as well installer of patch
 +2       ;to inform that post-install job was not successfully tasked.
 +3       ;
 +4        SET MSG(1)="The post-installation background job for DG*5.3*597"
 +5        SET MSG(2)="was not successfully queued."
 +6        SET MSG(3)=" "
 +7        SET MSG(4)="Please have a member of IRM Service at your facility"
 +8        SET MSG(5)="run the post-installation update directly from"
 +9        SET MSG(6)="programmer mode by entering the following command:"
 +10       SET MSG(7)=" "
 +11       SET MSG(8)="D QUE^DG53P597"
 +12       SET MSG(9)=" "
 +13       SET MSG(10)="The process should take less than 30 minutes to complete."
 +14       KILL XMY
 +15       SET XMDUZ=.5
           SET XMTEXT="MSG("
           SET XMY(DUZ)=""
           SET WHERE=^XMB("NETNAME")
           SET XMY("G.VA1010EZ@"_WHERE)=""
 +16       SET XMSUB="DG*5.3*597 Post-Installation Failure"
 +17       DO ^XMD
 +18       KILL MSG,WHERE,XMZ,XMY,XMDUZ
 +19       QUIT