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

APCDFDEC.m

Go to the documentation of this file.
  1. APCDFDEC ; IHS/CMI/LAB - FIX DEPENDENT ENTRY COUNT ;
  1. ;;2.0;IHS PCC SUITE;;MAY 14, 2009
  1. S U="^"
  1. S X="LOW",X1="FIRST" W !,"ENTER A ""^"" TO HALT"
  1. GETHILO ; Get the HI and LO DFN's
  1. W !,"Enter the ",X," DFN: ",X1,"//" R @X G:@X="^" XIT I @X'?1N.N&(@X]"") W !,"Enter the ",X," DFN, must be a number greater than 0." G GETHILO
  1. I X="LOW" S X="HIGH",X1="LAST" G GETHILO
  1. PROCESS ;
  1. W !,"<PLEASE WAIT>" S (APCDVT,APCDVCNT,APCDCDEC,APCDNDEC,APCDNC)=0 S:LOW="" LOW=1 S APCDDFN=LOW-1
  1. F APCDL=0:0 S APCDDFN=$O(^AUPNVSIT(APCDDFN)) Q:APCDDFN'=+APCDDFN!(HIGH]""&(APCDDFN>HIGH)) I $D(^AUPNVSIT(APCDDFN,0)) S APCDVCNT=APCDVCNT+1,APCDVT=APCDVT+1 W:APCDVCNT>50 "." S:APCDVCNT>50 APCDVCNT=0 D PROC2
  1. D TOTALS
  1. G XIT
  1. PROC2 ;
  1. Q:$P(^AUPNVSIT(APCDDFN,0),U,7)="H"
  1. S APCDCDEC=$P(^AUPNVSIT(APCDDFN,0),U,9) D CALDEC
  1. I +APCDNDEC'=+APCDCDEC W !,APCDDFN," OLD Dependent Entry Count=",APCDCDEC," NEW Dependent Entry Count=",APCDNDEC," " S APCDNC=APCDNC+1,$P(^AUPNVSIT(APCDDFN,0),U,9)=APCDNDEC
  1. I APCDNDEC>0,$P(^AUPNVSIT(APCDDFN,0),U,11)=1 S $P(^(0),U,11)="" S DA=APCDDFN,DIK="^AUPNVSIT(" D IX^DIK K DIK,DA,DR W "RE-XREF"," ",APCDDFN
  1. I APCDNDEC=0,'$P(^AUPNVSIT(APCDDFN,0),U,11) S AUPNVSIT=APCDDFN D DEL^AUPNVSIT W !,"DELETED: ",APCDDFN K AUPNVSIT
  1. Q
  1. CALDEC ;
  1. S APCDNDEC=0
  1. S APCDVFLE=9000010 F APCDFL=0:0 S APCDVFLE=$O(^DIC(APCDVFLE)) Q:APCDVFLE>9000010.99!(APCDVFLE'=+APCDVFLE) D CALDEC2
  1. Q
  1. CALDEC2 ;
  1. S APCDVDG=^DIC(APCDVFLE,0,"GL"),APCDVIGR=APCDVDG_"""AD"",APCDDFN,APCDEDFN)"
  1. S APCDEDFN="" F APCDEL=1:1 S APCDEDFN=$O(@APCDVIGR) Q:APCDEDFN'=+APCDEDFN S APCDNDEC=APCDNDEC+1
  1. Q
  1. TOTALS ;
  1. W !!,"Total Visits Checked: ",APCDVT
  1. W !,"Total Number Dependent Entry Counts Changed: ",APCDNC
  1. Q
  1. XIT K APCDDFN,APCDCDEC,APCDERR,APCDFILE,APCDNC,APCDNDEC,APCDVCNT,APCDVT,HIGH,LOW,X1,APCDVIGR,APCDVDG,APCDEDFN,APCDEL,APCDVL,APCDVFLE
  1. Q
  1. ;
  1. DOC ; This routine checks the dependent entry count of the VISIT file for
  1. ; accuracy. If it is not correct it is replaced with a correct count
  1. ; The count is determined by scanning each of the VISIT related
  1. ; files for entries that point to that VISIT. A count is incremented
  1. ; each time a "hit" is made.
  1. ; The user can enter a LO and HIGH DFN or hit return to default to
  1. ; first and last.