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

BCHEXDI.m

Go to the documentation of this file.
  1. BCHEXDI ; IHS/CMI/LAB - INIT FOR CHR EXPORT ;
  1. ;;2.0;IHS RPMS CHR SYSTEM;;OCT 23, 2012;Build 27
  1. ;
  1. ;Initialization for export process.
  1. ;Set up all necessary variables, check site file, etc.
  1. ;
  1. START ;
  1. D BASICS ; Set variables like U,DT,DUZ(2) etc.
  1. D CHKSITE ; Make sure Site file has correct fields.
  1. Q:BCH("QFLG")
  1. ;
  1. D:BCHO("RUN")="NEW" ^BCHEXDI2 ; Do new run initialization.
  1. Q:$D(ZTQUEUED)
  1. Q:BCH("QFLG")
  1. D:BCHO("RUN")="NEW" QUEUE
  1. Q
  1. ;
  1. BASICS ; BASIC INITS
  1. D HOME^%ZIS S BCHBS=$S('$D(ZTQUEUED):IOBS,1:"")
  1. K BCH,BCHS,BCHV,BCHT,BCHE
  1. S BCH("RUN LOCATION")=$P(^AUTTLOC(DUZ(2),0),U,10),BCH("QFLG")=0
  1. S (BCH("U"),BCH("D"),BCH("ERROR COUNT"),BCH("COUNT"),BCH("VISIT COUNT"))=0
  1. Q
  1. ;
  1. CHKSITE ; CHECK SITE FILE
  1. I '$D(^BCHSITE(DUZ(2),0)) W:'$D(ZTQUEUED) !!,"*** Site file has not been setup! ***" S BCH("QFLG")=1 Q
  1. I '$D(^BCHSITE(DUZ(2))) W:'$D(ZTQUEUED) !!,"*** RUN LOCATION not in SITE file!" S BCH("QFLG")=2 Q
  1. ;I $P(^BCHSITE(DUZ(2),0),U,8)="" W:'$D(ZTQUEUED) !!,"*** Site file does not specify EXPORT METHOD" S BCH("QFLG")=3 Q
  1. ;I $P(^BCHSITE(DUZ(2),0),U,7)="",$P(^BCHSITE(DUZ(2),0),U,8)="A" W:'$D(ZTQUEUED) !!,"***No DEFAULT DEVICE value in Site file! ***" S BCH("QFLG")=4
  1. Q
  1. ;
  1. ;
  1. ;
  1. QUEUE ;EP - QUEUE TX GENERATOR
  1. K ZTSK
  1. S DIR(0)="Y",DIR("A")="Do you want to QUEUE this to run at a later time",DIR("B")="N" D ^DIR K DIR S:$D(DUOUT) DIRUT=1
  1. I Y=1 D QUEUE1 Q
  1. I BCHO("RUN")="NEW",$D(DIRUT) S BCH("QFLG")=99 S DA=BCH("RUN LOG"),DIK="^BCHXLOG(" W !,"Okay, you '^'ed out or timed out so I'm deleting the Log entry and quitting.",! D ^DIK K DIK,DA
  1. I BCHO("RUN")="REDO",$D(DIRUT) S BCH("QFLG")=99 Q
  1. Q
  1. QUEUE1 ;
  1. S ZTRTN=$S(BCHO("RUN")="NEW":"DRIVER^BCHEXD",1:"EN^BCHEXRE")
  1. S ZTIO="",ZTDTH="",ZTDESC="CHR CHR EXPORT" S ZTSAVE("BCH*")="",ZTSAVE("APCD*")=""
  1. D ^%ZTLOAD
  1. W !!,$S($D(ZTSK):"Request Queued!!",1:"Request cancelled")
  1. I '$D(ZTSK),BCHO("RUN")="NEW" S BCH("QFLG")=99 S DA=BCH("RUN LOG"),DIK="^BCHXLOG(" W !,"Okay, you '^'ed out or timed out so I'm deleting the Log entry and quitting.",! D ^DIK K DIK,DA Q ;LAB/OHPRD BCH*1.51*2 ADDED BCHO("RUN")="NEW"
  1. S BCHO("QUEUE")=""
  1. S DIE="^BCHXLOG(",DA=BCH("RUN LOG"),DR=".15///Q" D CALLDIE^BCHUTIL
  1. K ZTSK
  1. Q