Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: PRC186P

PRC186P.m

Go to the documentation of this file.
PRC186P ;FW/RB-PRE INSTALL PRC*186 TO PURGE DUPLICATE FILE 443 X-REF ENTRIES ;4-26-94/3:45 PM
V ;;5.1;IFCAP;**186**;Oct 20, 2000;Build 10
 ;Per VA Directive 6402, this routine should not be modified.
 Q
 ;PRC*5.1*186 Delete all duplicate File 443, 'AC' x-ref entries if
 ;            'AC' status not equal to node 0 current status and
 ;            and duplicate entry exists.  Also, purge all File
 ;            443, 'AC' entries with no 0 node.
 ;
START K ^XTMP("PRC186P")
 D NOW^%DTC S PRCSTART=%
 S ^XTMP("PRC186P","START COMPILE")=PRCSTART
 S ^XTMP("PRC186P","END COMPILE")="RUNNING"
 S ^XTMP("PRC186P",0)=$$FMADD^XLFDT(PRCSTART,180)_"^"_PRCSTART
 M ^XTMP("PRC186P",99,443)=^PRC(443)
 S U="^",PRCSTS="",(PRCT,PRCT1,PRCT2,PRCT3,PRCT4,PRCT5,PRCT6,PRCTT)=0
1 S PRCSTS=$O(^PRC(443,"AC",PRCSTS)),PRCIEN=0 G 9:PRCSTS=""
2 S PRCIEN=$O(^PRC(443,"AC",PRCSTS,PRCIEN)),PRCT=0 G 1:'PRCIEN S PRCTT=PRCTT+1
 I $D(^XTMP("PRC186P",2,PRCIEN,PRCSTS)) G 2
 S PRCR0=$G(^PRC(443,PRCIEN,0)) I PRCR0="" D  G 2
 . S ^XTMP("PRC186P",1,PRCIEN,PRCSTS)="O"_U_$P(PRCR0,U,7),PRCT1=PRCT1+1 W !,"MISSING 0 NODE: ",PRCSTS,",",PRCIEN
 . K ^PRC(443,"AC",PRCSTS,PRCIEN)     ;**********1
 I PRCR0'="",$P(PRCR0,U,7)'=PRCSTS S PRCBACK=0 D  G:PRCBACK 2
 . W !,PRCIEN," AC DELETED FOR NOT MATCH ZERO NODE ",PRCSTS,"/",$P(PRCR0,U,7) K ^PRC(443,"AC",PRCSTS,PRCIEN)    ;*******************2
 . S ^XTMP("PRC186P",1,PRCIEN,PRCSTS)="MM"_U_$P(PRCR0,U,7),PRCT5=PRCT5+1,PRCBACK=1
 . I '$D(^PRC(443,"AC",$P(PRCR0,U,7),PRCIEN)) D
 .. W !,PRCIEN," 0 NODE SET TO CORRECT 'AC' X-REF DEFINED FOR ",$P(PRCR0,U,7) S ^PRC(443,"AC",$P(PRCR0,U,7),PRCIEN)=""    ;*******************3
 .. S ^XTMP("PRC186P",1,PRCIEN,PRCSTS)="ND"_U_PRCR0,PRCT6=PRCT6+1,PRCBACK=1
 F PRCI=PRCSTS+1:1:99 I $D(^PRC(443,"AC",PRCI,PRCIEN)) D
 . S PRCR=$G(^PRC(443,PRCIEN,0)) I PRCR="" D
 .. Q:$D(^XTMP("PRC186P",1,PRCIEN,PRCI))
 .. S ^XTMP("PRC186P",1,PRCIEN,PRCI)="D"_U_$P(PRCR,U,7),PRCT2=PRCT2+1
 .. K ^PRC(443,"AC",PRCI,PRCIEN)     ;************4
 . S:PRCT=0 ^XTMP("PRC186P",2,PRCIEN,PRCSTS)=$P(PRCR,U,7),PRCT=1
 . S ^XTMP("PRC186P",2,PRCIEN,PRCI)=$P(PRCR,U,7),PRCT4=PRCT4+1
 I PRCT=1 S PRCT3=PRCT3+1,PRCA=0 F PRCJ=1:1 S PRCA=$O(^XTMP("PRC186P",2,PRCIEN,PRCA)) Q:PRCA=""  D
 . I PRCJ=1 D
 .. W !!,PRCIEN W:$D(^XTMP("PRC186P",1,PRCIEN)) "(NULL)" W ?15,$P($G(^PRCS(410,PRCIEN,10)),U,4),?25,PRCA,"/",^XTMP("PRC186P",2,PRCIEN,PRCA)
 .. I PRCA'=$P($G(^PRC(443,PRCIEN,0)),U,7) W "(*)" K ^PRC(443,"AC",PRCA,PRCIEN)     ;*************5
 . I PRCJ>1 D
 .. W ", ",PRCA,"/",^XTMP("PRC186P",2,PRCIEN,PRCA) I PRCA'=$P($G(^PRC(443,PRCIEN,0)),U,7) W "(*)"
 .. K ^PRC(443,"AC",PRCA,PRCIEN)    ;****************6
 G 2
9 W !!!,"TOTAL 443 'AC' X-REF: ",PRCTT,!!,"MASTER PRCIEN MISSING 0 NODE: ",PRCT1,!!,"DUPE PRCIEN MISSING 0 NODE: ",PRCT2
 W !!,"TOTAL INDIVIDUAL DUPLICATES: ",PRCT3,!!,"TOTAL DUPLICATES: ",PRCT4
 W !!,"TOTAL 'AC' STATUS NOT MATCH 0 NODE: ",PRCT5,!!,"TOTAL 'AC' STATUS NOT DEFINED, 'AC' X-REF SET: ",PRCT6
 D NOW^%DTC S PRCRMEND=%
 S ^XTMP("PRC186P","END PURGE DUPES")=PRCRMEND
 S ^XTMP("PRC186P","TOTALS")=PRCTT_U_PRCT1_U_PRCT2_U_PRCT3_U_PRCT4_U_PRCT5_U_PRCT6
 K %,PRCSTART,PRCRMEND,PRCSTS,PRCT,PRCT1,PRCT2,PRCT3,PRCT4,PRCT5,PRCT6,PRCTT,PRCIEN,PRCR0,PRCR,PRCI,PRCJ,PRCBACK,PRCA
 Q