BGUTRCU ; IHS/OIT/MJL - Clean up routine for the Debug/Trace global: ^BGUTRACE ;
;;1.5;BGU;;MAY 26, 2005
;
MAIN ;
D ASKDJ,ASKNRT:'$D(DIRUT) I $D(DIRUT) D KILL Q
D CLU,KILL
Q
;
ASKDJ ;
; Ask for $J
S U="^",DIR(0)="NO^1:999999",DIR("A")="ENTER $J TO CLEANUP",DIR("?")="Enter numeric characters for the $J you want to cleanup" D ^DIR Q:$D(DIRUT)
; ASK HOW MANY ENTRIES TO RETAIN
S BGUDJ=Y
Q
;
ASKNRT ;
; Ask for number of sessions to retain
S DIR(0)="NO^0:999",DIR("A")="ENTER THE NUMBER OF SESSIONS TO RETAIN",DIR("?")="Enter numeric characters only" D ^DIR I $D(DIRUT) D KILL Q
S BGUNRT=Y D CLU
W !,BGUNRT," Sessions Retained",!
Q
;
CLU ;
S BGUN="",DIK="^BGUTRACE(" F BGUN1=1:1 S BGUN=$O(^BGUTRACE("C",BGUDJ,BGUN),-1) Q:BGUN="" I BGUN1>BGUNRT S DA=BGUN D ^DIK
Q
;
KILL ;
K BGUDJ,BGUN,BGUN1,BGUN2,BGUNRT,DA,DIK,DIR,DIRUT,X,Y
Q
;
BJENT ;EP Called by option BGU TRACE CLEANUP
; Entry point called from cleanup option.
W !,"Starting..."
S U="^" S BGUDJ=0 F BGUQ=0:0 S BGUDJ=$O(^BGUTRACE("C",BGUDJ)) Q:'BGUDJ D
.I $D(^BGUSP(1,1,"B",BGUDJ)) S BGUN2="" F BGUQ=0:0 S BGUN2=$O(^BGUSP(1,1,"B",BGUDJ,BGUN2)) Q:'BGUN2 S BGUNRT=$P(^BGUSP(1,1,BGUN2,0),U,2) D CLU
.I '$D(^BGUSP(1,1,"B",BGUDJ)) S DIK="^BGUTRACE(" S BGUN="" F BGUN1=1:1 S BGUN=$O(^BGUTRACE("C",BGUDJ,BGUN)) Q:BGUN="" S DA=BGUN D ^DIK
D KILL
W !,"Done..",!!
Q
;
BGUTRCU ; IHS/OIT/MJL - Clean up routine for the Debug/Trace global: ^BGUTRACE ;
+1 ;;1.5;BGU;;MAY 26, 2005
+2 ;
MAIN ;
+1 DO ASKDJ
IF '$DATA(DIRUT)
DO ASKNRT
IF $DATA(DIRUT)
DO KILL
QUIT
+2 DO CLU
DO KILL
+3 QUIT
+4 ;
ASKDJ ;
+1 ; Ask for $J
+2 SET U="^"
SET DIR(0)="NO^1:999999"
SET DIR("A")="ENTER $J TO CLEANUP"
SET DIR("?")="Enter numeric characters for the $J you want to cleanup"
DO ^DIR
IF $DATA(DIRUT)
QUIT
+3 ; ASK HOW MANY ENTRIES TO RETAIN
+4 SET BGUDJ=Y
+5 QUIT
+6 ;
ASKNRT ;
+1 ; Ask for number of sessions to retain
+2 SET DIR(0)="NO^0:999"
SET DIR("A")="ENTER THE NUMBER OF SESSIONS TO RETAIN"
SET DIR("?")="Enter numeric characters only"
DO ^DIR
IF $DATA(DIRUT)
DO KILL
QUIT
+3 SET BGUNRT=Y
DO CLU
+4 WRITE !,BGUNRT," Sessions Retained",!
+5 QUIT
+6 ;
CLU ;
+1 SET BGUN=""
SET DIK="^BGUTRACE("
FOR BGUN1=1:1
SET BGUN=$ORDER(^BGUTRACE("C",BGUDJ,BGUN),-1)
IF BGUN=""
QUIT
IF BGUN1>BGUNRT
SET DA=BGUN
DO ^DIK
+2 QUIT
+3 ;
KILL ;
+1 KILL BGUDJ,BGUN,BGUN1,BGUN2,BGUNRT,DA,DIK,DIR,DIRUT,X,Y
+2 QUIT
+3 ;
BJENT ;EP Called by option BGU TRACE CLEANUP
+1 ; Entry point called from cleanup option.
+2 WRITE !,"Starting..."
+3 SET U="^"
SET BGUDJ=0
FOR BGUQ=0:0
SET BGUDJ=$ORDER(^BGUTRACE("C",BGUDJ))
IF 'BGUDJ
QUIT
Begin DoDot:1
+4 IF $DATA(^BGUSP(1,1,"B",BGUDJ))
SET BGUN2=""
FOR BGUQ=0:0
SET BGUN2=$ORDER(^BGUSP(1,1,"B",BGUDJ,BGUN2))
IF 'BGUN2
QUIT
SET BGUNRT=$PIECE(^BGUSP(1,1,BGUN2,0),U,2)
DO CLU
+5 IF '$DATA(^BGUSP(1,1,"B",BGUDJ))
SET DIK="^BGUTRACE("
SET BGUN=""
FOR BGUN1=1:1
SET BGUN=$ORDER(^BGUTRACE("C",BGUDJ,BGUN))
IF BGUN=""
QUIT
SET DA=BGUN
DO ^DIK
End DoDot:1
+6 DO KILL
+7 WRITE !,"Done..",!!
+8 QUIT
+9 ;