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

XBRESID.m

Go to the documentation of this file.
  1. XBRESID ; IHS/ADC/GTH - CLEAN UP RESIDUAL ENTRIES IN ^DD ; [ 02/07/97 3:02 PM ]
  1. ;;3.0;IHS/VA UTILITIES;;FEB 07, 1997
  1. ;
  1. ; This routine deletes residual entries in ^DD by a range of
  1. ; dictionary numbers. A residual entry is one that has no
  1. ; parent. The process is reiterative, so an entry who has a
  1. ; parent in ^DD, but the parent is deleted because it has no
  1. ; parent, will also be deleted. The parent of an entry in
  1. ; ^DD is defined as another entry in ^DD for sub-files, and
  1. ; an entry in ^DIC for primary files.
  1. ;
  1. ; The range of dictionary numbers is inclusive but residual
  1. ; entries for the high file number will not be deleted at
  1. ; the sub-file level. This is because sub-files are numbered
  1. ; with the primary file number with decimal numbers appended.
  1. ; The terminating check is ^DD entry greater than high file
  1. ; number specified, so by definition all sub-files for the
  1. ; high number are greater than the high number.
  1. ;
  1. ; This routine can be called by another routine by setting
  1. ; XBRLO and XBRHI and then D EN1^XBRESID.
  1. ;
  1. START ;
  1. W !!,"This program deletes residual entries in ^DD by a range of dictionary numbers.",!!
  1. ;
  1. LO ;
  1. R !,"Enter low dictionary number: ",XBRLO:$G(DTIME,999)
  1. Q:XBRLO'=+XBRLO
  1. HI ;
  1. R !,"Enter high dictionary number: ",XBRHI:$G(DTIME,999)
  1. Q:XBRHI'=+XBRHI!(XBRHI'>XBRLO)
  1. ;
  1. EN1 ;PEP - Clean residual entries in ^DD(. Hi/Lo file numbers must be set.
  1. I $D(XBRLO),$D(XBRHI),XBRLO=+XBRLO,XBRHI=+XBRHI,XBRHI>XBRLO,XBRLO'<2 G RESID
  1. W !!,"XBRLO and/or XBRHI missing or invalid!"
  1. G EOJ
  1. ;
  1. RESID ;
  1. W !!,"Now checking for residual ^DD entries within range.",!
  1. LOOP ;
  1. KILL ^TMP("XBRESID",$J)
  1. S XBRFILE=(XBRLO-.00000001)
  1. F XBRL=0:0 S XBRFILE=$O(^DD(XBRFILE)) Q:XBRFILE>XBRHI!(XBRFILE'=+XBRFILE) D CHK
  1. S XBRFILE=0
  1. F XBRL=0:0 S XBRFILE=$O(^TMP("XBRESID",$J,XBRFILE)) Q:XBRFILE="" I ^(XBRFILE),$D(^TMP("XBRESID",$J,^TMP("XBRESID",$J,XBRFILE)))!($D(^DIC(^TMP("XBRESID",$J,XBRFILE)))) S ^TMP("XBRESID",$J,XBRFILE)="I"
  1. S (XBRFILE,XBRY)=0
  1. F XBRL=0:0 S XBRFILE=$O(^TMP("XBRESID",$J,XBRFILE)) Q:XBRFILE="" I ^TMP("XBRESID",$J,XBRFILE)'="I" S XBRY=1 W !,XBRFILE KILL ^DD(XBRFILE)
  1. G:XBRY LOOP
  1. G EOJ
  1. ;
  1. CHK ;
  1. W "."
  1. Q:$D(^DIC(XBRFILE))
  1. I $D(^DD(XBRFILE,0,"UP")),^("UP")]"",(^("UP")<XBRLO!(^("UP")>XBRHI)) Q
  1. S ^TMP("XBRESID",$J,XBRFILE)=$G(^DD(XBRFILE,0,"UP"))
  1. Q
  1. ;
  1. EOJ ;
  1. D ^XBKTMP
  1. KILL XBRFILE,XBRHI,XBRL,XBRLO,XBRY
  1. Q
  1. ;