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

ACDPIMP.m

Go to the documentation of this file.
  1. ACDPIMP ;IHS/ADC/EDE/KML - UNIX or DOS IMPORT 10:08;
  1. ;;4.1;CHEMICAL DEPENDENCY MIS;;MAY 11, 1998
  1. ;;
  1. ;***************************************************************
  1. ;Read files to reconstruct the ^ACDPTMP global onto
  1. ;the area/hq machines.
  1. ;This global hold/transmits cdmis program data from the file
  1. ;^ACDQAN
  1. ;*************************************************************
  1. EN ;EP
  1. ;//[ACD SUPER8]
  1. ;
  1. ;Check for black box
  1. I '$L($T(OPEN^%ZISH)) W !,"But you need to first install patch 25 of Kernel 7" Q
  1. ;
  1. DIR ;Ask user for directory
  1. S DIR("B")=$S($P($G(^AUTTSITE(1,0)),U,21)=1:"/usr/spool/uucppublic",1:"C:\EXPORT")
  1. S DIR(0)="F^1:100",DIR("A")="Directory to import from "
  1. W !
  1. D ^DIR K DIR
  1. I $D(DIRUT) D K Q
  1. S ACDIR=X
  1. ;
  1. ;
  1. ;Stop user if facility
  1. I $E(ACD6DIG)'=9,$E(ACD6DIG,3,4)'="00" W !!,*7,*7,"Facilities have no need to import data." D K Q
  1. ;
  1. ;Check for unfinished import
  1. I $D(^ACDP1TMP) W !!,*7,*7,"But an incomplete import exists due to a corrupt location table.",!,"I will try again to complete the import..." D EN^ACDPIMP1,K Q
  1. ;
  1. ;Initialize ^ACDPTMP to reconstruct on area/hq machine
  1. I $D(^ACDPTMP) W !!,*7,*7,"It appears an import is presently running." D K Q
  1. K ^ACDPTMP ; kill of scratch global SAC EXEMPTION (2.3.2.3 KILL of unsubscripted globals is prohibited)
  1. ;
  1. W @IOF
  1. W !!,"It is advisable to capture the upcomming terminal screens to a printer.",!,"Please open a log file or turn on 'PRINT SCREEN'."
  1. F W !!,"Ok to Continue: " S %=2 D YN^DICN W:%=0 " Answer Yes or No" G:%'=1&(%'=0) K Q:%=1
  1. ;
  1. F ;File import from
  1. ;Gather all files into a list for display/selection
  1. K ACDF
  1. S Y=$$LIST^%ZISH(ACDIR,"ACDP*",.ACDF) D ERROR^ACDWUTL
  1. I '$O(ACDF(0)) W !!,*7,*7,"No CDMIS import files found in ",ACDIR
  1. I W !,"Job terminated....." D K Q
  1. ;
  1. ;
  1. ;Display files available for the user to import
  1. S ACDN=0 F I=0:0 S I=$O(ACDF(I)) Q:'I S ACDN=ACDN+1 W !,I," ",ACDF(I)
  1. S DIR(0)="L^1:"_ACDN,DIR("A")="Select the FILE to IMPORT"
  1. W !
  1. D ^DIR
  1. I $D(DIRUT) D K Q
  1. S ACDLIST=Y
  1. ;
  1. ;Process imported files one at a time
  1. S ACDIFC=0
  1. F ACDI=1:1 K ACDOWN S ACDFNA=$P(ACDLIST,",",ACDI) Q:ACDFNA="" S ACDFNA=ACDF(ACDFNA) D L1
  1. I 'ACDIFC W !!,"No data for update",! Q
  1. W !!!!,"Now updating CDMIS files with imported data....." D EN^ACDPIMP1
  1. W !!!!?20,"Finished........."
  1. D K Q
  1. ;
  1. ;
  1. L1 ;Open file to read from
  1. S Y=$$OPEN^%ZISH(ACDIR,ACDFNA,"R") I Y W !,"Error code: ",Y," detected." D K Q
  1. ;
  1. IN ;Read in from the imported file to build ^ACDPTMP
  1. U IO(0) W !!!,"Now importing data from file: ",ACDFNA
  1. F I=1:1:4 U IO R ACDHEAD(I):DTIME
  1. I $P(ACDHEAD(4),U,20)'="IMPORT FILE" U IO(0) W !,"Not an Import file...I will skip it" D ^%ZISC Q
  1. U IO(0) W !,"FACILITY: ",ACDHEAD(2)
  1. S ACDNODE=ACDHEAD(2)_","_$P(ACDHEAD(4),U)_","_$P(ACDHEAD(4),U,2)
  1. S ACDIFC=ACDIFC+1
  1. F U IO R ACD(1):DTIME,ACD(2):DTIME Q:ACD(1)="**" D
  1. .S @ACD(1)=ACD(2)
  1. .U IO(0) W "."
  1. .Q
  1. PASS ;Skip when user tries to import their own extract
  1. ;Skip when data to import is a duplicate
  1. D ^%ZISC
  1. W !,"Deleting ",ACDFNA," from your system now..."
  1. S Y=$$DEL^%ZISH(ACDIR,ACDFNA) D ERROR^ACDWUTL
  1. I $D(ACDOWN) U IO(0) W !,"No Updating has occurred for this file."
  1. ;
  1. XMD ;Audit trail
  1. D EN^ACDPXMD(ACDFNA,.ACDHEAD)
  1. Q
  1. ;
  1. K ;kill variables
  1. K ACDIFC
  1. K ACD,ACDF,ACDIOP,DIR,XMY,ACDLINE,ACDBWP,ACDCS,ACDDA,ACDDUZ,ACDFNA,ACDHEAD,ACDI,ACDIIF,ACDLIST,ACDN,ACDPG,ACDRNG,ACDRUG,ACDTDC,ACDUSER,ACDV,ACDNODE
  1. K ACDA,%X,%Y,ACDIR,DIK,DIC,ACDMSG,XMZ,XMDUZ