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

DIEFU.m

Go to the documentation of this file.
DIEFU ;SF/DPC-FILER UTILITIES ;1:56 PM  25 May 2001 [ 04/02/2003   8:25 AM ]
 ;;22.0;VA FileMan;**1001,1019**;APR 1, 2003;Build 2
 ;;22.0;VA FileMan;**85**;Mar 30, 1999
 ;Per VHA Directive 10-93-142, this routine should not be modified.
 ;IHS/OIT/FBD - DI*22.0*1019 - 11/13/2015 - ATTEMPT TO REDUCE DISK BLOCK
 ;   COLLISIONS BY REPLACING CLEAN SURBROUTINE'S UNCONDITIONAL KILLS
 ;   WITH CONDITIONAL PRE-CHECKS
 ;
INIZE ;
 N %,X,%H,DIE,DICS,DIC,%DT,DIK,%Y,%X,%D,%M,%I
 D DTNOLF^DICRW
 D CLEAN
 Q
CLEAN ;
 K DIRUT,DIROUT,DUOUT,DTOUT
 ;K ^TMP("DIERR",$J),^TMP("DIMSG",$J),^TMP("DIHELP",$J)  ;DI*22.0*1019 - IHS/OIT/FBD - ORIGINAL LINE - COMMENTED OUT
 I $D(^TMP("DIERR",$J)) K ^TMP("DIERR",$J)  ;DI*22.0*1019 - IHS/OIT/FBD - ADDED LINE
 I $D(^TMP("DIMSG",$J)) K ^TMP("DIMSG",$J)  ;DI*22.0*1019 - IHS/OIT/FBD - ADDED LINE
 I $D(^TMP("DIHELP",$J)) K ^TMP("DIHELP",$J)  ;DI*22.0*1019 - IHS/OIT/FBD - ADDED LINE
 K DIERR,DIHELP,DIMSG
 Q
 ;
CALLOUT(DIOUTAR) ;
 I '$$VROOT(DIOUTAR) Q
 I $D(DIERR) D
 . S @DIOUTAR@("DIERR")=DIERR
 . M @DIOUTAR@("DIERR")=^TMP("DIERR",$J)
 . K ^TMP("DIERR",$J)
 . Q
 I $D(DIHELP) D
 . S @DIOUTAR@("DIHELP")=DIHELP
 . M @DIOUTAR@("DIHELP")=^TMP("DIHELP",$J)
 . K ^TMP("DIHELP",$J)
 . Q
 I $D(DIMSG) D
 . S @DIOUTAR@("DIMSG")=DIMSG
 . M @DIOUTAR@("DIMSG")=^TMP("DIMSG",$J)
 . K ^TMP("DIMSG",$J)
 . Q
 Q
 ;
IEN(DIEFDA) ;
IENX ;
 I '$D(DIEFDA) Q 0
 N I,DIEFIEN S (I,DIEFIEN)="",DIEFDA(0)=$G(DIEFDA)
 F  S I=$O(DIEFDA(I)) Q:I=""  S DIEFIEN=DIEFIEN_DIEFDA(I)_","
 K DIEFDA(0)
 Q DIEFIEN
 ;
DA(DAIEN,DATARG) ;
DAX ;
 K DATARG N I
 F I=1:1:$L(DAIEN,",")-1 S DATARG(I-1)=$P(DAIEN,",",I)
 I $D(DATARG(0)) S DATARG=DATARG(0) K DATARG(0)
 Q
 ;
VROOT(DIEFAR) ;
 I DIEFAR'["(" Q 1
 I $E(DIEFAR,$L(DIEFAR))=")",$F(DIEFAR,")")>($F(DIEFAR,"(")+1) Q 1
 D BLD^DIALOG(202,"array root")
 Q 0
 ;
VFILE(F,FLAG) ;
VFILEX ;
 I $P($G(^DD(F,.01,0)),U,2)]"",$P(^(0),U,2)'["W" Q 1
 I $G(FLAG)["D" N P S P("FILE")=F D BLD^DIALOG(401,.P,.P)
 Q 0
 ;
VENTRY(DIEFF,DIEFIEN,DIEFFLG) ;
 N DIEFROOT,DIEFDA
 S DIEFFLG=$G(DIEFFLG),DIEFDA=$P(DIEFIEN,",")
 S DIEFROOT=$$ROOT^DIQGU(DIEFF,DIEFIEN,1,$S(DIEFFLG["D":1,1:0)) Q:DIEFROOT="" 0
 I $P($G(@DIEFROOT@(DIEFDA,0)),"^",1)="" D  Q 0
 . I DIEFFLG["D" N DIEFP S DIEFP("FILE")=DIEFF,DIEFP("IENS")=DIEFIEN D BLD^DIALOG(601,"",.DIEFP)
 I DIEFFLG["9" Q:'$$VMINUS9(DIEFF,DIEFIEN,DIEFFLG) 0
 Q 1
 ;
VMINUS9(DIEFF,DIEFIEN,DIEFFLG) ;
 N DIEFTOP,DIEFROOT S DIEFFLG=$G(DIEFFLG)
 S DIEFTOP=$P(DIEFIEN,",",$L(DIEFIEN,",")-1),DIEFROOT=$$ROOT^DIQGU($$FNO^DILIBF(DIEFF),.DIEFTOP,1,$S(DIEFFLG["D":1,1:0))
 Q:DIEFROOT="" 0
 I $D(@DIEFROOT@(DIEFTOP,-9)) D  Q 0
 . I DIEFFLG["D" N DIEFP S DIEFP("FILE")=DIEFF,DIEFP("IENS")=DIEFIEN D BLD^DIALOG(602,"",.DIEFP)
 Q 1
 ;
CHKFLD(DIEFF,DIEFFLD) ;
 I DIEFFLD'=+DIEFFLD S DIEFFLD=$$FLDNUM^DIEF1(DIEFF,DIEFFLD) Q:'DIEFFLD 0
 I '$$VFIELD(DIEFF,DIEFFLD,"D") Q 0
 Q DIEFFLD
 ;
VFIELD(F,FLD,FLAG) ;
VFIELDX ;
 I $D(^DD(F,FLD)) Q 1
 I $G(FLAG)["D" N P S (P(1),P("FIELD"))=FLD,P("FILE")=F D BLD^DIALOG(501,.P,.P)
 Q 0
 ;
DT(DIEFDT,DIEFX,DIEFY,DIEFDT0,DIOUTAR) ;
DTX ;
 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
 I '$D(DIFM) N DIFM S DIFM=1 D INIZE
 N %DT,X,Y
 S DIEFDT=$G(DIEFDT)
 I $G(DIEFX)="" D BLD^DIALOG(202,"date being converted") G DTOUT
 I '$$VERFLG^DIEFU(DIEFDT,"FMNPRSTXEeI") G DTOUT
 I DIEFX?."?" D DT^DIEH1(DIEFDT) S DIEFY=-1 G DTOUT
 S %DT=DIEFDT,X=DIEFX S:$G(DIEFDT0)]"" %DT(0)=DIEFDT0 D ^%DT S DIEFY=Y
 I DIEFY=-1 D:DIEFDT'["e"  G DTOUT
 . N DIEFP
 . S DIEFP(1)=DIEFX,DIEFP(2)="date/time"
 . D BLD^DIALOG(330,.DIEFP,.DIEFP)
 I DIEFDT["E" D DD^%DT S DIEFY(0)=Y
DTOUT I $G(DIOUTAR)]"" D CALLOUT^DIEFU(DIOUTAR)
 Q
 ;
VERFLG(FLG,GDFLGS) ;
 N EI
 S EI=$TR(FLG,GDFLGS,"")
 I EI="" Q 1
 D BLD^DIALOG(301,EI,EI)
 Q 0
 ;
XA(DIEFF,DIEFIEN,DIEFFLD,DIEFNVAL,DIEFOVAL) ;
 N DA,DIEFCNOD,DOREPL
 S DIEFNVAL=$G(DIEFNVAL),DIEFOVAL=$G(DIEFOVAL)
 Q:DIEFNVAL=DIEFOVAL
 D DA(DIEFIEN,.DA)
 D XRFAUD^DIEF
 Q
 ;
FILENM(F) ;
 N NM
 S NM=$P($G(^DIC($$FNO^DILIBF(F),0)),U)
 ;I NM="" <DO ERROR>
 Q NM
 ;
FLDNM(F,FLD) ;
 N NM,UP
 S NM=$P($G(^DD(F,FLD,0)),U,1)
 F  S UP=$G(^DD(F,0,"UP")) Q:'UP  D
 . S NM=NM_" in "_$P($G(^DD(F,0)),U,1)
 . S F=UP
 . Q
 ;I NM="" <DO ERROR>
 Q NM