ACDCLN0 ;IHS/ADC/EDE/KML - UTILITY TO LIST BROKEN LINKS IN DB;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;***************************************************************
;//PROG MODE
;List broken links in dbase
;*****************************************************************
D D
V ;Check visit file last
W !!,"Listing entries from the CDMIS visit file that are not being"
W !,"referenced by any of the CDMIS data files",!!!
S ACDCNT=0 F ACDVISP=0:0 S ACDVISP=$O(^ACDVIS(ACDVISP)) Q:'ACDVISP D V1
W !!,"Total of ",ACDCNT," visits not referenced.",!!
K DA,DIK,ACDVISP,ACD80,ACDDA,ACDDO,ACDOK,ACDCNT
D ^%ZISC
Q
V1 ;
S ACDOK=0
I $O(^ACDIIF("C",ACDVISP,0)) S ACDOK=1
I $O(^ACDTDC("C",ACDVISP,0)) S ACDOK=1
I $O(^ACDCS("C",ACDVISP,0)) S ACDOK=1
I 'ACDOK W !,"ENTRY ",ACDVISP," FROM THE ^ACDVIS GLOBAL IS NOT REFERENCED" S ACDCNT=ACDCNT+1
Q
D ;Check data files first
S ACDCNT=0
W !!!,"Listing partial entries from CDMIS data files that need to be corrected",!
F ACDDO=0:0 S ACDDO=$O(^ACDIIF(ACDDO)) Q:'ACDDO S ACDVISP=$S($D(^(ACDDO,"BWP")):^("BWP"),1:"??") I '$D(^ACDIIF(ACDDO,0))!('$D(^ACDIIF(ACDDO,"BWP")))!('$D(^ACDVIS(ACDVISP,0))) W !,"ENTRY ",ACDDO," FROM THE ^ACDIIF GLOBAL IS" D D1
F ACDDO=0:0 S ACDDO=$O(^ACDTDC(ACDDO)) Q:'ACDDO S ACDVISP=$S($D(^(ACDDO,"BWP")):^("BWP"),1:"??") I '$D(^ACDTDC(ACDDO,0))!('$D(^ACDTDC(ACDDO,"BWP")))!('$D(^ACDVIS(ACDVISP,0))) W !,"ENTRY ",ACDDO," FROM THE ^ACDTDC GLOBAL IS" D D1
F ACDDO=0:0 S ACDDO=$O(^ACDCS(ACDDO)) Q:'ACDDO S ACDVISP=$S($D(^(ACDDO,"BWP")):^("BWP"),1:"??") I '$D(^ACDCS(ACDDO,0))!('$D(^ACDCS(ACDDO,"BWP")))!('$D(^ACDVIS(ACDVISP,0))) W !,"ENTRY ",ACDDO," FROM THE ^ACDCS GLOBAL IS" D D1
W !,"Total of ",ACDCNT," entries with errors found",!!!
Q
D1 ;
W !,"Missing one of the following:",!,"1 THE 0 NODE",!,"2 THE 'BWP' NODE",!,"3 THE POINTED TO VISIT",!!
S ACDCNT=ACDCNT+1
ACDCLN0 ;IHS/ADC/EDE/KML - UTILITY TO LIST BROKEN LINKS IN DB;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;***************************************************************
+3 ;//PROG MODE
+4 ;List broken links in dbase
+5 ;*****************************************************************
+6 DO D
V ;Check visit file last
+1 WRITE !!,"Listing entries from the CDMIS visit file that are not being"
+2 WRITE !,"referenced by any of the CDMIS data files",!!!
+3 SET ACDCNT=0
FOR ACDVISP=0:0
SET ACDVISP=$ORDER(^ACDVIS(ACDVISP))
IF 'ACDVISP
QUIT
DO V1
+4 WRITE !!,"Total of ",ACDCNT," visits not referenced.",!!
+5 KILL DA,DIK,ACDVISP,ACD80,ACDDA,ACDDO,ACDOK,ACDCNT
+6 DO ^%ZISC
+7 QUIT
V1 ;
+1 SET ACDOK=0
+2 IF $ORDER(^ACDIIF("C",ACDVISP,0))
SET ACDOK=1
+3 IF $ORDER(^ACDTDC("C",ACDVISP,0))
SET ACDOK=1
+4 IF $ORDER(^ACDCS("C",ACDVISP,0))
SET ACDOK=1
+5 IF 'ACDOK
WRITE !,"ENTRY ",ACDVISP," FROM THE ^ACDVIS GLOBAL IS NOT REFERENCED"
SET ACDCNT=ACDCNT+1
+6 QUIT
D ;Check data files first
+1 SET ACDCNT=0
+2 WRITE !!!,"Listing partial entries from CDMIS data files that need to be corrected",!
+3 FOR ACDDO=0:0
SET ACDDO=$ORDER(^ACDIIF(ACDDO))
IF 'ACDDO
QUIT
SET ACDVISP=$SELECT($DATA(^(ACDDO,"BWP")):^("BWP"),1:"??")
IF '$DATA(^ACDIIF(ACDDO,0))!('$DATA(^ACDIIF(ACDDO,"BWP")))!('$DATA(^ACDVIS(ACDVISP,0)))
WRITE !,"ENTRY ",ACDDO," FROM THE ^ACDIIF GLOBAL IS"
DO D1
+4 FOR ACDDO=0:0
SET ACDDO=$ORDER(^ACDTDC(ACDDO))
IF 'ACDDO
QUIT
SET ACDVISP=$SELECT($DATA(^(ACDDO,"BWP")):^("BWP"),1:"??")
IF '$DATA(^ACDTDC(ACDDO,0))!('$DATA(^ACDTDC(ACDDO,"BWP")))!('$DATA(^ACDVIS(ACDVISP,0)))
WRITE !,"ENTRY ",ACDDO," FROM THE ^ACDTDC GLOBAL IS"
DO D1
+5 FOR ACDDO=0:0
SET ACDDO=$ORDER(^ACDCS(ACDDO))
IF 'ACDDO
QUIT
SET ACDVISP=$SELECT($DATA(^(ACDDO,"BWP")):^("BWP"),1:"??")
IF '$DATA(^ACDCS(ACDDO,0))!('$DATA(^ACDCS(ACDDO,"BWP")))!('$DATA(^ACDVIS(ACDVISP,0)))
WRITE !,"ENTRY ",ACDDO," FROM THE ^ACDCS GLOBAL IS"
DO D1
+6 WRITE !,"Total of ",ACDCNT," entries with errors found",!!!
+7 QUIT
D1 ;
+1 WRITE !,"Missing one of the following:",!,"1 THE 0 NODE",!,"2 THE 'BWP' NODE",!,"3 THE POINTED TO VISIT",!!
+2 SET ACDCNT=ACDCNT+1