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

ADEXCOD2.m

Go to the documentation of this file.
ADEXCOD2 ; IHS/HQT/MJL - UPDATE ADA CODE FILE PART 3 ;08:45 PM  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;CHECK FOR DUPES IN AUTTADA
 D DUPE
 ;KILL AND REBUILD ALL XREFS
 D REBLD
 ;
END K ^ADEUTIL("ADEXCOD") ;^ADEUTIL("ADEXCOD") transient global
 Q
 ;
DUPE N ADEX,ADECOD,ADE,ADEXFRM
 K ^ADEUTIL("ADEXCOD")
 S ADEX=0 F  S ADEX=$O(^AUTTADA(ADEX)) Q:'+ADEX  D D1
 Q
D1 W "." ;***TEST FOR INTERACTIVE MODE
 Q:$P(^AUTTADA(ADEX,0),U,8)]""  ;FHL 9/9/98;IHS/HMW P2
 S ADECOD=$P(^AUTTADA(ADEX,0),U)
 I $D(^ADEUTIL("ADEXCOD",ADECOD)) D FIX
 S ^ADEUTIL("ADEXCOD",ADECOD)=ADEX ;transient working global
 Q
FIX ;IF DUPES ARE LOCATED, SET EARLIEST ONE(S) (BY DFN) TO INACTIVE
 ;      (IF IT'S NOT INACTIVE ALREADY)
 S ADE("FIRST")=^ADEUTIL("ADEXCOD",ADECOD)
 W !,"Duplicate Code ",ADECOD," at DFN ",ADE("FIRST")," and ",ADEX,".",!,"Code at DFN ",ADE("FIRST")," inactive. Inactivation date: "
 I $P(^AUTTADA(ADE("FIRST"),0),U,8)="" D  Q
 . S X=DT
 . S ADEXFRM=$P(^DD(9999999.31,.08,0),U,5,99) ;Input Transform
 . W "TODAY"
 . X ADEXFRM
 . S:$D(X) $P(^AUTTADA(ADE("FIRST"),0),U,8)=X
 S Y=$P(^AUTTADA(ADE("FIRST"),0),U,8) X ^DD("DD") W Y,!
 Q
 ;
REBLD ;
 N ADEX
 ;Kill cross-references prior to reindex:
 F ADEX="B","BA","C","D","AC" K ^AUTTADA(ADEX)
 S DIK="^AUTTADA("
 D IXALL^DIK
 Q