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

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

initial load of WorldVistAEHR

File size: 5.4 KB
Line 
1DIEV ;SFISC/DPC-DATA VALIDATOR ;2:10 PM 21 Jul 2000
2 ;;22.0;VA FileMan;**55**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4VAL(DIEVF,DIEVIEN,DIEVFLD,DIEVFLG,DIEVAL,DIEVANS,DIEVFAR,DIOUTAR) ;
5VALX ;
6 N DIEV0,DIEVP2,DA,D,I,C K DIEVANS
7 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
8 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
9 S DIEVFLG=$G(DIEVFLG) I '$$VERFLG^DIEFU(DIEVFLG,"HFERYUK") G OUT
10 D FLDVAL G:$G(DIEVAL)=U OUT
11 D DA^DIEFU(DIEVIEN,.DA)
12 S C=$L(DIEVIEN,",")-1 F I=1:1:C S D="D"_(C-I) N @D S @D=$P(DIEVIEN,",",I)
13 D AUXVAL(DIEVF,DIEVIEN,DIEVFLD,DIEVFLG,DIEVAL,.DIEVANS,.DIEV0,.DIEVP2)
14 I $G(DIEVANS)=U!("@"[DIEVAL) G OUT
15MINVAL ;
16 D INT(DIEVF,DIEVFLD,DIEVFLG,DIEVAL,.DIEVANS,$G(DIEV0),$G(DIEVP2))
17 I DIEVANS=U D ERR G OUT
18 I DIEVFLG'["U",$G(DIEVIEN)'?."," D KEY(DIEVF,DIEVIEN,DIEVFLD,DIEVFLG,DIEVANS,.DIEVANS)
19OUT S DIEVANS=$G(DIEVANS,U)
20 I DIEVFLG["F",DIEVANS'=U D FDA
21 I $G(DIOUTAR)]"" D CALLOUT^DIEFU(DIOUTAR)
22 Q
23 ;
24FLDVAL ;
25 N DIEVOUT S DIEVOUT=0
26 I '$$VFILE^DIEFU(DIEVF,"D") S DIEVAL=U Q
27 I '$$VFIELD^DIEFU(DIEVF,DIEVFLD,"D") S DIEVAL=U Q
28 S DIEV0=^DD(DIEVF,DIEVFLD,0),DIEVP2=$P(DIEV0,U,2)
29 D DTYPE
30 I DIEVOUT=1 S DIEVAL=U
31 Q
32 ;
33AUXVAL(DIEVF,DIEVIEN,DIEVFLD,DIEVFLG,DIEVAL,DIEVANS,DIEV0,DIEVP2) ;
34 N DIEVOUT S DIEVOUT=0
35 I '$D(DIOVRD),$P($G(^DD($$FNO^DILIBF(DIEVF),0,"DI")),U,2)="Y",DIEVFLG'["Y" D G AUXERR
36 . N INT,EXT S INT(1)=$$FILENM^DIEFU(DIEVF),EXT("FILE")=DIEVF
37 . D BLD^DIALOG(405,.INT,.EXT)
38 I $P(DIEV0,U,5,99)["DINUM","@"'[DIEVAL D G AUXERR
39 . N EXT,INT S EXT("FILE")=DIEVF,EXT("FIELD")=DIEVFLD,(INT(1),EXT(1))="DINUMed"
40 . D BLD^DIALOG(520,.INT,.EXT)
41 I $E(DIEVAL)="?"!(DIEVP2["V"&(DIEVAL[".?")) N P S P(1)=DIEVF,P(2)=DIEVFLD D BLD^DIALOG(1610,"",.P) G AUXERR
42 I DIEVFLG["R" G:'$$VENTRY^DIEFU(DIEVF,DIEVIEN,"D9") AUXERR
43 I DIEVP2["I",$$DATA(DIEVF,DIEVFLD) N P S P("FIELD")=DIEVFLD,P("FILE")=DIEVF D BLD^DIALOG(710,.P,.P) G AUXERR
44 I "@"[DIEVAL D DELETE G:DIEVOUT AUXERR Q
45 I DIEVFLG["I" D
46 . S DIEVANS=DIEVAL
47 . I DIEVFLG["E" S DIEVANS(0)=$$EXTERNAL^DILFD(DIEVF,DIEVFLD,"",DIEVAL)
48 Q
49AUXERR S DIEVANS=U
50 Q
51 ;
52DTYPE ;
53 I DIEVP2 D S DIEVOUT=1 Q
54 . N T,INT,EXT D DTYP^DIOU(DIEVF,DIEVFLD,.T)
55 . I T=5 S INT(1)="word-processing",EXT("FIELD")=DIEVFLD,EXT("FILE")=DIEVF D BLD^DIALOG(520,.INT,.EXT) Q
56 . S INT(1)="multi-valued",EXT("FIELD")=DIEVFLD,EXT("FILE")=DIEVF D BLD^DIALOG(520,.INT,.EXT)
57 I DIEVP2["C" N INT,EXT S INT(1)="computed",EXT("FIELD")=DIEVFLD,EXT("FILE")=DIEVF D BLD^DIALOG(520,.INT,.EXT) S DIEVOUT=1 Q
58 Q
59 ;
60DELETE ;
61 I $D(^DD(DIEVF,DIEVFLD,"DEL")) D
62 . N DIEVECNT S DIEVECNT=$G(DIERR)
63 . N I S I="" F S I=$O(^DD(DIEVF,DIEVFLD,"DEL",I)) Q:I="" X $G(^(I,0)) I S DIEVOUT=1
64 . I DIEVECNT'=$G(DIERR) S DIEVOUT=1 D HKERR^DILIBF(DIEVF,$G(DIEVIEN),DIEVFLD,"DEL node")
65 I DIEVP2["R" D
66 . I DIEVFLD'=.01 S DIEVOUT=1 Q
67 . I '$D(^DD(DIEVF,0,"UP")) Q
68 . I $P($G(@$$ROOT^DILFD(DIEVF,DIEVIEN,1)@(0)),U,4)=1 S DIEVOUT=1
69 I 'DIEVOUT,DIEVFLG'["U",DIEVFLD'=.01 D Q:DIEVOUT
70 . N DIEVKEY
71 . S DIEVKEY=0
72 . F S DIEVKEY=$O(^DD("KEY","F",DIEVF,DIEVFLD,DIEVKEY)) Q:'DIEVKEY D
73 . . Q:$D(^DD("KEY",DIEVKEY,0))[0
74 . . D ERR742^DIEVK1(DIEVF,DIEVFLD,DIEVKEY,DIEVIEN)
75 . . S DIEVOUT=1
76 I 'DIEVOUT S DIEVANS="" S:DIEVFLG["E" DIEVANS(0)=""
77 E D
78 . N INT,EXT
79 . S INT(1)=$$FLDNM^DIEFU(DIEVF,DIEVFLD),INT(2)=$$FILENM^DIEFU(DIEVF)
80 . S EXT("FILE")=DIEVF,EXT("FIELD")=DIEVFLD
81 . D BLD^DIALOG(712,.INT,.EXT)
82 Q
83 ;
84DATA(DIEVF,DIEVFLD) ;
85 N DIEVNODE,DIEVSPOT,N S DIEVSPOT=" ",N=0
86 D GLRF^DIOU(DIEVF,DIEVFLD,.DIEVNODE,.DIEVSPOT)
87 I +DIEVSPOT D
88 . I $P($G(@DIEVNODE),U,DIEVSPOT)'="" S N=1
89 E I $E(DIEVSPOT)="E" D
90 . N F,T
91 . S F=$P($P(DIEVSPOT,"E",2),",",1),T=$P(DIEVSPOT,",",2)
92 . I $TR($E($G(@DIEVNODE),F,T)," ")'="" S N=1
93 Q N
94 ;
95INT(%B1,%B2,DIEVFLG,X,DIEVANS,%B3,%B) ;
96 N %A,%E,%C,DIR,DIC,Y,DIE,%J,%T,%BA,DP,DIFLD,DDH,%BU,%I,%K,DQ,DIFILE,C,DIEVECNT,DIRDINUM
97 I $G(%B3)="" S %B3=^DD(%B1,%B2,0),%B=$P(%B3,U,2)
98 I %B["V" D VP^DIEV1(%B1,%B2,DIEVFLG,X,%B3,.DIEVANS) Q
99 I %B["N" D Q:$G(DIEVANS)=U
100 . I $L($P(X,"."))>24 S DIEVANS=U Q
101 I %B["S" S X=$$UP^DILIBF(X)
102 S %A=%B1_","_%B2_",V",%E=0,DIR("V")="",%T=$E(%B1)
103 S DIEVECNT=$G(DIERR)
104 S:DIEVFLG["N" DIRDINUM=1 D 1^DIR1
105 I DIEVECNT'=$G(DIERR) S DIEVANS=U D HKERR^DILIBF(%B1,$G(DIEVIEN),%B2,"screen on a pointer or set of codes or in an input transform") K:$G(DIRDINUM) DINUM Q
106 I %E S DIEVANS=U K:$G(DIRDINUM) DINUM Q
107 S DIEVANS=$S(%B'["P":Y,1:$P(Y,U))
108 I DIEVFLG["E" D
109 . I %B["S"!(%B["D") S DIEVANS(0)=$P(Y(0),U)
110 . E I %B["P" S DIEVANS(0)=Y(0,0)
111 . E I %B["O" D
112 . . S DIEVECNT=$G(DIERR)
113 . . X $G(^DD(%B1,%B2,2))
114 . . I DIEVECNT'=$G(DIERR) D HKERR^DILIBF(%B1,$G(DIEVIEN),%B2,"output transform") Q
115 . . S DIEVANS(0)=Y
116 . . Q
117 . E S DIEVANS(0)=Y
118 . Q
119 Q
120 ;
121KEY(DIEVF,DIEVIEN,DIEVFLD,DIEVFLG,DIEVAL,DIEVANS) ;checks Key integrity for a value
122 N DIEVKEY,DIEVFDA S DIEVKEY=""
123 S DIEVFDA(DIEVF,DIEVIEN,DIEVFLD)=DIEVAL
124 I '$$KEYVAL^DIEVK($E("K",DIEVFLG["K"),"DIEVFDA") K DIEVANS S DIEVANS=U
125 Q
126 ;
127FDA ;
128 I $G(DIEVFAR)="" D BLD^DIALOG(202,"FDA") Q
129 D LOAD^DIEF1(DIEVF,DIEVIEN,DIEVFLD,"",DIEVANS,DIEVFAR)
130 Q
131 ;
132ERR ;
133 N INT,EXT
134 S INT(1)=$$FLDNM^DIEFU(DIEVF,DIEVFLD),INT(2)=$$FILENM^DIEFU(DIEVF),(INT(3),EXT(3))=DIEVAL
135 S EXT("FILE")=DIEVF,EXT("FIELD")=DIEVFLD,EXT("IENS")=$G(DIEVIEN)
136 D BLD^DIALOG(701,.INT,.EXT)
137 I DIEVFLG["H" D GET^DIEH(DIEVF,"",DIEVFLD,"?b") ;DA() and D0,D1,etc. passed thru symbol table
138 Q
139 ;
140CHKX ;
141 N DIEV0,DIEVP2 K DIEVANS
142 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
143 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
144 S DIEVFLG=$G(DIEVFLG) I '$$VERFLG^DIEFU(DIEVFLG,"HEN") G OUT
145 D FLDVAL I $G(DIEVAL)=U D OUT Q
146 D MINVAL
147 Q
Note: See TracBrowser for help on using the repository browser.