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

PSNPST.m

Go to the documentation of this file.
PSNPST ;BIR/WRT-POST INSTALL routine ; 02/03/00 7:52
 ;;4.0; NATIONAL DRUG FILE;**22**; 30 Oct 98
 ;
 ;Reference to ^PSDRUG supported by DBIA #2352
 ;Reference to ^PS(51.7 supported by DBIA #2935
 ;Reference to ^PS(50.7 supported by DBIA #2180
 ;
 K ^TMP($J,"PSNFI") D FIX,BUILD,START,BRANCH3,KILL
 Q
BUILD F NDT=0:0 S NDT=$O(^PS(51.7,NDT)) Q:'NDT  S TEXT=^PS(51.7,NDT,2,1,0),^TMP($J,"PSNFI",TEXT)=NDT
 Q
START U IO W !,"Converting DRUG file (#50)" F IFN=0:0 S IFN=$O(^PSDRUG(IFN)) Q:'IFN  U IO W:'(IFN#100) "." S LINK=$P($G(^PSDRUG(IFN,"ND")),"^",3) I LINK D BRANCH1,BRANCH2
 Q
BRANCH1 S FORMI=$P($G(^PSNDF(50.68,LINK,5)),"^") I FORMI]"" S $P(^PSDRUG(IFN,"ND"),"^",11)=FORMI
 Q
BRANCH2 S NFR=$P($G(^PSNDF(50.68,LINK,6,1,0)),"^") I NFR]"",$D(^TMP($J,"PSNFI",NFR)) S ENTRY=$P(^TMP($J,"PSNFI",NFR),"^") D ENTER
 Q
ENTER I '$D(^PSDRUG(IFN,9,0)) S DA(1)=IFN,DIC="^PSDRUG("_IFN_",9,",X=ENTRY,DIC(0)="L",DIC("P")=$P(^DD(50,37,0),"^",2),DLAYGO=50.037 D FILE^DICN
 Q
KILL K ^TMP($J,"PSNFI"),LINK,NDT,IFN,FORMI,NFR,ENTRY,NFLAG,NFLAG1,PSSORDIT,ZZZ,IEN
 Q
BRANCH3 U IO W !,"Converting PHARMACY ORDERABLE ITEM file (#50.7)" D BRANCH4
 Q
BRANCH4 F PSSORDIT=0:0 S PSSORDIT=$O(^PS(50.7,PSSORDIT)) Q:'PSSORDIT  U IO W:'(PSSORDIT#100) "." I $D(^PSDRUG("ASP",PSSORDIT)) S NFLAG=0,NFLAG1=0 F ZZZ=0:0 S ZZZ=$O(^PSDRUG("ASP",PSSORDIT,ZZZ)) Q:'ZZZ  D NF1,NF2
 Q
NF1 D:NFLAG=0 NF3
 S:$P(^PSDRUG(ZZZ,0),"^",9)'="" NFLAG1=1
 Q
NF2 I NFLAG=0 S $P(^PS(50.7,PSSORDIT,0),"^",12)=1
 I NFLAG=1 S $P(^PS(50.7,PSSORDIT,0),"^",12)=""
 Q
NF3 S:$P(^PSDRUG(ZZZ,0),"^",9)="" NFLAG=1
 Q
FIX F IEN=0:0 S IEN=$O(^PSNDF(50.68,IEN)) Q:'IEN  I '$D(^PSNDF(50.68,IEN,5)) S ^PSNDF(50.68,IEN,5)=0
 Q