AGMCDCNT ; IHS/ASDS/EFG - FIX MCD ELIG HEADER NODE ;
;;7.1;PATIENT REGISTRATION;;AUG 25,2005
;
;THIS ROUTINE CAN BE USED WHEN THE ELIG HEADER NODE'S PIECE
;3 AND 4 ARE WRONG. IT WILL FIX THOSE PIECES BY LOOPING THROUGH
;ALL THE MEDICAID FILE ENTRIES AND COUNTING THE ELIG RECORDS. IT
;WILL THEN POPULATE THE THIRD PIECE WITH THE LAST ELIG BEGIN DATE
;AND THE FOURTH PIECE WITH THE CORRECT COUNT OF ELIG RECORDS.
;
ECNT ;EP
S AG("MCD")=0
S AG("FIXED")=0
S AG("OLDCNT")=0
F S AG("MCD")=$O(^AUPNMCD(AG("MCD"))) Q:'AG("MCD") D
. S AG("DATE")=0 S AG("CNT")=0 S AG("P3")=0
. S AG("OLDCNT")=$P($G(^AUPNMCD(AG("MCD"),11,0)),U,4)
. Q:$O(^AUPNMCD(AG("MCD"),11,0))=""
. S $P(^AUPNMCD(AG("MCD"),11,0),U,3)=""
. S $P(^AUPNMCD(AG("MCD"),11,0),U,4)=0
. S $P(^AUPNMCD(AG("MCD"),11,0),U,2)="9000004.11D"
. F S AG("DATE")=$O(^AUPNMCD(AG("MCD"),11,AG("DATE"))) Q:'AG("DATE") D
.. S AG("CNT")=AG("CNT")+1
.. S AG("P3")=AG("DATE")
.. S $P(^AUPNMCD(AG("MCD"),11,0),U,3)=AG("P3")
.. S $P(^AUPNMCD(AG("MCD"),11,0),U,4)=AG("CNT")
. I $P($G(^AUPNMCD(AG("MCD"),11,0)),U,4)'=AG("OLDCNT") S AG("FIXED")=AG("FIXED")+1
K AG
Q
AGMCDCNT ; IHS/ASDS/EFG - FIX MCD ELIG HEADER NODE ;
+1 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
+2 ;
+3 ;THIS ROUTINE CAN BE USED WHEN THE ELIG HEADER NODE'S PIECE
+4 ;3 AND 4 ARE WRONG. IT WILL FIX THOSE PIECES BY LOOPING THROUGH
+5 ;ALL THE MEDICAID FILE ENTRIES AND COUNTING THE ELIG RECORDS. IT
+6 ;WILL THEN POPULATE THE THIRD PIECE WITH THE LAST ELIG BEGIN DATE
+7 ;AND THE FOURTH PIECE WITH THE CORRECT COUNT OF ELIG RECORDS.
+8 ;
ECNT ;EP
+1 SET AG("MCD")=0
+2 SET AG("FIXED")=0
+3 SET AG("OLDCNT")=0
+4 FOR
SET AG("MCD")=$ORDER(^AUPNMCD(AG("MCD")))
IF 'AG("MCD")
QUIT
Begin DoDot:1
+5 SET AG("DATE")=0
SET AG("CNT")=0
SET AG("P3")=0
+6 SET AG("OLDCNT")=$PIECE($GET(^AUPNMCD(AG("MCD"),11,0)),U,4)
+7 IF $ORDER(^AUPNMCD(AG("MCD"),11,0))=""
QUIT
+8 SET $PIECE(^AUPNMCD(AG("MCD"),11,0),U,3)=""
+9 SET $PIECE(^AUPNMCD(AG("MCD"),11,0),U,4)=0
+10 SET $PIECE(^AUPNMCD(AG("MCD"),11,0),U,2)="9000004.11D"
+11 FOR
SET AG("DATE")=$ORDER(^AUPNMCD(AG("MCD"),11,AG("DATE")))
IF 'AG("DATE")
QUIT
Begin DoDot:2
+12 SET AG("CNT")=AG("CNT")+1
+13 SET AG("P3")=AG("DATE")
+14 SET $PIECE(^AUPNMCD(AG("MCD"),11,0),U,3)=AG("P3")
+15 SET $PIECE(^AUPNMCD(AG("MCD"),11,0),U,4)=AG("CNT")
End DoDot:2
+16 IF $PIECE($GET(^AUPNMCD(AG("MCD"),11,0)),U,4)'=AG("OLDCNT")
SET AG("FIXED")=AG("FIXED")+1
End DoDot:1
+17 KILL AG
+18 QUIT