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

PXRMEXRP.m

Go to the documentation of this file.
PXRMEXRP ;SLC/AGP - Re-pack protocol. ;Aug 20, 2019@09:57
 ;;2.0;CLINICAL REMINDERS;**45**;Feb 04, 2005;Build 566
 ;==========================
 Q
 ;
EN(IEN,FAIL,NOTINLM) ;
 N CLOK,FILES,NAME,RESULTS,SELLIST
 S NAME=$P($G(^PXD(811.8,IEN,0)),U)
 D FULL^VALM1
 W !,"Repacking entry: "_NAME
 S RESULTS("NAME")=NAME
 D FILELIST(.FILES)
 I $D(^PXD(811.8,IEN,120)) D PROC120(.RESULTS,.FILES,IEN,.FAIL) I FAIL=1 W !,"Could not repack exchange entry "_NAME H 2 Q
 I '$D(^PXD(811.8,IEN,120)) D
 .S CLOK=1
 .I '$D(^PXD(811.8,PXRMRIEN,120)) D CLIST^PXRMEXCO(IEN,.CLOK)
 .I 'CLOK S FAIL=1 Q
 .D PROC120(.RESULTS,.FILES,IEN,.FAIL)
 I FAIL=1 W !,"Could not repack exchange entry "_NAME H 2 Q
 D SELLIST(.RESULTS,.SELLIST)
 I '$D(SELLIST) W !,"Could not repack exchange entry "_NAME S FAIL=1 H 2 Q
 ;I $D(SELLIST) D CRE^PXRMEXPD(.SELLIST)
 I $D(SELLIST) D CRE^PXRMEXPD(.SELLIST,NAME,NOTINLM)
 Q
 ;
FILELIST(FILELST) ;
 S FILELST(811.4)=""
 S FILELST(810.8)=""
 S FILELST(811.9)=""
 S FILELST(801.41)=""
 S FILELST(810.7)=""
 S FILELST(810.2)=""
 S FILELST(810.4)=""
 S FILELST(810.9)=""
 S FILELST(811.6)=""
 S FILELST(811.2)=""
 S FILELST(811.5)=""
 S FILELST(801)=""
 S FILELST(801.1)=""
 Q
 ;
PROC120(RESULTS,FILES,IEN,FAIL) ;
 N ERR,FILE,IDX,ITEM,NAME,NODE,NUM,SEL
 S IDX=0 F  S IDX=$O(^PXD(811.8,IEN,120,IDX)) Q:IDX'>0!(FAIL=1)  D
 .S NODE=$G(^PXD(811.8,IEN,120,IDX,0))
 .S FILE=+$P(NODE,U,2)
 .I '$D(FILES(FILE)) Q
 .S NUM=0 F  S NUM=$O(^PXD(811.8,IEN,120,IDX,1,NUM)) Q:NUM'>0!(FAIL=1)  D
 ..S NODE=$G(^PXD(811.8,IEN,120,IDX,1,NUM,0))
 ..S NAME=$P(NODE,U)
 ..S ITEM=$$FIND1^DIC(FILE,"","X",NAME,,,"ERR")
 ..I ITEM=0 W !,"Could not find "_$$GET1^DID(FILE,"","","NAME")_" entry: "_NAME S FAIL=1 Q
 ..I $D(ERR) S FAIL=1 D AWRITE^PXRMUTIL("ERR") Q
 ..I $P(NODE,U,7)=0 Q
 ..S RESULTS("FILES",FILE,ITEM)=""
 Q
 ;
SELLIST(RESULTS,SELLIST) ;
 N FILE,IEN,NUMF,RANK
 D PACKORD^PXRMEXPD(.RANK)
 S FILE=0 F  S FILE=$O(RESULTS("FILES",FILE)) Q:FILE'>0  D
 .S IEN=0,NUMF=0 F  S IEN=$O(RESULTS("FILES",FILE,IEN)) Q:IEN'>0  D
 ..S NUMF=NUMF+1
 ..S SELLIST(FILE,NUMF)=IEN
 ..S SELLIST(FILE,"IEN",IEN)=NUMF
 Q
 ;
SELECT ;
 N FAIL,IND,LIST,LNUM,PXRMNAT,PXRMRIEN
 ;Get the list to install.
 S LIST=$$GETLIST^PXRMEXLR()
 ;If there is no list quit.
 I LIST="^" S VALMBCK="R" Q
 S FAIL=0
 F IND=1:1:$L(LIST,",")-1  Q:FAIL=1  D
 . S LNUM=$P(LIST,",",IND)
 .;Get the repository IEN.
 . S PXRMRIEN=$$RIEN^PXRMEXU1(LNUM)
 . D EN(PXRMRIEN,.FAIL,0)
 S VALMBCK="R"
 Q
 ;