source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIEFU.m@ 841

Last change on this file since 841 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1DIEFU ;SF/DPC-FILER UTILITIES ;1:56 PM 25 May 2001
2 ;;22.0;VA FileMan;**85**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4INIZE ;
5 N %,X,%H,DIE,DICS,DIC,%DT,DIK,%Y,%X,%D,%M,%I
6 D DTNOLF^DICRW
7 D CLEAN
8 Q
9CLEAN ;
10 K DIRUT,DIROUT,DUOUT,DTOUT
11 K ^TMP("DIERR",$J),^TMP("DIMSG",$J),^TMP("DIHELP",$J)
12 K DIERR,DIHELP,DIMSG
13 Q
14 ;
15CALLOUT(DIOUTAR) ;
16 I '$$VROOT(DIOUTAR) Q
17 I $D(DIERR) D
18 . S @DIOUTAR@("DIERR")=DIERR
19 . M @DIOUTAR@("DIERR")=^TMP("DIERR",$J)
20 . K ^TMP("DIERR",$J)
21 . Q
22 I $D(DIHELP) D
23 . S @DIOUTAR@("DIHELP")=DIHELP
24 . M @DIOUTAR@("DIHELP")=^TMP("DIHELP",$J)
25 . K ^TMP("DIHELP",$J)
26 . Q
27 I $D(DIMSG) D
28 . S @DIOUTAR@("DIMSG")=DIMSG
29 . M @DIOUTAR@("DIMSG")=^TMP("DIMSG",$J)
30 . K ^TMP("DIMSG",$J)
31 . Q
32 Q
33 ;
34IEN(DIEFDA) ;
35IENX ;
36 I '$D(DIEFDA) Q 0
37 N I,DIEFIEN S (I,DIEFIEN)="",DIEFDA(0)=$G(DIEFDA)
38 F S I=$O(DIEFDA(I)) Q:I="" S DIEFIEN=DIEFIEN_DIEFDA(I)_","
39 K DIEFDA(0)
40 Q DIEFIEN
41 ;
42DA(DAIEN,DATARG) ;
43DAX ;
44 K DATARG N I
45 F I=1:1:$L(DAIEN,",")-1 S DATARG(I-1)=$P(DAIEN,",",I)
46 I $D(DATARG(0)) S DATARG=DATARG(0) K DATARG(0)
47 Q
48 ;
49VROOT(DIEFAR) ;
50 I DIEFAR'["(" Q 1
51 I $E(DIEFAR,$L(DIEFAR))=")",$F(DIEFAR,")")>($F(DIEFAR,"(")+1) Q 1
52 D BLD^DIALOG(202,"array root")
53 Q 0
54 ;
55VFILE(F,FLAG) ;
56VFILEX ;
57 I $P($G(^DD(F,.01,0)),U,2)]"",$P(^(0),U,2)'["W" Q 1
58 I $G(FLAG)["D" N P S P("FILE")=F D BLD^DIALOG(401,.P,.P)
59 Q 0
60 ;
61VENTRY(DIEFF,DIEFIEN,DIEFFLG) ;
62 N DIEFROOT,DIEFDA
63 S DIEFFLG=$G(DIEFFLG),DIEFDA=$P(DIEFIEN,",")
64 S DIEFROOT=$$ROOT^DIQGU(DIEFF,DIEFIEN,1,$S(DIEFFLG["D":1,1:0)) Q:DIEFROOT="" 0
65 I $P($G(@DIEFROOT@(DIEFDA,0)),"^",1)="" D Q 0
66 . I DIEFFLG["D" N DIEFP S DIEFP("FILE")=DIEFF,DIEFP("IENS")=DIEFIEN D BLD^DIALOG(601,"",.DIEFP)
67 I DIEFFLG["9" Q:'$$VMINUS9(DIEFF,DIEFIEN,DIEFFLG) 0
68 Q 1
69 ;
70VMINUS9(DIEFF,DIEFIEN,DIEFFLG) ;
71 N DIEFTOP,DIEFROOT S DIEFFLG=$G(DIEFFLG)
72 S DIEFTOP=$P(DIEFIEN,",",$L(DIEFIEN,",")-1),DIEFROOT=$$ROOT^DIQGU($$FNO^DILIBF(DIEFF),.DIEFTOP,1,$S(DIEFFLG["D":1,1:0))
73 Q:DIEFROOT="" 0
74 I $D(@DIEFROOT@(DIEFTOP,-9)) D Q 0
75 . I DIEFFLG["D" N DIEFP S DIEFP("FILE")=DIEFF,DIEFP("IENS")=DIEFIEN D BLD^DIALOG(602,"",.DIEFP)
76 Q 1
77 ;
78CHKFLD(DIEFF,DIEFFLD) ;
79 I DIEFFLD'=+DIEFFLD S DIEFFLD=$$FLDNUM^DIEF1(DIEFF,DIEFFLD) Q:'DIEFFLD 0
80 I '$$VFIELD(DIEFF,DIEFFLD,"D") Q 0
81 Q DIEFFLD
82 ;
83VFIELD(F,FLD,FLAG) ;
84VFIELDX ;
85 I $D(^DD(F,FLD)) Q 1
86 I $G(FLAG)["D" N P S (P(1),P("FIELD"))=FLD,P("FILE")=F D BLD^DIALOG(501,.P,.P)
87 Q 0
88 ;
89DT(DIEFDT,DIEFX,DIEFY,DIEFDT0,DIOUTAR) ;
90DTX ;
91 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
92 I '$D(DIFM) N DIFM S DIFM=1 D INIZE
93 N %DT,X,Y
94 S DIEFDT=$G(DIEFDT)
95 I $G(DIEFX)="" D BLD^DIALOG(202,"date being converted") G DTOUT
96 I '$$VERFLG^DIEFU(DIEFDT,"FMNPRSTXEeI") G DTOUT
97 I DIEFX?."?" D DT^DIEH1(DIEFDT) S DIEFY=-1 G DTOUT
98 S %DT=DIEFDT,X=DIEFX S:$G(DIEFDT0)]"" %DT(0)=DIEFDT0 D ^%DT S DIEFY=Y
99 I DIEFY=-1 D:DIEFDT'["e" G DTOUT
100 . N DIEFP
101 . S DIEFP(1)=DIEFX,DIEFP(2)="date/time"
102 . D BLD^DIALOG(330,.DIEFP,.DIEFP)
103 I DIEFDT["E" D DD^%DT S DIEFY(0)=Y
104DTOUT I $G(DIOUTAR)]"" D CALLOUT^DIEFU(DIOUTAR)
105 Q
106 ;
107VERFLG(FLG,GDFLGS) ;
108 N EI
109 S EI=$TR(FLG,GDFLGS,"")
110 I EI="" Q 1
111 D BLD^DIALOG(301,EI,EI)
112 Q 0
113 ;
114XA(DIEFF,DIEFIEN,DIEFFLD,DIEFNVAL,DIEFOVAL) ;
115 N DA,DIEFCNOD,DOREPL
116 S DIEFNVAL=$G(DIEFNVAL),DIEFOVAL=$G(DIEFOVAL)
117 Q:DIEFNVAL=DIEFOVAL
118 D DA(DIEFIEN,.DA)
119 D XRFAUD^DIEF
120 Q
121 ;
122FILENM(F) ;
123 N NM
124 S NM=$P($G(^DIC($$FNO^DILIBF(F),0)),U)
125 ;I NM="" <DO ERROR>
126 Q NM
127 ;
128FLDNM(F,FLD) ;
129 N NM,UP
130 S NM=$P($G(^DD(F,FLD,0)),U,1)
131 F S UP=$G(^DD(F,0,"UP")) Q:'UP D
132 . S NM=NM_" in "_$P($G(^DD(F,0)),U,1)
133 . S F=UP
134 . Q
135 ;I NM="" <DO ERROR>
136 Q NM
Note: See TracBrowser for help on using the repository browser.