ACDVFIX ;IHS/ADC/EDE/KML - FIX CDMIS visit DEMOGRAPHIC INFO;
;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
;
;Go through CDMIS VISIT file and set missing demographic info.
;
START ;
D ^XBKVAR
W !,"Checking visits for missing demographic data"
S ACDVIEN=0
F S ACDVIEN=$O(^ACDVIS(ACDVIEN)) Q:'ACDVIEN I $D(^ACDVIS(ACDVIEN,0)) S X=^(0) D CHK Q:ACDQ
Q
;
CHK ; CHECK FOR MISSING VISIT DEMO DATA
S ACDQ=0
W:'ACDVIEN#100 "."
S ACDDFNP=$P(X,U,5)
Q:'ACDDFNP ; not patient related visit
Q:'$D(^DPT(ACDDFNP,0)) ; corrupted patient file
S ACDSEX=$P(^DPT(ACDDFNP,0),U,2)
S DIE="^ACDVIS(",DA=ACDVIEN,DR="103////"_ACDSEX
D DIE^ACDFMC
I $D(Y) W !,"Modify of 9002172.1,103 failed for visit ",ACDVIEN Q
W "|"
Q
ACDVFIX ;IHS/ADC/EDE/KML - FIX CDMIS visit DEMOGRAPHIC INFO;
+1 ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
+2 ;
+3 ;Go through CDMIS VISIT file and set missing demographic info.
+4 ;
START ;
+1 DO ^XBKVAR
+2 WRITE !,"Checking visits for missing demographic data"
+3 SET ACDVIEN=0
+4 FOR
SET ACDVIEN=$ORDER(^ACDVIS(ACDVIEN))
IF 'ACDVIEN
QUIT
IF $DATA(^ACDVIS(ACDVIEN,0))
SET X=^(0)
DO CHK
IF ACDQ
QUIT
+5 QUIT
+6 ;
CHK ; CHECK FOR MISSING VISIT DEMO DATA
+1 SET ACDQ=0
+2 IF 'ACDVIEN#100
WRITE "."
+3 SET ACDDFNP=$PIECE(X,U,5)
+4 ; not patient related visit
IF 'ACDDFNP
QUIT
+5 ; corrupted patient file
IF '$DATA(^DPT(ACDDFNP,0))
QUIT
+6 SET ACDSEX=$PIECE(^DPT(ACDDFNP,0),U,2)
+7 SET DIE="^ACDVIS("
SET DA=ACDVIEN
SET DR="103////"_ACDSEX
+8 DO DIE^ACDFMC
+9 IF $DATA(Y)
WRITE !,"Modify of 9002172.1,103 failed for visit ",ACDVIEN
QUIT
+10 WRITE "|"
+11 QUIT