SD53105A ;ALB/JRP - XMIT, DELETE, AND ERROR FILE CLEAN UP;12-MAR-1997
;;5.3;Scheduling;**105,1015**;Aug 13, 1993;Build 21
;
SCAN ;Entry point to scan only (prints what would have been deleted)
N ZTRTN,ZTDESC
D INTRO
W !
W !,"You are running this routine in scan mode, which will only identify"
W !,"the problems corrected. Please select a device (queueing allowed) so"
W !,"that a listing of what would have been done can be obtained."
W !!
S ZTRTN="EN^SD53105A(1)"
S ZTDESC="ACRP cleanup of files 409.73, 409.74, and 409.75"
D EN^XUTMDEVQ(ZTRTN,ZTDESC)
Q
;
FIX ;Entry point to schedule clean up
N ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK,TXT
D INTRO
W !
W !,"Please enter the date/time that you would like this clean up queued to"
W !,"run. A summary of what was done will be sent to you and the"
W !,"recipients of the SCDX AMBCARE TO NPCDB SUMMARY bulletin."
W !!
S ZTRTN="EN^SD53105A(0)"
S ZTDESC="ACRP cleanup of files 409.73, 409.74, and 409.75"
S ZTDTH=""
S ZTIO=""
D ^%ZTLOAD
W:(+$G(ZTSK)) !,"Scheduled as task number ",ZTSK
W:('$G(ZTSK)) !,"** Unable to schedule correction **"
Q
;
INTRO ;Print intro text
W !!,"This routine will clean up dangling pointers and orphan entries within"
W !,"the ACRP transmission files. The following actions/checks will be"
W !,"performed:"
W !
W !,"(1) Entries in the Transmitted Outpatient Encounter file (409.73)"
W !," that do not have a valid pointer to the Outpatient Encounter"
W !," file (#409.68) or the Deleted Outpatient Encounter file"
W !," (#409.74) are deleted."
W !
W !,"(2) Entries in the Transmitted Outpatient Encounter file that have"
W !," been rejected by the Austin Automation Center and do not have an"
W !," entry in the Transmitted Outpatient Encounter Error file"
W !," (#409.75) are marked for re-transmission."
W !
W !,"(3) Entries in the Deleted Outpatient Encounter file that do not"
W !," have a corresponding entry in the Transmitted Outpatient"
W !," Encounter file are deleted."
W !
W !,"(4) Entries in the Transmitted Outpatient Encounter Error file that"
W !," do not have a valid pointer to the Transmitted Outpatient"
W !," Encounter file are deleted."
Q
;
EN(SCANMODE) ;Main entry point
; Routine deletes entries in the Transmitted Outpatient Encounter file
; (409.73) that do not have a valid pointer to the Outpatient Encounter
; file (#409.68) or the Deleted Outpatient Encounter file (#409.74).
;
; Routine marks entries in the Transmitted Outpatient Encounter file
; that have been rejected by the Austin Automation Center and do not
; have an entry in the Transmitted Outpatient Encounter Error file
; (#409.75) for re-transmission.
;
; Routine deletes entries in the Deleted Outpatient Encounter file that
; do not have a corresponding entry in the Transmitted Outpatient
; Encounter file.
;
; Routine deletes entries in the Transmitted Outpatient Encounter Error
; file that do not have a valid pointer to the Transmitted Outpatient
; Encounter file.
;
;Input : SCANMODE - Flag denoting if routine should only scan
; for errors and not fix them
; 0 = No - scan and fix (default)
; 1 = Yes - scan but don't fix
;Output : None
;Notes : A completion/summary bulletin will be sent to the current
; user and the recipients of the SCDX AMBCARE TO NPCDB SUMMARY
; bulletin. This bulletin will not be sent if in scan mode.
;
;Declare variables
N XMITPTR,XMITTOT,XMITDEL,XMITXMIT,ENCPTR,DELPTR,DELTOT,DELDEL,ERRPTR
N ERRTOT,ERRDEL,NODE,TMP,DIK,DA,X,Y
S SCANMODE=+$G(SCANMODE)
;Initialize counters
S (XMITTOT,XMITDELE,XMITDELD,XMITXMIT,DELTOT,DELDEL,ERRTOT,ERRDEL)=0
;Initialize summary location
K ^TMP($J,"SD53105A")
S ^TMP($J,"SD53105A","XMIT")="^^^"
S ^TMP($J,"SD53105A","DEL")="^"
S ^TMP($J,"SD53105A","ERR")="^"
S ^TMP($J,"SD53105A","STOP")=0
;Remember starting time
S ^TMP($J,"SD53105A","TIME")=$$NOW^XLFDT()
I (SCANMODE) D
.W !
.W !,"Scanning of the Transmitted Outpatient Encounter, Deleted Outpatient"
.W !,"Encounter, and Transmitted Outpatient Encounter Error files for known"
.W !,"problems started on "_$$FMTE^XLFDT($$NOW^XLFDT())
.W !
;Loop through Transmitted Outpatient Encounter file (#409.73)
I (SCANMODE) D
.W !!
.W !,"The following entries in the Transmitted Outpatient Encounter"
.W !,"file (#409.73) will be acted upon when run in fix mode"
.W !,$$REPEAT^SCDXUTL1("=",70)
S XMITPTR=0
F S XMITPTR=+$O(^SD(409.73,XMITPTR)) Q:('XMITPTR) D Q:($G(ZTSTOP))
.;Increment total entries checked
.S XMITTOT=XMITTOT+1
.;Grab zero node
.S NODE=$G(^SD(409.73,XMITPTR,0))
.;Get Outpatient Encounter & Deleted Outpatient Encounter pointers
.S ENCPTR=+$P(NODE,"^",2)
.S DELPTR=+$P(NODE,"^",3)
.;Validate pointer to Outpatient Encounter
.I (ENCPTR) D
..Q:($D(^SCE(ENCPTR,0)))
..;Invalid - delete entry and increment deletion count
..S:('SCANMODE) TMP=$$DELXMIT^SCDXFU03(XMITPTR,0)
..W:(SCANMODE) !,"^SD(409.73,",XMITPTR,",0) has bad pointer to Outpatient Encounter file"
..S XMITDELE=XMITDELE+1
.;Validate pointer to Deleted Outpatient Encounter
.I (DELPTR) D
..Q:($D(^SD(409.74,DELPTR,0)))
..;Invalid - delete entry and increment deletion count
..S:('SCANMODE) TMP=$$DELXMIT^SCDXFU03(XMITPTR,0)
..W:(SCANMODE) !,"^SD(409.73,",XMITPTR,",0) has bad pointer to Deleted Outpatient Encounter file"
..S XMITDELD=XMITDELD+1
.;Check for rejection without entry in Transmitted Outpatient Encounter
.; Error file (#409.75)
.S TMP=$G(^SD(409.73,XMITPTR,1))
.I ($P(TMP,"^",5)="R") D:('$D(^SD(409.75,"B",XMITPTR)))
..;Mark for retransmission
..D:('SCANMODE) STREEVNT^SCDXFU01(XMITPTR)
..D:('SCANMODE) XMITFLAG^SCDXFU01(XMITPTR)
..W:(SCANMODE) !,"^SD(409.73,",XMITPTR,",0) rejected with no reason on file (entry in 409.75)"
..;Increment retransmission counter
..S XMITXMIT=XMITXMIT+1
.;Check for request to stop
.S:($$S^%ZTLOAD("Last entry in Transmitted Outpatient Encounter file checked >> "_XMITPTR)) ZTSTOP=1
;Remember totals
S ^TMP($J,"SD53105A","XMIT")=XMITTOT_"^"_XMITDELE_"^"_XMITDELD_"^"_XMITXMIT
I (SCANMODE) D
.W !
.W !,XMITTOT," entries where checked"
.W !,?2,XMITXMIT," would have been marked for retransmission"
.W !,?2,(XMITDELE+XMITDELD)," would have been deleted"
.W !,?4,(XMITDELE)," have bad Outpatient Encounter pointers"
.W !,?4,(XMITDELD)," have bad Deleted Outpatient Encounter pointers"
;Asked to stop
I $G(ZTSTOP) G EN1
;Loop through Deleted Outpatient Encounter file (#409.74)
I (SCANMODE) D
.W !!!
.W !,"The following entries in the Deleted Outpatient Encounter"
.W !,"file (#409.74) will be deleted when run in fix mode"
.W !,$$REPEAT^SCDXUTL1("=",70)
S DELPTR=0
F S DELPTR=+$O(^SD(409.74,DELPTR)) Q:('DELPTR) D Q:($G(ZTSTOP))
.;Increment total entries checked
.S DELTOT=DELTOT+1
.;Check for entry in Transmitted Outpatient Encounter file
.I ('$D(^SD(409.73,"ADEL",DELPTR))) D
..;Not found - delete entry and increment deletion count
..I ('SCANMODE) S DA=DELPTR,DIK="^SD(409.74," D ^DIK K DA,DIK,X,Y
..W:(SCANMODE) !,"^SD(409.74,",DELPTR,",0) not in Transmitted Outpatient Encounter file"
..S DELDEL=DELDEL+1
.;Check for request to stop
.S:($$S^%ZTLOAD("Last entry in Deleted Outpatient Encounter file checked >> "_DELPTR)) ZTSTOP=1
;Remember totals
S ^TMP($J,"SD53105A","DEL")=DELTOT_"^"_DELDEL
W:(SCANMODE) !!,DELTOT," entries where checked and ",DELDEL," would have been deleted"
;Asked to stop
I $G(ZTSTOP) G EN1
;Loop through Transmitted Outpatient Encounter Error file (#409.75)
I (SCANMODE) D
.W !!!
.W !,"The following entries in the Transmitted Outpatient Encounter"
.W !,"Error file (#409.75) will be deleted when run in fix mode"
.W !,$$REPEAT^SCDXUTL1("=",70)
S ERRPTR=0
F S ERRPTR=+$O(^SD(409.75,ERRPTR)) Q:('ERRPTR) D Q:($G(ZTSTOP))
.;Increment total entries checked
.S ERRTOT=ERRTOT+1
.;Get pointer to Transmitted Outpatient Encounter file
.S XMITPTR=+$G(^SD(409.75,ERRPTR,0))
.;Validate pointer
.I ('$D(^SD(409.73,XMITPTR,0))) D
..;Invalid - delete entry and increment deletion count
..S:('SCANMODE) TMP=$$DELERR^SCDXFU02(ERRPTR)
..W:(SCANMODE) !,"^SD(409.75,",ERRPTR,",0) has bad pointer to Transmitted Outpatient Encounter file"
..S ERRDEL=ERRDEL+1
.;Check for request to stop
.S:($$S^%ZTLOAD("Last entry in Transmitted Outpatient Encounter Error file checked >> "_ERRPTR)) ZTSTOP=1
;Remember totals
S ^TMP($J,"SD53105A","ERR")=ERRTOT_"^"_ERRDEL
W:(SCANMODE) !!,ERRTOT," entries where checked and ",ERRDEL," would have been deleted"
EN1 ;Remember ending time
S $P(^TMP($J,"SD53105A","TIME"),"^",2)=$$NOW^XLFDT()
I (SCANMODE) D
.W !!!,"Scan ended on ",$$FMTE^XLFDT($$NOW^XLFDT())
.W !!!,"Use the entry point FIX^SD53105A to run in fix mode"
.W !,"Use the entry point SCAN^SD53105A to re-run in scan mode"
;Remember if requested to stop
S ^TMP($J,"SD53105A","STOP")=+$G(ZTSTOP)
;Send completion/summary bulletin
D:('SCANMODE) BULL1^SD53105C
;Done - clean up and quit
K ^TMP($J,"SD53105A")
S:($D(ZTQUEUED)) ZTREQ="@"
Q
SD53105A ;ALB/JRP - XMIT, DELETE, AND ERROR FILE CLEAN UP;12-MAR-1997
+1 ;;5.3;Scheduling;**105,1015**;Aug 13, 1993;Build 21
+2 ;
SCAN ;Entry point to scan only (prints what would have been deleted)
+1 NEW ZTRTN,ZTDESC
+2 DO INTRO
+3 WRITE !
+4 WRITE !,"You are running this routine in scan mode, which will only identify"
+5 WRITE !,"the problems corrected. Please select a device (queueing allowed) so"
+6 WRITE !,"that a listing of what would have been done can be obtained."
+7 WRITE !!
+8 SET ZTRTN="EN^SD53105A(1)"
+9 SET ZTDESC="ACRP cleanup of files 409.73, 409.74, and 409.75"
+10 DO EN^XUTMDEVQ(ZTRTN,ZTDESC)
+11 QUIT
+12 ;
FIX ;Entry point to schedule clean up
+1 NEW ZTRTN,ZTDESC,ZTDTH,ZTIO,ZTSK,TXT
+2 DO INTRO
+3 WRITE !
+4 WRITE !,"Please enter the date/time that you would like this clean up queued to"
+5 WRITE !,"run. A summary of what was done will be sent to you and the"
+6 WRITE !,"recipients of the SCDX AMBCARE TO NPCDB SUMMARY bulletin."
+7 WRITE !!
+8 SET ZTRTN="EN^SD53105A(0)"
+9 SET ZTDESC="ACRP cleanup of files 409.73, 409.74, and 409.75"
+10 SET ZTDTH=""
+11 SET ZTIO=""
+12 DO ^%ZTLOAD
+13 IF (+$GET(ZTSK))
WRITE !,"Scheduled as task number ",ZTSK
+14 IF ('$GET(ZTSK))
WRITE !,"** Unable to schedule correction **"
+15 QUIT
+16 ;
INTRO ;Print intro text
+1 WRITE !!,"This routine will clean up dangling pointers and orphan entries within"
+2 WRITE !,"the ACRP transmission files. The following actions/checks will be"
+3 WRITE !,"performed:"
+4 WRITE !
+5 WRITE !,"(1) Entries in the Transmitted Outpatient Encounter file (409.73)"
+6 WRITE !," that do not have a valid pointer to the Outpatient Encounter"
+7 WRITE !," file (#409.68) or the Deleted Outpatient Encounter file"
+8 WRITE !," (#409.74) are deleted."
+9 WRITE !
+10 WRITE !,"(2) Entries in the Transmitted Outpatient Encounter file that have"
+11 WRITE !," been rejected by the Austin Automation Center and do not have an"
+12 WRITE !," entry in the Transmitted Outpatient Encounter Error file"
+13 WRITE !," (#409.75) are marked for re-transmission."
+14 WRITE !
+15 WRITE !,"(3) Entries in the Deleted Outpatient Encounter file that do not"
+16 WRITE !," have a corresponding entry in the Transmitted Outpatient"
+17 WRITE !," Encounter file are deleted."
+18 WRITE !
+19 WRITE !,"(4) Entries in the Transmitted Outpatient Encounter Error file that"
+20 WRITE !," do not have a valid pointer to the Transmitted Outpatient"
+21 WRITE !," Encounter file are deleted."
+22 QUIT
+23 ;
EN(SCANMODE) ;Main entry point
+1 ; Routine deletes entries in the Transmitted Outpatient Encounter file
+2 ; (409.73) that do not have a valid pointer to the Outpatient Encounter
+3 ; file (#409.68) or the Deleted Outpatient Encounter file (#409.74).
+4 ;
+5 ; Routine marks entries in the Transmitted Outpatient Encounter file
+6 ; that have been rejected by the Austin Automation Center and do not
+7 ; have an entry in the Transmitted Outpatient Encounter Error file
+8 ; (#409.75) for re-transmission.
+9 ;
+10 ; Routine deletes entries in the Deleted Outpatient Encounter file that
+11 ; do not have a corresponding entry in the Transmitted Outpatient
+12 ; Encounter file.
+13 ;
+14 ; Routine deletes entries in the Transmitted Outpatient Encounter Error
+15 ; file that do not have a valid pointer to the Transmitted Outpatient
+16 ; Encounter file.
+17 ;
+18 ;Input : SCANMODE - Flag denoting if routine should only scan
+19 ; for errors and not fix them
+20 ; 0 = No - scan and fix (default)
+21 ; 1 = Yes - scan but don't fix
+22 ;Output : None
+23 ;Notes : A completion/summary bulletin will be sent to the current
+24 ; user and the recipients of the SCDX AMBCARE TO NPCDB SUMMARY
+25 ; bulletin. This bulletin will not be sent if in scan mode.
+26 ;
+27 ;Declare variables
+28 NEW XMITPTR,XMITTOT,XMITDEL,XMITXMIT,ENCPTR,DELPTR,DELTOT,DELDEL,ERRPTR
+29 NEW ERRTOT,ERRDEL,NODE,TMP,DIK,DA,X,Y
+30 SET SCANMODE=+$GET(SCANMODE)
+31 ;Initialize counters
+32 SET (XMITTOT,XMITDELE,XMITDELD,XMITXMIT,DELTOT,DELDEL,ERRTOT,ERRDEL)=0
+33 ;Initialize summary location
+34 KILL ^TMP($JOB,"SD53105A")
+35 SET ^TMP($JOB,"SD53105A","XMIT")="^^^"
+36 SET ^TMP($JOB,"SD53105A","DEL")="^"
+37 SET ^TMP($JOB,"SD53105A","ERR")="^"
+38 SET ^TMP($JOB,"SD53105A","STOP")=0
+39 ;Remember starting time
+40 SET ^TMP($JOB,"SD53105A","TIME")=$$NOW^XLFDT()
+41 IF (SCANMODE)
Begin DoDot:1
+42 WRITE !
+43 WRITE !,"Scanning of the Transmitted Outpatient Encounter, Deleted Outpatient"
+44 WRITE !,"Encounter, and Transmitted Outpatient Encounter Error files for known"
+45 WRITE !,"problems started on "_$$FMTE^XLFDT($$NOW^XLFDT())
+46 WRITE !
End DoDot:1
+47 ;Loop through Transmitted Outpatient Encounter file (#409.73)
+48 IF (SCANMODE)
Begin DoDot:1
+49 WRITE !!
+50 WRITE !,"The following entries in the Transmitted Outpatient Encounter"
+51 WRITE !,"file (#409.73) will be acted upon when run in fix mode"
+52 WRITE !,$$REPEAT^SCDXUTL1("=",70)
End DoDot:1
+53 SET XMITPTR=0
+54 FOR
SET XMITPTR=+$ORDER(^SD(409.73,XMITPTR))
IF ('XMITPTR)
QUIT
Begin DoDot:1
+55 ;Increment total entries checked
+56 SET XMITTOT=XMITTOT+1
+57 ;Grab zero node
+58 SET NODE=$GET(^SD(409.73,XMITPTR,0))
+59 ;Get Outpatient Encounter & Deleted Outpatient Encounter pointers
+60 SET ENCPTR=+$PIECE(NODE,"^",2)
+61 SET DELPTR=+$PIECE(NODE,"^",3)
+62 ;Validate pointer to Outpatient Encounter
+63 IF (ENCPTR)
Begin DoDot:2
+64 IF ($DATA(^SCE(ENCPTR,0)))
QUIT
+65 ;Invalid - delete entry and increment deletion count
+66 IF ('SCANMODE)
SET TMP=$$DELXMIT^SCDXFU03(XMITPTR,0)
+67 IF (SCANMODE)
WRITE !,"^SD(409.73,",XMITPTR,",0) has bad pointer to Outpatient Encounter file"
+68 SET XMITDELE=XMITDELE+1
End DoDot:2
+69 ;Validate pointer to Deleted Outpatient Encounter
+70 IF (DELPTR)
Begin DoDot:2
+71 IF ($DATA(^SD(409.74,DELPTR,0)))
QUIT
+72 ;Invalid - delete entry and increment deletion count
+73 IF ('SCANMODE)
SET TMP=$$DELXMIT^SCDXFU03(XMITPTR,0)
+74 IF (SCANMODE)
WRITE !,"^SD(409.73,",XMITPTR,",0) has bad pointer to Deleted Outpatient Encounter file"
+75 SET XMITDELD=XMITDELD+1
End DoDot:2
+76 ;Check for rejection without entry in Transmitted Outpatient Encounter
+77 ; Error file (#409.75)
+78 SET TMP=$GET(^SD(409.73,XMITPTR,1))
+79 IF ($PIECE(TMP,"^",5)="R")
IF ('$DATA(^SD(409.75,"B",XMITPTR)))
Begin DoDot:2
+80 ;Mark for retransmission
+81 IF ('SCANMODE)
DO STREEVNT^SCDXFU01(XMITPTR)
+82 IF ('SCANMODE)
DO XMITFLAG^SCDXFU01(XMITPTR)
+83 IF (SCANMODE)
WRITE !,"^SD(409.73,",XMITPTR,",0) rejected with no reason on file (entry in 409.75)"
+84 ;Increment retransmission counter
+85 SET XMITXMIT=XMITXMIT+1
End DoDot:2
+86 ;Check for request to stop
+87 IF ($$S^%ZTLOAD("Last entry in Transmitted Outpatient Encounter file checked >> "_XMITPTR))
SET ZTSTOP=1
End DoDot:1
IF ($GET(ZTSTOP))
QUIT
+88 ;Remember totals
+89 SET ^TMP($JOB,"SD53105A","XMIT")=XMITTOT_"^"_XMITDELE_"^"_XMITDELD_"^"_XMITXMIT
+90 IF (SCANMODE)
Begin DoDot:1
+91 WRITE !
+92 WRITE !,XMITTOT," entries where checked"
+93 WRITE !,?2,XMITXMIT," would have been marked for retransmission"
+94 WRITE !,?2,(XMITDELE+XMITDELD)," would have been deleted"
+95 WRITE !,?4,(XMITDELE)," have bad Outpatient Encounter pointers"
+96 WRITE !,?4,(XMITDELD)," have bad Deleted Outpatient Encounter pointers"
End DoDot:1
+97 ;Asked to stop
+98 IF $GET(ZTSTOP)
GOTO EN1
+99 ;Loop through Deleted Outpatient Encounter file (#409.74)
+100 IF (SCANMODE)
Begin DoDot:1
+101 WRITE !!!
+102 WRITE !,"The following entries in the Deleted Outpatient Encounter"
+103 WRITE !,"file (#409.74) will be deleted when run in fix mode"
+104 WRITE !,$$REPEAT^SCDXUTL1("=",70)
End DoDot:1
+105 SET DELPTR=0
+106 FOR
SET DELPTR=+$ORDER(^SD(409.74,DELPTR))
IF ('DELPTR)
QUIT
Begin DoDot:1
+107 ;Increment total entries checked
+108 SET DELTOT=DELTOT+1
+109 ;Check for entry in Transmitted Outpatient Encounter file
+110 IF ('$DATA(^SD(409.73,"ADEL",DELPTR)))
Begin DoDot:2
+111 ;Not found - delete entry and increment deletion count
+112 IF ('SCANMODE)
SET DA=DELPTR
SET DIK="^SD(409.74,"
DO ^DIK
KILL DA,DIK,X,Y
+113 IF (SCANMODE)
WRITE !,"^SD(409.74,",DELPTR,",0) not in Transmitted Outpatient Encounter file"
+114 SET DELDEL=DELDEL+1
End DoDot:2
+115 ;Check for request to stop
+116 IF ($$S^%ZTLOAD("Last entry in Deleted Outpatient Encounter file checked >> "_DELPTR))
SET ZTSTOP=1
End DoDot:1
IF ($GET(ZTSTOP))
QUIT
+117 ;Remember totals
+118 SET ^TMP($JOB,"SD53105A","DEL")=DELTOT_"^"_DELDEL
+119 IF (SCANMODE)
WRITE !!,DELTOT," entries where checked and ",DELDEL," would have been deleted"
+120 ;Asked to stop
+121 IF $GET(ZTSTOP)
GOTO EN1
+122 ;Loop through Transmitted Outpatient Encounter Error file (#409.75)
+123 IF (SCANMODE)
Begin DoDot:1
+124 WRITE !!!
+125 WRITE !,"The following entries in the Transmitted Outpatient Encounter"
+126 WRITE !,"Error file (#409.75) will be deleted when run in fix mode"
+127 WRITE !,$$REPEAT^SCDXUTL1("=",70)
End DoDot:1
+128 SET ERRPTR=0
+129 FOR
SET ERRPTR=+$ORDER(^SD(409.75,ERRPTR))
IF ('ERRPTR)
QUIT
Begin DoDot:1
+130 ;Increment total entries checked
+131 SET ERRTOT=ERRTOT+1
+132 ;Get pointer to Transmitted Outpatient Encounter file
+133 SET XMITPTR=+$GET(^SD(409.75,ERRPTR,0))
+134 ;Validate pointer
+135 IF ('$DATA(^SD(409.73,XMITPTR,0)))
Begin DoDot:2
+136 ;Invalid - delete entry and increment deletion count
+137 IF ('SCANMODE)
SET TMP=$$DELERR^SCDXFU02(ERRPTR)
+138 IF (SCANMODE)
WRITE !,"^SD(409.75,",ERRPTR,",0) has bad pointer to Transmitted Outpatient Encounter file"
+139 SET ERRDEL=ERRDEL+1
End DoDot:2
+140 ;Check for request to stop
+141 IF ($$S^%ZTLOAD("Last entry in Transmitted Outpatient Encounter Error file checked >> "_ERRPTR))
SET ZTSTOP=1
End DoDot:1
IF ($GET(ZTSTOP))
QUIT
+142 ;Remember totals
+143 SET ^TMP($JOB,"SD53105A","ERR")=ERRTOT_"^"_ERRDEL
+144 IF (SCANMODE)
WRITE !!,ERRTOT," entries where checked and ",ERRDEL," would have been deleted"
EN1 ;Remember ending time
+1 SET $PIECE(^TMP($JOB,"SD53105A","TIME"),"^",2)=$$NOW^XLFDT()
+2 IF (SCANMODE)
Begin DoDot:1
+3 WRITE !!!,"Scan ended on ",$$FMTE^XLFDT($$NOW^XLFDT())
+4 WRITE !!!,"Use the entry point FIX^SD53105A to run in fix mode"
+5 WRITE !,"Use the entry point SCAN^SD53105A to re-run in scan mode"
End DoDot:1
+6 ;Remember if requested to stop
+7 SET ^TMP($JOB,"SD53105A","STOP")=+$GET(ZTSTOP)
+8 ;Send completion/summary bulletin
+9 IF ('SCANMODE)
DO BULL1^SD53105C
+10 ;Done - clean up and quit
+11 KILL ^TMP($JOB,"SD53105A")
+12 IF ($DATA(ZTQUEUED))
SET ZTREQ="@"
+13 QUIT