PSSSYN ;BIR/WRT-ADD SYNONYMS FROM 50 TO ORDERABLE ITEM FILE ; 09/02/97 8:56
;;1.0;PHARMACY DATA MANAGEMENT;;9/30/97
D LOOP,DEX
Q
LOOP F NUM=0:0 S NUM=$O(^PSDRUG(NUM)) Q:'NUM I $D(^PSDRUG(NUM,2)) S POI=$P(^PSDRUG(NUM,2),"^",1) I POI]"",$D(^PS(50.7,POI,0)) D LOOP1
Q
LOOP1 I $D(^PSDRUG(NUM,1,0)) F NUMB=0:0 S NUMB=$O(^PSDRUG(NUM,1,NUMB)) Q:'NUMB S IUSE=$P(^PSDRUG(NUM,1,NUMB,0),"^",3) I IUSE=0!(IUSE="") S SYNO=$P(^PSDRUG(NUM,1,NUMB,0),"^",1) D CHEK
Q
CHEK I '$D(^PS(50.7,"C",SYNO,POI)) D ADD
Q
ADD S DA(1)=POI,DIC="^PS(50.7,"_POI_",2,",X=SYNO,DIC(0)="L",DIC("P")=$P(^DD(50.7,2,0),"^",2),DLAYGO=50.72 D ^DIC
Q
DEX K ^PS(50.7,"C") F IEN=0:0 S IEN=$O(^PS(50.7,IEN)) Q:'IEN F IEN1=0:0 S IEN1=$O(^PS(50.7,IEN,2,IEN1)) Q:'IEN1 S SYN=$P(^PS(50.7,IEN,2,IEN1,0),"^",1),^PS(50.7,"C",SYN,IEN,IEN1)=""
Q
PSSSYN ;BIR/WRT-ADD SYNONYMS FROM 50 TO ORDERABLE ITEM FILE ; 09/02/97 8:56
+1 ;;1.0;PHARMACY DATA MANAGEMENT;;9/30/97
+2 DO LOOP
DO DEX
+3 QUIT
LOOP FOR NUM=0:0
SET NUM=$ORDER(^PSDRUG(NUM))
IF 'NUM
QUIT
IF $DATA(^PSDRUG(NUM,2))
SET POI=$PIECE(^PSDRUG(NUM,2),"^",1)
IF POI]""
IF $DATA(^PS(50.7,POI,0))
DO LOOP1
+1 QUIT
LOOP1 IF $DATA(^PSDRUG(NUM,1,0))
FOR NUMB=0:0
SET NUMB=$ORDER(^PSDRUG(NUM,1,NUMB))
IF 'NUMB
QUIT
SET IUSE=$PIECE(^PSDRUG(NUM,1,NUMB,0),"^",3)
IF IUSE=0!(IUSE="")
SET SYNO=$PIECE(^PSDRUG(NUM,1,NUMB,0),"^",1)
DO CHEK
+1 QUIT
CHEK IF '$DATA(^PS(50.7,"C",SYNO,POI))
DO ADD
+1 QUIT
ADD SET DA(1)=POI
SET DIC="^PS(50.7,"_POI_",2,"
SET X=SYNO
SET DIC(0)="L"
SET DIC("P")=$PIECE(^DD(50.7,2,0),"^",2)
SET DLAYGO=50.72
DO ^DIC
+1 QUIT
DEX KILL ^PS(50.7,"C")
FOR IEN=0:0
SET IEN=$ORDER(^PS(50.7,IEN))
IF 'IEN
QUIT
FOR IEN1=0:0
SET IEN1=$ORDER(^PS(50.7,IEN,2,IEN1))
IF 'IEN1
QUIT
SET SYN=$PIECE(^PS(50.7,IEN,2,IEN1,0),"^",1)
SET ^PS(50.7,"C",SYN,IEN,IEN1)=""
+1 QUIT