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

BGP2AUUL.m

Go to the documentation of this file.
BGP2AUUL ;IHS/CMI/LAB - AREA UPLOAD;
 ;;12.1;IHS CLINICAL REPORTING;;MAY 17, 2012;Build 66
 ;
DESC ;----- ROUTINE DESCRIPTION
 ;; 
 ;;This routine was copied from the BGP1ULF routine and modified to
 ;;remove user interaction and screen output and other unneeded stuff.
 ;;$$END
 ;
 N I,X F I=1:1 S X=$P($T(DESC+I),";;",2) Q:X["$$END"  D EN^DDIOL(X)
 Q
 ;
EN(BGPDIR,BGPFILE) ;EP -- MAIN ENTRY POINT
 ;      INPUT:
 ;      BGPDIR   =  DIRECTORY
 ;      BGPFILE  =  FILE TO BE PROCESSED
 ;
READF ;EP read file
 NEW Y,X,I,BGPC
 S BGPC=1
 S Y=$$OPEN^%ZISH(BGPDIR,BGPFILE,"R")
 I Y D  G EOJ
 . S BGPERR="UNABLE TO OPEN FILE '"_BGPDIR_BGPFILE_"'"
 . ;S $ZR="<NOTOPEN>READF^BGPGPULF"
 . ;D ^ZTER 
 KILL ^TMP("BGPGPUPL",$J)
 F I=1:1 U IO R X:DTIME S X=$$STRIP(X) Q:X=""  S ^TMP("BGPGPUPL",$J,BGPC,0)=X,BGPC=BGPC+1 Q:$$STATUS^%ZISH=-1
 D ^%ZISC
PROC ;
 S BGP0=$P($G(^TMP("BGPGPUPL",$J,1,0)),"|",9)
 S BGPG=$P($G(^TMP("BGPGPUPL",$J,1,0)),"|")
 F X=1:1:14 S Y="BGP"_X,@Y=$P(BGP0,U,X)
 ;find existing entry and if exists, delete it
 S (X,BGPOIEN)=0 F  S X=$O(^BGPGPDCW(X)) Q:X'=+X  D
 .I '$D(^BGPGPDCW(X,0)) K ^BGPGPDCW(X) Q
 .S Y=^BGPGPDCW(X,0)
 .Q:$P(Y,U)'=BGP1
 .Q:$P(Y,U,2)'=BGP2
 .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