DG53558 ;ALB/GN - DG*5.3*558 CLEANUP FOR DUPE MEANS TEST FILE ; 8/15/08 12:27pm
;;5.3;PIMS;**1016**;JUN 30, 2012;Build 20
;
; Read through the Mean Test file (#408.31) via the "C" xref.
; Search for duplicate & Bad tests and delete them. Duplicates are
; defined as more than one test for the same patient for the same day
; and the same status. All dupes but the primary test will be
; deleted and when no primary test on a given day then the last
; transmission for that day will be kept
;
; Bad tests are defined as those that have a NULL status code in
; the 0 node of file 408.31.
;
; DG*5.3*579 - changes were made to fix a problem when future dated
; tests come in and flip a test from Primary to Non-Primary. This
; should not be done for IVM converted cases. This patch will
; find those IVM tests and flip them back to Priamry and flip the
; future test that caused this back to Non-Primary.
Q
TEST ; Entry point for testing this routine
S TESTING=1
EN ; Entry point for purging Duplicate Means Tests
;
N QUIT,ZTDESC,ZTIO,ZTRTN,ZTSK,ZTQUEUED,ZTSAVE,CHKPNT
S CHKPNT=5
W !,"Do you want to process a group of "_CHKPNT_" duplicates and stop? "
K DIR
S DIR("?",1)=" Enter Y to process at least "_CHKPNT_" dupes and stop the utility. This will "
S DIR("?",2)=" allow you to verify the cleanup in small steps. Enter N to process the "
S DIR("?")=" remainder of the file to completion."
S DIR(0)="Y" D ^DIR
I $D(DTOUT)!$D(DUOUT) W !,"Cancelled...",! Q
;
S:'Y CHKPNT=0 ;do not use check points
;
; setup TM variables and Load
S ZTRTN=$S($G(TESTING):"QUET^DG53558",1:"QUE^DG53558")
S ZTDESC="Cleanup Duplicates in the Means Test file"
S ZTIO=""
S ZTSAVE("CHKPNT")=""
;
W !!,ZTDESC,!
;check if already running or completed.
S QUIT=$$CHKSTAT(0)
Q:QUIT
D ^%ZTLOAD
L -^XTMP($$NAMSPC)
I $D(ZTSK) D
. W !,"This request queued as Task # ",ZTSK,!
Q
;
POST ;
N ZTDTH,ZTDESC,ZTIO,ZTRTN,ZTSK,ZTQUEUED,ZTSAVE,CHKPNT
D MES^XPDUTL("")
D MES^XPDUTL("=====================================================")
D MES^XPDUTL("Queuing Dupe Income Test Purge Utility.....")
I $$CHKSTAT(1) D Q
. D BMES^XPDUTL("ABORTING Post Install Utility Queuing")
. D MES^XPDUTL("=====================================================")
S ZTRTN="QUE^DG53558"
S ZTDESC="Cleanup Duplicates in the Means Test file"
S ZTIO="",ZTDTH=$H
S CHKPNT=0,ZTSAVE("CHKPNT")=""
D ^%ZTLOAD
L -^XTMP($$NAMSPC)
D MES^XPDUTL("This request queued as Task # "_ZTSK)
D MES^XPDUTL("=====================================================")
D MES^XPDUTL("")
Q
;
QUET ; Entry point for taskman (testing mode)
S TESTING=1
QUE ; Entry point for taskman (live mode)
N NAMSPC S NAMSPC=$$NAMSPC^DG53558
L +^XTMP(NAMSPC):10 I '$T D Q ;quit if can't get a lock
. S $P(^XTMP(NAMSPC,0,0),U,5)="NO LOCK GAINED"
N QQ,ZTSTOP,XREC,MTIEN,DIK,DA,IVMTOT,IVMPUR,BEGTIME,PURGDT,IVMBAD
N DFN,TMP,ICDT,MTST,IVMDUPE,COUNT,PRI,TYPE,TYPNAM,DELETED,IVMIEN,PRIM
N SRCE,TMPIVM,XX,IVMCV,MAX,IVMIEND,IVMPFL,LINK,LTYP,LTNAM,MTVER
S TESTING=+$G(TESTING)
;
;get last run info if exists
S XREC=$G(^XTMP(NAMSPC,0,0))
S DFN=$P(XREC,U,1) ;last REC processed
S IVMTOT=+$P(XREC,U,2) ;total records processed
S IVMPUR=+$P(XREC,U,3) ;total dupe records purged
S IVMBAD=+$P(XREC,U,7) ;total bad records purged
S IVMPFL=+$P(XREC,U,8) ;total PRIM records fliped
S IVMDUPE=IVMPUR
;
;setup XTMP according to stds. & for 60 day expiration
D SETUPX^DG53558M(60)
;
;init status field and start date & time if null
S $P(^XTMP(NAMSPC,0,0),U,5,6)="RUNNING^"
S:$P(^XTMP(NAMSPC,0,0),U,4)="" $P(^XTMP(NAMSPC,0,0),U,4)=$$NOW^XLFDT
;
;drive through "C" XREF level of MT file
S ZTSTOP=0,DELETED=0
F QQ=1:1 S DFN=$O(^DGMT(408.31,"C",DFN)) Q:'DFN D Q:ZTSTOP
. I $G(CHKPNT)>1,IVMPUR>IVMDUPE,IVMPUR-CHKPNT>IVMDUPE S ZTSTOP=1 Q
. K TMP,TMPIVM
. S IVMTOT=IVMTOT+1
. ;
. ;build local TMP and prioritize dupes
. S MTIEN=0
. F S MTIEN=$O(^DGMT(408.31,"C",DFN,MTIEN)) Q:'MTIEN D
. . I '$D(^DGMT(408.31,MTIEN,0)) K ^DGMT(408.31,"C",DFN,MTIEN) Q
. . S ICDT=$P(^DGMT(408.31,MTIEN,0),"^",1)
. . S MTST=$P(^DGMT(408.31,MTIEN,0),"^",3)
. . S PRI=+$G(^DGMT(408.31,MTIEN,"PRIM"))
. . S SRCE=+$P(^DGMT(408.31,MTIEN,0),"^",23)
. . S MTVER=+$P($G(^DGMT(408.31,MTIEN,2)),"^",11)
. . S MAX=0
. . S:$D(^DGMT(408.31,MTIEN,"C")) MAX=$O(^DGMT(408.31,MTIEN,"C",""),-1)
. . S IVMCV=0 ;init IVM converted flag to no DG*5.3*579
. . F XX=1:1:MAX D Q:IVMCV
. . . S:^DGMT(408.31,MTIEN,"C",XX,0)["Z06 MT via Edb" IVMCV=1
. . I SRCE=2,IVMCV D ;IVM converted test from EDB
. . . S TMPIVM(DFN,ICDT,MTST)=MTIEN,TMPIVM(DFN,ICDT)=MTIEN
. . . S PRI=1 ;set as PRIMARY
. . ;
. . ;test for null MT status & flag as BAD and delete
. . I MTST="" D Q
. . . S TYPE=$P($G(^DGMT(408.31,MTIEN,0)),"^",19),TYPNAM=""
. . . S:TYPE]"" TYPNAM=$G(^DG(408.33,TYPE,0))
. . . D DELBAD(MTIEN,DFN,.IVMBAD,.DELETED)
. . . Q:'DELETED
. . . S ^XTMP(NAMSPC,DFN,ICDT,MTVER,999999,MTIEN,"BAD")=TYPE
. . . S ^XTMP(NAMSPC_".DET",DFN,ICDT,MTVER,MTIEN,"BAD")=TYPNAM
. . . S $P(^XTMP(NAMSPC,0,0),U,7)=IVMBAD
. . ;
. . S COUNT=+$G(TMP(DFN,ICDT,MTST))+1
. . S TMP(DFN,ICDT,MTVER,MTST)=COUNT
. . S TMP(DFN,ICDT,MTVER,MTST,MTIEN)=PRI
. . S:PRI TMP(DFN,ICDT,MTVER,MTST,"P")=MTIEN
. ;
. D CLNDUPS^DG53558N(DFN)
. ;update last processed info
. S $P(^XTMP(NAMSPC,0,0),U,1,3)=DFN_U_IVMTOT_U_IVMPUR
. S $P(^XTMP(NAMSPC,0,0),U,7,8)=IVMBAD_U_IVMPFL
. ;
. ;check for stop request after every 100 processed DFN recs
. I QQ#100=0 D
. . S:$$S^%ZTLOAD ZTSTOP=1
. . I $D(^XTMP(NAMSPC,0,"STOP")) S ZTSTOP=1 K ^XTMP(NAMSPC,0,"STOP")
;
;set status and mail stats
I ZTSTOP S $P(^XTMP(NAMSPC,0,0),U,5,6)="STOPPED"_U_$$NOW^XLFDT
E S $P(^XTMP(NAMSPC,0,0),U,5,6)="COMPLETED"_U_$$NOW^XLFDT
D MAIL^DG53558M
K TESTING
L -^XTMP($$NAMSPC)
Q
;
;DG*5.3*579 released SETPRIM and 688 moved it to DG53558M
;
DELBAD(IEN,DFN,PUR,DELETED) ; Kill Bad test
S DELETED=0
Q:'$G(IEN)
S TESTING=+$G(TESTING,1),DFN=$G(DFN)
I 'TESTING S DELETED=$$DEL^DG53558M(IEN,.LINK,DFN)
S:TESTING DELETED=1
Q:'DELETED
S IVMBAD=IVMBAD+1
I '$D(ZTQUEUED) W !,"Deleting BAD IEN in 408.31 > ",IEN," for DFN > ",DFN
Q
;
CHKSTAT(POST) ;check if job is running, stopped, or completed
N Y,DUOUT,DTOUT,QUIT,STAT,STIME,NAMSPC
S QUIT=0
S NAMSPC=$$NAMSPC
L +^XTMP(NAMSPC):1
I '$T D BMES^XPDUTL("*** ALREADY RUNNING ***") Q 1
;
; get job status
S STAT=$P($G(^XTMP(NAMSPC,0,0)),U,5)
S STIME=$P($G(^XTMP(NAMSPC,0,0)),U,6)
;
I POST D KILIT Q 0 ;DG*5.3*579
;
;if job Completed and run from menu opt, ask to Re-Run
I STAT="COMPLETED" D
. W " was Completed on "_$$FMTE^XLFDT(STIME)
. W !," Do you want to Re-Run again?"
. K DIR
. S DIR("?",1)=" Entering Y, will delete the XTMP global where the previous cleanup"
. S DIR("?")=" information was stored and begin a new job, or N to cancel request"
. S DIR(0)="Y" D ^DIR
. I 'Y S QUIT=1 Q
. W !," ARE YOU SURE?"
. K DIR
. S DIR("?")="Enter Y to begin a new Job or N to cancel request"
. S DIR(0)="Y" D ^DIR
. I 'Y S QUIT=1 Q
. ;fall thru to re-run mode, kill ^XTMPs
. D KILIT
Q QUIT
;
KILIT ; kill Xtmp work files for a re-run
S:'$D(NAMSPC) NAMSPC=$$NAMSPC^DG53558
K ^XTMP(NAMSPC),^XTMP(NAMSPC_".DET")
Q
;
STOP ; alternate stop method
S ^XTMP($$NAMSPC,0,"STOP")=""
Q
;
NAMSPC() ; Return a consistent name space variable
Q "DG53558"
DG53558 ;ALB/GN - DG*5.3*558 CLEANUP FOR DUPE MEANS TEST FILE ; 8/15/08 12:27pm
+1 ;;5.3;PIMS;**1016**;JUN 30, 2012;Build 20
+2 ;
+3 ; Read through the Mean Test file (#408.31) via the "C" xref.
+4 ; Search for duplicate & Bad tests and delete them. Duplicates are
+5 ; defined as more than one test for the same patient for the same day
+6 ; and the same status. All dupes but the primary test will be
+7 ; deleted and when no primary test on a given day then the last
+8 ; transmission for that day will be kept
+9 ;
+10 ; Bad tests are defined as those that have a NULL status code in
+11 ; the 0 node of file 408.31.
+12 ;
+13 ; DG*5.3*579 - changes were made to fix a problem when future dated
+14 ; tests come in and flip a test from Primary to Non-Primary. This
+15 ; should not be done for IVM converted cases. This patch will
+16 ; find those IVM tests and flip them back to Priamry and flip the
+17 ; future test that caused this back to Non-Primary.
+18 QUIT
TEST ; Entry point for testing this routine
+1 SET TESTING=1
EN ; Entry point for purging Duplicate Means Tests
+1 ;
+2 NEW QUIT,ZTDESC,ZTIO,ZTRTN,ZTSK,ZTQUEUED,ZTSAVE,CHKPNT
+3 SET CHKPNT=5
+4 WRITE !,"Do you want to process a group of "_CHKPNT_" duplicates and stop? "
+5 KILL DIR
+6 SET DIR("?",1)=" Enter Y to process at least "_CHKPNT_" dupes and stop the utility. This will "
+7 SET DIR("?",2)=" allow you to verify the cleanup in small steps. Enter N to process the "
+8 SET DIR("?")=" remainder of the file to completion."
+9 SET DIR(0)="Y"
DO ^DIR
+10 IF $DATA(DTOUT)!$DATA(DUOUT)
WRITE !,"Cancelled...",!
QUIT
+11 ;
+12 ;do not use check points
IF 'Y
SET CHKPNT=0
+13 ;
+14 ; setup TM variables and Load
+15 SET ZTRTN=$SELECT($GET(TESTING):"QUET^DG53558",1:"QUE^DG53558")
+16 SET ZTDESC="Cleanup Duplicates in the Means Test file"
+17 SET ZTIO=""
+18 SET ZTSAVE("CHKPNT")=""
+19 ;
+20 WRITE !!,ZTDESC,!
+21 ;check if already running or completed.
+22 SET QUIT=$$CHKSTAT(0)
+23 IF QUIT
QUIT
+24 DO ^%ZTLOAD
+25 LOCK -^XTMP($$NAMSPC)
+26 IF $DATA(ZTSK)
Begin DoDot:1
+27 WRITE !,"This request queued as Task # ",ZTSK,!
End DoDot:1
+28 QUIT
+29 ;
POST ;
+1 NEW ZTDTH,ZTDESC,ZTIO,ZTRTN,ZTSK,ZTQUEUED,ZTSAVE,CHKPNT
+2 DO MES^XPDUTL("")
+3 DO MES^XPDUTL("=====================================================")
+4 DO MES^XPDUTL("Queuing Dupe Income Test Purge Utility.....")
+5 IF $$CHKSTAT(1)
Begin DoDot:1
+6 DO BMES^XPDUTL("ABORTING Post Install Utility Queuing")
+7 DO MES^XPDUTL("=====================================================")
End DoDot:1
QUIT
+8 SET ZTRTN="QUE^DG53558"
+9 SET ZTDESC="Cleanup Duplicates in the Means Test file"
+10 SET ZTIO=""
SET ZTDTH=$HOROLOG
+11 SET CHKPNT=0
SET ZTSAVE("CHKPNT")=""
+12 DO ^%ZTLOAD
+13 LOCK -^XTMP($$NAMSPC)
+14 DO MES^XPDUTL("This request queued as Task # "_ZTSK)
+15 DO MES^XPDUTL("=====================================================")
+16 DO MES^XPDUTL("")
+17 QUIT
+18 ;
QUET ; Entry point for taskman (testing mode)
+1 SET TESTING=1
QUE ; Entry point for taskman (live mode)
+1 NEW NAMSPC
SET NAMSPC=$$NAMSPC^DG53558
+2 ;quit if can't get a lock
LOCK +^XTMP(NAMSPC):10
IF '$TEST
Begin DoDot:1
+3 SET $PIECE(^XTMP(NAMSPC,0,0),U,5)="NO LOCK GAINED"
End DoDot:1
QUIT
+4 NEW QQ,ZTSTOP,XREC,MTIEN,DIK,DA,IVMTOT,IVMPUR,BEGTIME,PURGDT,IVMBAD
+5 NEW DFN,TMP,ICDT,MTST,IVMDUPE,COUNT,PRI,TYPE,TYPNAM,DELETED,IVMIEN,PRIM
+6 NEW SRCE,TMPIVM,XX,IVMCV,MAX,IVMIEND,IVMPFL,LINK,LTYP,LTNAM,MTVER
+7 SET TESTING=+$GET(TESTING)
+8 ;
+9 ;get last run info if exists
+10 SET XREC=$GET(^XTMP(NAMSPC,0,0))
+11 ;last REC processed
SET DFN=$PIECE(XREC,U,1)
+12 ;total records processed
SET IVMTOT=+$PIECE(XREC,U,2)
+13 ;total dupe records purged
SET IVMPUR=+$PIECE(XREC,U,3)
+14 ;total bad records purged
SET IVMBAD=+$PIECE(XREC,U,7)
+15 ;total PRIM records fliped
SET IVMPFL=+$PIECE(XREC,U,8)
+16 SET IVMDUPE=IVMPUR
+17 ;
+18 ;setup XTMP according to stds. & for 60 day expiration
+19 DO SETUPX^DG53558M(60)
+20 ;
+21 ;init status field and start date & time if null
+22 SET $PIECE(^XTMP(NAMSPC,0,0),U,5,6)="RUNNING^"
+23 IF $PIECE(^XTMP(NAMSPC,0,0),U,4)=""
SET $PIECE(^XTMP(NAMSPC,0,0),U,4)=$$NOW^XLFDT
+24 ;
+25 ;drive through "C" XREF level of MT file
+26 SET ZTSTOP=0
SET DELETED=0
+27 FOR QQ=1:1
SET DFN=$ORDER(^DGMT(408.31,"C",DFN))
IF 'DFN
QUIT
Begin DoDot:1
+28 IF $GET(CHKPNT)>1
IF IVMPUR>IVMDUPE
IF IVMPUR-CHKPNT>IVMDUPE
SET ZTSTOP=1
QUIT
+29 KILL TMP,TMPIVM
+30 SET IVMTOT=IVMTOT+1
+31 ;
+32 ;build local TMP and prioritize dupes
+33 SET MTIEN=0
+34 FOR
SET MTIEN=$ORDER(^DGMT(408.31,"C",DFN,MTIEN))
IF 'MTIEN
QUIT
Begin DoDot:2
+35 IF '$DATA(^DGMT(408.31,MTIEN,0))
KILL ^DGMT(408.31,"C",DFN,MTIEN)
QUIT
+36 SET ICDT=$PIECE(^DGMT(408.31,MTIEN,0),"^",1)
+37 SET MTST=$PIECE(^DGMT(408.31,MTIEN,0),"^",3)
+38 SET PRI=+$GET(^DGMT(408.31,MTIEN,"PRIM"))
+39 SET SRCE=+$PIECE(^DGMT(408.31,MTIEN,0),"^",23)
+40 SET MTVER=+$PIECE($GET(^DGMT(408.31,MTIEN,2)),"^",11)
+41 SET MAX=0
+42 IF $DATA(^DGMT(408.31,MTIEN,"C"))
SET MAX=$ORDER(^DGMT(408.31,MTIEN,"C",""),-1)
+43 ;init IVM converted flag to no DG*5.3*579
SET IVMCV=0
+44 FOR XX=1:1:MAX
Begin DoDot:3
+45 IF ^DGMT(408.31,MTIEN,"C",XX,0)["Z06 MT via Edb"
SET IVMCV=1
End DoDot:3
IF IVMCV
QUIT
+46 ;IVM converted test from EDB
IF SRCE=2
IF IVMCV
Begin DoDot:3
+47 SET TMPIVM(DFN,ICDT,MTST)=MTIEN
SET TMPIVM(DFN,ICDT)=MTIEN
+48 ;set as PRIMARY
SET PRI=1
End DoDot:3
+49 ;
+50 ;test for null MT status & flag as BAD and delete
+51 IF MTST=""
Begin DoDot:3
+52 SET TYPE=$PIECE($GET(^DGMT(408.31,MTIEN,0)),"^",19)
SET TYPNAM=""
+53 IF TYPE]""
SET TYPNAM=$GET(^DG(408.33,TYPE,0))
+54 DO DELBAD(MTIEN,DFN,.IVMBAD,.DELETED)
+55 IF 'DELETED
QUIT
+56 SET ^XTMP(NAMSPC,DFN,ICDT,MTVER,999999,MTIEN,"BAD")=TYPE
+57 SET ^XTMP(NAMSPC_".DET",DFN,ICDT,MTVER,MTIEN,"BAD")=TYPNAM
+58 SET $PIECE(^XTMP(NAMSPC,0,0),U,7)=IVMBAD
End DoDot:3
QUIT
+59 ;
+60 SET COUNT=+$GET(TMP(DFN,ICDT,MTST))+1
+61 SET TMP(DFN,ICDT,MTVER,MTST)=COUNT
+62 SET TMP(DFN,ICDT,MTVER,MTST,MTIEN)=PRI
+63 IF PRI
SET TMP(DFN,ICDT,MTVER,MTST,"P")=MTIEN
End DoDot:2
+64 ;
+65 DO CLNDUPS^DG53558N(DFN)
+66 ;update last processed info
+67 SET $PIECE(^XTMP(NAMSPC,0,0),U,1,3)=DFN_U_IVMTOT_U_IVMPUR
+68 SET $PIECE(^XTMP(NAMSPC,0,0),U,7,8)=IVMBAD_U_IVMPFL
+69 ;
+70 ;check for stop request after every 100 processed DFN recs
+71 IF QQ#100=0
Begin DoDot:2
+72 IF $$S^%ZTLOAD
SET ZTSTOP=1
+73 IF $DATA(^XTMP(NAMSPC,0,"STOP"))
SET ZTSTOP=1
KILL ^XTMP(NAMSPC,0,"STOP")
End DoDot:2
End DoDot:1
IF ZTSTOP
QUIT
+74 ;
+75 ;set status and mail stats
+76 IF ZTSTOP
SET $PIECE(^XTMP(NAMSPC,0,0),U,5,6)="STOPPED"_U_$$NOW^XLFDT
+77 IF '$TEST
SET $PIECE(^XTMP(NAMSPC,0,0),U,5,6)="COMPLETED"_U_$$NOW^XLFDT
+78 DO MAIL^DG53558M
+79 KILL TESTING
+80 LOCK -^XTMP($$NAMSPC)
+81 QUIT
+82 ;
+83 ;DG*5.3*579 released SETPRIM and 688 moved it to DG53558M
+84 ;
DELBAD(IEN,DFN,PUR,DELETED) ; Kill Bad test
+1 SET DELETED=0
+2 IF '$GET(IEN)
QUIT
+3 SET TESTING=+$GET(TESTING,1)
SET DFN=$GET(DFN)
+4 IF 'TESTING
SET DELETED=$$DEL^DG53558M(IEN,.LINK,DFN)
+5 IF TESTING
SET DELETED=1
+6 IF 'DELETED
QUIT
+7 SET IVMBAD=IVMBAD+1
+8 IF '$DATA(ZTQUEUED)
WRITE !,"Deleting BAD IEN in 408.31 > ",IEN," for DFN > ",DFN
+9 QUIT
+10 ;
CHKSTAT(POST) ;check if job is running, stopped, or completed
+1 NEW Y,DUOUT,DTOUT,QUIT,STAT,STIME,NAMSPC
+2 SET QUIT=0
+3 SET NAMSPC=$$NAMSPC
+4 LOCK +^XTMP(NAMSPC):1
+5 IF '$TEST
DO BMES^XPDUTL("*** ALREADY RUNNING ***")
QUIT 1
+6 ;
+7 ; get job status
+8 SET STAT=$PIECE($GET(^XTMP(NAMSPC,0,0)),U,5)
+9 SET STIME=$PIECE($GET(^XTMP(NAMSPC,0,0)),U,6)
+10 ;
+11 ;DG*5.3*579
IF POST
DO KILIT
QUIT 0
+12 ;
+13 ;if job Completed and run from menu opt, ask to Re-Run
+14 IF STAT="COMPLETED"
Begin DoDot:1
+15 WRITE " was Completed on "_$$FMTE^XLFDT(STIME)
+16 WRITE !," Do you want to Re-Run again?"
+17 KILL DIR
+18 SET DIR("?",1)=" Entering Y, will delete the XTMP global where the previous cleanup"
+19 SET DIR("?")=" information was stored and begin a new job, or N to cancel request"
+20 SET DIR(0)="Y"
DO ^DIR
+21 IF 'Y
SET QUIT=1
QUIT
+22 WRITE !," ARE YOU SURE?"
+23 KILL DIR
+24 SET DIR("?")="Enter Y to begin a new Job or N to cancel request"
+25 SET DIR(0)="Y"
DO ^DIR
+26 IF 'Y
SET QUIT=1
QUIT
+27 ;fall thru to re-run mode, kill ^XTMPs
+28 DO KILIT
End DoDot:1
+29 QUIT QUIT
+30 ;
KILIT ; kill Xtmp work files for a re-run
+1 IF '$DATA(NAMSPC)
SET NAMSPC=$$NAMSPC^DG53558
+2 KILL ^XTMP(NAMSPC),^XTMP(NAMSPC_".DET")
+3 QUIT
+4 ;
STOP ; alternate stop method
+1 SET ^XTMP($$NAMSPC,0,"STOP")=""
+2 QUIT
+3 ;
NAMSPC() ; Return a consistent name space variable
+1 QUIT "DG53558"