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

AURESID.m

Go to the documentation of this file.
  1. AURESID ; CLEAN UP RESIDUAL ENTRIES IN ^DD [ 04/07/88 2:41 PM ]
  1. ;
  1. ; This routine deletes residual entries in ^DD by a range of
  1. ; dictionary numbers. A residual entry is one that has no parent.
  1. ; The process is reiterative, so an entry who has a parent
  1. ; in ^DD, but the parent is deleted because it has no
  1. ; parent, will also be deleted. The parent of an entry
  1. ; in ^DD is defined as another entry in ^DD for sub-files,
  1. ; and 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. ; AURLO and AURHI and then D EN1^AURESID
  1. ;
  1. W !!,"This program deletes residual entries in ^DD by a range of dictionary numbers.",!!
  1. ;
  1. LO R !,"Enter low dictionary number: ",AURLO Q:AURLO'=+AURLO
  1. HI R !,"Enter high dictionary number: ",AURHI Q:AURHI'=+AURHI!(AURHI'>AURLO)
  1. ;
  1. EN1 ; ENTRY POINT FOR CALLING ROUTINE
  1. I $D(AURLO),$D(AURHI),AURLO=+AURLO,AURHI=+AURHI,AURHI>AURLO,AURLO'<2 G RESID
  1. W !!,"AURLO and/or AURHI missing or invalid!"
  1. G EOJ
  1. ;
  1. RESID W !!,"Now checking for residual ^DD entries within range.",!
  1. LOOP K ^UTILITY("AURESID",$J) S AURFILE=(AURLO-.00000001) F AURL=0:0 S AURFILE=$O(^DD(AURFILE)) Q:AURFILE>AURHI!(AURFILE'=+AURFILE) D CHK
  1. S AURFILE=0 F AURL=0:0 S AURFILE=$O(^UTILITY("AURESID",$J,AURFILE)) Q:AURFILE="" I ^(AURFILE),$D(^UTILITY("AURESID",$J,^UTILITY("AURESID",$J,AURFILE)))!($D(^DIC(^UTILITY("AURESID",$J,AURFILE)))) S ^UTILITY("AURESID",$J,AURFILE)="I"
  1. S (AURFILE,AURY)=0 F AURL=0:0 S AURFILE=$O(^UTILITY("AURESID",$J,AURFILE)) Q:AURFILE="" I ^UTILITY("AURESID",$J,AURFILE)'="I" S AURY=1 W !,AURFILE K ^DD(AURFILE)
  1. G:AURY LOOP
  1. G EOJ
  1. ;
  1. CHK ;
  1. W "."
  1. Q:$D(^DIC(AURFILE))
  1. I $D(^DD(AURFILE,0,"UP")),^("UP")'="",(^("UP")<AURLO!(^("UP")>AURHI)) Q
  1. S ^UTILITY("AURESID",$J,AURFILE)=$S($D(^DD(AURFILE,0,"UP"))#2:^("UP"),1:"")
  1. Q
  1. ;
  1. EOJ ;
  1. K ^UTILITY("AURESID",$J)
  1. K AURFILE,AURHI,AURL,AURLO,AURY
  1. Q