DG53B563 ;ALB/PJR - DOD Enhancement Post-Install ; 12/30/04 3:53pm
;;5.3;Registration;**563**; Aug 13,1993
;This post install routine will loop through patient file (#2)
;and delete the DEATH ENTERED BY field
;for all entries that have NO value in the DATE OF DEATH field (#.351)
;but DO have a value in the DEATH ENTERED BY field (#.352)
Q
;
EP ;Entry point
N OK
D CHK Q:'OK
D MSG
D QUETASK
Q
;
QUETASK ;Queue the task
N TXT,ZTRTN,ZTDESC,ZTSK,ZTIO,ZTDTH
S ZTRTN="EP1^DG53B563",ZTIO="",ZTDTH=$$NOW^XLFDT()
S ZTDESC="DOD ENHANCEMENT POST-INSTALL"
K ^XTMP("DG53B563")
D ^%ZTLOAD S ^XTMP("DG53B563","TASK")=ZTSK
S TXT(1)="Task: "_ZTSK_" Queued."
D BMES^XPDUTL(.TXT)
Q
;
EP1 ;Entry point
N ZCNT,ZIEN,ZEND,ZDATE,ZEDATE,DA,DIE,DR,ZCK,ZII,ZXX,X
L +^XTMP("DG53B563"):1 E Q
S (ZIEN,ZCNT)=0
S ZDATE=$$DT^XLFDT D DG53
S ^XTMP("DG53B563",0)=ZCNT_U_ZDATE_U_X
S $P(^XTMP("DG53B563","DATE"),"^")=$$FMTE^XLFDT($$NOW^XLFDT(),"5P")
D LMINUS
;Loop through patient file
F S ZIEN=$O(^DPT(ZIEN)) Q:'ZIEN D
.S ZXX=$G(^DPT(ZIEN,.35)),ZCK=0 I ZXX=""!ZXX Q
.F ZII=1,2,3,5 I $P(ZXX,U,ZII)]"" S ZCK=1 D
..S DA=ZIEN,DIE="^DPT(",DR=".35"_ZII_"////@" D ^DIE
.I ZCK S ZCNT=ZCNT+1 ;Tot records updated
S $P(^XTMP("DG53B563","DATE"),"^",2)=$$FMTE^XLFDT($$NOW^XLFDT(),"5P")
S ZDATE=$$DT^XLFDT,ZEDATE=$$FMTE^XLFDT(DT) D DG53
S ^XTMP("DG53B563",0)=ZCNT_U_ZDATE_U_X
S ^XTMP("DG53B563","COMPLETED")=1 D MAIL
D DG53 S X="The "_X_" process is complete."
D BMES^XPDUTL(X)
Q
;
CHK ;check for completion
N TXT,TASKNUM,STAT
S OK=1 L +^XTMP("DG53B563"):1 E D Q
.S OK=0 D DG53 S TXT(1)=X_" process has a lock table"
.S TXT(2)="problem. Nothing Done!"
.D BMES^XPDUTL(.TXT),LMINUS
;
I $G(^XTMP("DG53B563","COMPLETED")) D Q
.S OK=0 D DG53 S TXT(1)=X_" process was completed in a"
.S TXT(2)="previous run. Nothing Done!"
.D BMES^XPDUTL(.TXT),LMINUS
;
S TASKNUM=$G(^XTMP("DG53B563","TASK"))
I +TASKNUM D Q
.S STAT=$$ACTIVE(TASKNUM)
.I STAT>0 D
..S OK=0 D DG53
..S TXT(1)="Task: "_TASKNUM_" is currently running the"
..S TXT(2)=X_" process."
..S TXT(3)="Duplicate processes cannot be started."
..D BMES^XPDUTL(.TXT)
.D LMINUS
;
D LMINUS Q
;
MSG ;create bulletin message in install file.
N TXT
S TXT(1)="This Post Install routine will loop through the Patient (#2) file"
S TXT(2)="and delete the DEATH ENTERED BY field for all patients"
S TXT(3)="that have NO value in the DATE OF DEATH (#.531) field"
S TXT(4)="but DO have a value in the DEATH ENTERED BY field."
S TXT(5)=" "
D BMES^XPDUTL(.TXT)
Q
;
MAIL N SITE,STATN,SITENM,XMDUZ,XMSUB,XMY,XMTEXT,MSG
S SITE=$$SITE^VASITE,STATN=$P($G(SITE),"^",3),SITENM=$P($G(SITE),"^",2)
S:$$GET1^DIQ(869.3,"1,",.03,"I")'="P" STATN=STATN_" [TEST]"
D DG53 S XMDUZ=X,XMSUB=XMDUZ_" - "_STATN_" (DG*5.3*563)"
S (XMY(DUZ),XMY(.5))=""
S XMTEXT="MSG(" D DG53
S MSG(1)="The "_X_" process"
S MSG(2)="has completed successfully."
S MSG(3)="Task: "_$G(^XTMP("DG53B563","TASK"))
S MSG(4)=""
S MSG(5)="Site Station number: "_STATN
S MSG(6)="Site Name: "_SITENM
S MSG(7)=""
S MSG(8)="Process started at : "_$P($G(^XTMP("DG53B563","DATE")),"^",1)
S MSG(8)="Process completed at : "_$P($G(^XTMP("DG53B563","DATE")),"^",2)
S MSG(10)="Total Veterans updated: "_+$G(^XTMP("DG53B563",0))
D ^XMD
Q
;
;
ACTIVE(TASK) ;Checks if task is running
; input -- The taskman ID
; output -- 1=The task is running
; 0=The task is not running
N STAT,ZTSK,Y
S STAT=0,ZTSK=+TASK
D STAT^%ZTLOAD
S Y=ZTSK(1)
I Y=0 S STAT=-1
I ",1,2,"[(","_Y_",") S STAT=1
I ",3,5,"[(","_Y_",") S STAT=0
Q STAT
DG53 S X="DG*5.3*563 DOD Post-Install cleanup DEATH ENTERED BY" Q
LMINUS L -^XTMP("DG53B563") Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDG53B563 3786 printed Nov 22, 2024@17:49:33 Page 2
DG53B563 ;ALB/PJR - DOD Enhancement Post-Install ; 12/30/04 3:53pm
+1 ;;5.3;Registration;**563**; Aug 13,1993
+2 ;This post install routine will loop through patient file (#2)
+3 ;and delete the DEATH ENTERED BY field
+4 ;for all entries that have NO value in the DATE OF DEATH field (#.351)
+5 ;but DO have a value in the DEATH ENTERED BY field (#.352)
+6 QUIT
+7 ;
EP ;Entry point
+1 NEW OK
+2 DO CHK
if 'OK
QUIT
+3 DO MSG
+4 DO QUETASK
+5 QUIT
+6 ;
QUETASK ;Queue the task
+1 NEW TXT,ZTRTN,ZTDESC,ZTSK,ZTIO,ZTDTH
+2 SET ZTRTN="EP1^DG53B563"
SET ZTIO=""
SET ZTDTH=$$NOW^XLFDT()
+3 SET ZTDESC="DOD ENHANCEMENT POST-INSTALL"
+4 KILL ^XTMP("DG53B563")
+5 DO ^%ZTLOAD
SET ^XTMP("DG53B563","TASK")=ZTSK
+6 SET TXT(1)="Task: "_ZTSK_" Queued."
+7 DO BMES^XPDUTL(.TXT)
+8 QUIT
+9 ;
EP1 ;Entry point
+1 NEW ZCNT,ZIEN,ZEND,ZDATE,ZEDATE,DA,DIE,DR,ZCK,ZII,ZXX,X
+2 LOCK +^XTMP("DG53B563"):1
IF '$TEST
QUIT
+3 SET (ZIEN,ZCNT)=0
+4 SET ZDATE=$$DT^XLFDT
DO DG53
+5 SET ^XTMP("DG53B563",0)=ZCNT_U_ZDATE_U_X
+6 SET $PIECE(^XTMP("DG53B563","DATE"),"^")=$$FMTE^XLFDT($$NOW^XLFDT(),"5P")
+7 DO LMINUS
+8 ;Loop through patient file
+9 FOR
SET ZIEN=$ORDER(^DPT(ZIEN))
if 'ZIEN
QUIT
Begin DoDot:1
+10 SET ZXX=$GET(^DPT(ZIEN,.35))
SET ZCK=0
IF ZXX=""!ZXX
QUIT
+11 FOR ZII=1,2,3,5
IF $PIECE(ZXX,U,ZII)]""
SET ZCK=1
Begin DoDot:2
+12 SET DA=ZIEN
SET DIE="^DPT("
SET DR=".35"_ZII_"////@"
DO ^DIE
End DoDot:2
+13 ;Tot records updated
IF ZCK
SET ZCNT=ZCNT+1
End DoDot:1
+14 SET $PIECE(^XTMP("DG53B563","DATE"),"^",2)=$$FMTE^XLFDT($$NOW^XLFDT(),"5P")
+15 SET ZDATE=$$DT^XLFDT
SET ZEDATE=$$FMTE^XLFDT(DT)
DO DG53
+16 SET ^XTMP("DG53B563",0)=ZCNT_U_ZDATE_U_X
+17 SET ^XTMP("DG53B563","COMPLETED")=1
DO MAIL
+18 DO DG53
SET X="The "_X_" process is complete."
+19 DO BMES^XPDUTL(X)
+20 QUIT
+21 ;
CHK ;check for completion
+1 NEW TXT,TASKNUM,STAT
+2 SET OK=1
LOCK +^XTMP("DG53B563"):1
IF '$TEST
Begin DoDot:1
+3 SET OK=0
DO DG53
SET TXT(1)=X_" process has a lock table"
+4 SET TXT(2)="problem. Nothing Done!"
+5 DO BMES^XPDUTL(.TXT)
DO LMINUS
End DoDot:1
QUIT
+6 ;
+7 IF $GET(^XTMP("DG53B563","COMPLETED"))
Begin DoDot:1
+8 SET OK=0
DO DG53
SET TXT(1)=X_" process was completed in a"
+9 SET TXT(2)="previous run. Nothing Done!"
+10 DO BMES^XPDUTL(.TXT)
DO LMINUS
End DoDot:1
QUIT
+11 ;
+12 SET TASKNUM=$GET(^XTMP("DG53B563","TASK"))
+13 IF +TASKNUM
Begin DoDot:1
+14 SET STAT=$$ACTIVE(TASKNUM)
+15 IF STAT>0
Begin DoDot:2
+16 SET OK=0
DO DG53
+17 SET TXT(1)="Task: "_TASKNUM_" is currently running the"
+18 SET TXT(2)=X_" process."
+19 SET TXT(3)="Duplicate processes cannot be started."
+20 DO BMES^XPDUTL(.TXT)
End DoDot:2
+21 DO LMINUS
End DoDot:1
QUIT
+22 ;
+23 DO LMINUS
QUIT
+24 ;
MSG ;create bulletin message in install file.
+1 NEW TXT
+2 SET TXT(1)="This Post Install routine will loop through the Patient (#2) file"
+3 SET TXT(2)="and delete the DEATH ENTERED BY field for all patients"
+4 SET TXT(3)="that have NO value in the DATE OF DEATH (#.531) field"
+5 SET TXT(4)="but DO have a value in the DEATH ENTERED BY field."
+6 SET TXT(5)=" "
+7 DO BMES^XPDUTL(.TXT)
+8 QUIT
+9 ;
MAIL NEW SITE,STATN,SITENM,XMDUZ,XMSUB,XMY,XMTEXT,MSG
+1 SET SITE=$$SITE^VASITE
SET STATN=$PIECE($GET(SITE),"^",3)
SET SITENM=$PIECE($GET(SITE),"^",2)
+2 if $$GET1^DIQ(869.3,"1,",.03,"I")'="P"
SET STATN=STATN_" [TEST]"
+3 DO DG53
SET XMDUZ=X
SET XMSUB=XMDUZ_" - "_STATN_" (DG*5.3*563)"
+4 SET (XMY(DUZ),XMY(.5))=""
+5 SET XMTEXT="MSG("
DO DG53
+6 SET MSG(1)="The "_X_" process"
+7 SET MSG(2)="has completed successfully."
+8 SET MSG(3)="Task: "_$GET(^XTMP("DG53B563","TASK"))
+9 SET MSG(4)=""
+10 SET MSG(5)="Site Station number: "_STATN
+11 SET MSG(6)="Site Name: "_SITENM
+12 SET MSG(7)=""
+13 SET MSG(8)="Process started at : "_$PIECE($GET(^XTMP("DG53B563","DATE")),"^",1)
+14 SET MSG(8)="Process completed at : "_$PIECE($GET(^XTMP("DG53B563","DATE")),"^",2)
+15 SET MSG(10)="Total Veterans updated: "_+$GET(^XTMP("DG53B563",0))
+16 DO ^XMD
+17 QUIT
+18 ;
+19 ;
ACTIVE(TASK) ;Checks if task is running
+1 ; input -- The taskman ID
+2 ; output -- 1=The task is running
+3 ; 0=The task is not running
+4 NEW STAT,ZTSK,Y
+5 SET STAT=0
SET ZTSK=+TASK
+6 DO STAT^%ZTLOAD
+7 SET Y=ZTSK(1)
+8 IF Y=0
SET STAT=-1
+9 IF ",1,2,"[(","_Y_",")
SET STAT=1
+10 IF ",3,5,"[(","_Y_",")
SET STAT=0
+11 QUIT STAT
DG53 SET X="DG*5.3*563 DOD Post-Install cleanup DEATH ENTERED BY"
QUIT
LMINUS LOCK -^XTMP("DG53B563")
QUIT