PSN5ND ;BIR/MAM - Clean up "ND" nodes ;[ 01/12/98 5:18 PM ]
;;3.18; NATIONAL DRUG FILE;**1**;12 Jan 98
;
PSNDF ; clean up "ND" nodes in PSNDF
S IFN=0 F S IFN=$O(^PSNDF(IFN)) Q:'IFN K ^PSNDF(IFN,"ND")
;
PSDRUG ; update "ND" nodes in ^PSDRUG
;
K ^PSDRUG("AQ1")
S IFN=0 F S IFN=$O(^PSDRUG(IFN)) Q:'IFN D RESET
K IFN,MMM,NNN
Q
;
RESET ; reset the proper 10th piece in ^PSDRUG(IFN,"ND")
;
I '$D(^PSDRUG(IFN,"ND")) Q
S MMM=$P(^PSDRUG(IFN,"ND"),"^",1) I MMM="" Q
S NNN=$P(^PSDRUG(IFN,"ND"),"^",3) I NNN="" Q
I $D(^PSNDF(MMM,5,NNN,2)) S $P(^PSDRUG(IFN,"ND"),"^",10)=$P(^PSNDF(MMM,5,NNN,2),"^",2),^PSDRUG("AQ1",$P(^PSNDF(MMM,5,NNN,2),"^",2),IFN)=""
Q
PSN5ND ;BIR/MAM - Clean up "ND" nodes ;[ 01/12/98 5:18 PM ]
+1 ;;3.18; NATIONAL DRUG FILE;**1**;12 Jan 98
+2 ;
PSNDF ; clean up "ND" nodes in PSNDF
+1 SET IFN=0
FOR
SET IFN=$ORDER(^PSNDF(IFN))
IF 'IFN
QUIT
KILL ^PSNDF(IFN,"ND")
+2 ;
PSDRUG ; update "ND" nodes in ^PSDRUG
+1 ;
+2 KILL ^PSDRUG("AQ1")
+3 SET IFN=0
FOR
SET IFN=$ORDER(^PSDRUG(IFN))
IF 'IFN
QUIT
DO RESET
+4 KILL IFN,MMM,NNN
+5 QUIT
+6 ;
RESET ; reset the proper 10th piece in ^PSDRUG(IFN,"ND")
+1 ;
+2 IF '$DATA(^PSDRUG(IFN,"ND"))
QUIT
+3 SET MMM=$PIECE(^PSDRUG(IFN,"ND"),"^",1)
IF MMM=""
QUIT
+4 SET NNN=$PIECE(^PSDRUG(IFN,"ND"),"^",3)
IF NNN=""
QUIT
+5 IF $DATA(^PSNDF(MMM,5,NNN,2))
SET $PIECE(^PSDRUG(IFN,"ND"),"^",10)=$PIECE(^PSNDF(MMM,5,NNN,2),"^",2)
SET ^PSDRUG("AQ1",$PIECE(^PSNDF(MMM,5,NNN,2),"^",2),IFN)=""
+6 QUIT