SDES864P ;ALB/MGD,ANU - SD*5.3*864 Post Init Routine ; Nov 02, 2023
;;5.3;SCHEDULING;**864**;AUG 13, 1993;Build 15
;;Per VHA Directive 6402, this routine should not be modified
;
Q
;
EN ; Update the VS GUI version in #409.98
D FIND
D TASK ;Update #409.85
Q
;
; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "O" if "OPEN" value found
; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "C" if "CLOSED" value found
TASK ;
D MES^XPDUTL("")
D MES^XPDUTL(" SD*5.3*864 Post-Install (Update of #409.85) is being queued ")
D MES^XPDUTL(" to run in the background. This Post-install will update ")
D MES^XPDUTL(" CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File")
D MES^XPDUTL(" to O if OPEN value found and update CURRENT STATUS (#23) ")
D MES^XPDUTL(" in SDEC APPT REQUEST (#409.85) File to C if CLOSED value found.")
D MES^XPDUTL("")
N ZTDESC,ZTRTN,ZTIO,ZTSK,X,ZTDTH,ZTSAVE
S ZTDESC="SD*5.3*864 Post Install Routine (Update of #409.85)"
D NOW^%DTC S ZTDTH=X,ZTIO="",ZTRTN="UPD85^SDES864P",ZTSAVE("*")="" D ^%ZTLOAD
I $D(ZTSK) D
. D MES^XPDUTL(" >>>Task "_ZTSK_" has been queued.")
. D MES^XPDUTL("")
I '$D(ZTSK) D
. D MES^XPDUTL(" UNABLE TO QUEUE THIS JOB.")
. D MES^XPDUTL(" Please contact the National Help Desk to report this issue.")
Q
;
FIND ;FIND THE IEN FOR "VS GUI NATIONAL"
N SDECDA,SDECDA1
D MES^XPDUTL("")
D MES^XPDUTL(" Updating SDEC SETTINGS file (#409.98)")
S SDECDA=0,SDECDA=$O(^SDEC(409.98,"B","VS GUI NATIONAL",SDECDA)) G:$G(SDECDA)="" NOFIND
D VERSION ;update GUI version number and date
Q
VERSION ;SET THE NEW VERSION UPDATE IN SDEC SETTING FILE #409.98 TO 1.7.51
S DA=SDECDA,DIE=409.98,DR="2///1.7.51;3///"_DT D ^DIE ;update VS GUI NATIONAL
K DIE,DR,DA
S SDECDA1=0,SDECDA1=$O(^SDEC(409.98,"B","VS GUI LOCAL",SDECDA1)) Q:$G(SDECDA1)="" ;get DA for the VS GUI LOCAL
S DA=SDECDA1,DIE=409.98,DR="2///1.7.51;3///"_DT D ^DIE ;update VS GUI LOCAL
K DIE,DR,DA
Q
;
NOFIND ;"VS GUI NATIONAL" NOT FOUND
D MES^XPDUTL(" VS GUI NATIONAL not found in the SDEC SETTINGS file (#409.98)")
Q
UPD85 ; entry point
;
; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "O" if "OPEN" value found
; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "C" if "CLOSED" value found
;
N SDDFN85,REQUESTIEN,SDCOUNT
S SDCOUNT=0
S ^XTMP("SDES864P",0)=$$FMADD^XLFDT(DT,30)_U_DT_U_"Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File."
;
;Loop through entries in file #409.85
S SDDFN85=0 F S SDDFN85=$O(^SDEC(409.85,"B",SDDFN85)) Q:SDDFN85'>0 D
.S REQUESTIEN="" F S REQUESTIEN=$O(^SDEC(409.85,"B",SDDFN85,REQUESTIEN)) Q:REQUESTIEN="" D
..N SDR85,FDA,ERR
..S SDR85=$G(^SDEC(409.85,REQUESTIEN,0)) Q:SDR85=""
..I $P($G(SDR85),"^",17)="OPEN" D
...S FDA(409.85,REQUESTIEN_",",23)="O"
...D FILE^DIE(,"FDA","ERR")
...;S $P(^SDEC(409.85,REQUESTIEN,0),"^",17)="O" ;Current status (#23)
...S SDCOUNT=SDCOUNT+1
..I $P($G(SDR85),"^",17)="CLOSED" D
...S FDA(409.85,REQUESTIEN_",",23)="C"
...D FILE^DIE(,"FDA","ERR")
...;S $P(^SDEC(409.85,REQUESTIEN,0),"^",17)="C"
...S SDCOUNT=SDCOUNT+1
S ^XTMP("SDES864P","STATUS","CNT")=SDCOUNT
D MAIL
Q
;
MAIL ;
; Get Station Number
;
N STANUM,MESS1,XMTEXT,XMSUB,XMY,XMDUZ,DIFROM,TEXT
S STANUM=$$KSP^XUPARAM("INST")_","
S STANUM=$$GET1^DIQ(4,STANUM,99)
S MESS1="Station: "_STANUM_" - "
;
; Send MailMan message
S XMDUZ=DUZ
S XMTEXT="TEXT("
S TEXT(1)="The SD*5.3*864 post install has run to completion."
S TEXT(2)="The data was reviewed and updated without any issues."
S XMSUB=MESS1_"SD*5.3*864 - Post Install Update"
S XMDUZ=.5,XMY(DUZ)="",XMY(XMDUZ)=""
D ^XMD
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDES864P 3773 printed Nov 22, 2024@18:05:12 Page 2
SDES864P ;ALB/MGD,ANU - SD*5.3*864 Post Init Routine ; Nov 02, 2023
+1 ;;5.3;SCHEDULING;**864**;AUG 13, 1993;Build 15
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 QUIT
+5 ;
EN ; Update the VS GUI version in #409.98
+1 DO FIND
+2 ;Update #409.85
DO TASK
+3 QUIT
+4 ;
+5 ; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "O" if "OPEN" value found
+6 ; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "C" if "CLOSED" value found
TASK ;
+1 DO MES^XPDUTL("")
+2 DO MES^XPDUTL(" SD*5.3*864 Post-Install (Update of #409.85) is being queued ")
+3 DO MES^XPDUTL(" to run in the background. This Post-install will update ")
+4 DO MES^XPDUTL(" CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File")
+5 DO MES^XPDUTL(" to O if OPEN value found and update CURRENT STATUS (#23) ")
+6 DO MES^XPDUTL(" in SDEC APPT REQUEST (#409.85) File to C if CLOSED value found.")
+7 DO MES^XPDUTL("")
+8 NEW ZTDESC,ZTRTN,ZTIO,ZTSK,X,ZTDTH,ZTSAVE
+9 SET ZTDESC="SD*5.3*864 Post Install Routine (Update of #409.85)"
+10 DO NOW^%DTC
SET ZTDTH=X
SET ZTIO=""
SET ZTRTN="UPD85^SDES864P"
SET ZTSAVE("*")=""
DO ^%ZTLOAD
+11 IF $DATA(ZTSK)
Begin DoDot:1
+12 DO MES^XPDUTL(" >>>Task "_ZTSK_" has been queued.")
+13 DO MES^XPDUTL("")
End DoDot:1
+14 IF '$DATA(ZTSK)
Begin DoDot:1
+15 DO MES^XPDUTL(" UNABLE TO QUEUE THIS JOB.")
+16 DO MES^XPDUTL(" Please contact the National Help Desk to report this issue.")
End DoDot:1
+17 QUIT
+18 ;
FIND ;FIND THE IEN FOR "VS GUI NATIONAL"
+1 NEW SDECDA,SDECDA1
+2 DO MES^XPDUTL("")
+3 DO MES^XPDUTL(" Updating SDEC SETTINGS file (#409.98)")
+4 SET SDECDA=0
SET SDECDA=$ORDER(^SDEC(409.98,"B","VS GUI NATIONAL",SDECDA))
if $GET(SDECDA)=""
GOTO NOFIND
+5 ;update GUI version number and date
DO VERSION
+6 QUIT
VERSION ;SET THE NEW VERSION UPDATE IN SDEC SETTING FILE #409.98 TO 1.7.51
+1 ;update VS GUI NATIONAL
SET DA=SDECDA
SET DIE=409.98
SET DR="2///1.7.51;3///"_DT
DO ^DIE
+2 KILL DIE,DR,DA
+3 ;get DA for the VS GUI LOCAL
SET SDECDA1=0
SET SDECDA1=$ORDER(^SDEC(409.98,"B","VS GUI LOCAL",SDECDA1))
if $GET(SDECDA1)=""
QUIT
+4 ;update VS GUI LOCAL
SET DA=SDECDA1
SET DIE=409.98
SET DR="2///1.7.51;3///"_DT
DO ^DIE
+5 KILL DIE,DR,DA
+6 QUIT
+7 ;
NOFIND ;"VS GUI NATIONAL" NOT FOUND
+1 DO MES^XPDUTL(" VS GUI NATIONAL not found in the SDEC SETTINGS file (#409.98)")
+2 QUIT
UPD85 ; entry point
+1 ;
+2 ; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "O" if "OPEN" value found
+3 ; Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File to "C" if "CLOSED" value found
+4 ;
+5 NEW SDDFN85,REQUESTIEN,SDCOUNT
+6 SET SDCOUNT=0
+7 SET ^XTMP("SDES864P",0)=$$FMADD^XLFDT(DT,30)_U_DT_U_"Update CURRENT STATUS (#23) in SDEC APPT REQUEST (#409.85) File."
+8 ;
+9 ;Loop through entries in file #409.85
+10 SET SDDFN85=0
FOR
SET SDDFN85=$ORDER(^SDEC(409.85,"B",SDDFN85))
if SDDFN85'>0
QUIT
Begin DoDot:1
+11 SET REQUESTIEN=""
FOR
SET REQUESTIEN=$ORDER(^SDEC(409.85,"B",SDDFN85,REQUESTIEN))
if REQUESTIEN=""
QUIT
Begin DoDot:2
+12 NEW SDR85,FDA,ERR
+13 SET SDR85=$GET(^SDEC(409.85,REQUESTIEN,0))
if SDR85=""
QUIT
+14 IF $PIECE($GET(SDR85),"^",17)="OPEN"
Begin DoDot:3
+15 SET FDA(409.85,REQUESTIEN_",",23)="O"
+16 DO FILE^DIE(,"FDA","ERR")
+17 ;S $P(^SDEC(409.85,REQUESTIEN,0),"^",17)="O" ;Current status (#23)
+18 SET SDCOUNT=SDCOUNT+1
End DoDot:3
+19 IF $PIECE($GET(SDR85),"^",17)="CLOSED"
Begin DoDot:3
+20 SET FDA(409.85,REQUESTIEN_",",23)="C"
+21 DO FILE^DIE(,"FDA","ERR")
+22 ;S $P(^SDEC(409.85,REQUESTIEN,0),"^",17)="C"
+23 SET SDCOUNT=SDCOUNT+1
End DoDot:3
End DoDot:2
End DoDot:1
+24 SET ^XTMP("SDES864P","STATUS","CNT")=SDCOUNT
+25 DO MAIL
+26 QUIT
+27 ;
MAIL ;
+1 ; Get Station Number
+2 ;
+3 NEW STANUM,MESS1,XMTEXT,XMSUB,XMY,XMDUZ,DIFROM,TEXT
+4 SET STANUM=$$KSP^XUPARAM("INST")_","
+5 SET STANUM=$$GET1^DIQ(4,STANUM,99)
+6 SET MESS1="Station: "_STANUM_" - "
+7 ;
+8 ; Send MailMan message
+9 SET XMDUZ=DUZ
+10 SET XMTEXT="TEXT("
+11 SET TEXT(1)="The SD*5.3*864 post install has run to completion."
+12 SET TEXT(2)="The data was reviewed and updated without any issues."
+13 SET XMSUB=MESS1_"SD*5.3*864 - Post Install Update"
+14 SET XMDUZ=.5
SET XMY(DUZ)=""
SET XMY(XMDUZ)=""
+15 DO ^XMD
+16 QUIT
+17 ;