source: FOIAVistA/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIVR.m@ 1540

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

initial load of FOIAVistA 6/30/08 version

File size: 6.3 KB
Line 
1DIVR ;SFISC/GFT-VERIFY FLDS ;8:43 AM 1 Jul 1999
2 ;;22.0;VA FileMan;**7**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 I $D(DIVFIL)[0 N DIVDAT,DIVFIL,DIVMODE,DIVPG,POP D G:$G(POP) Q^DIV
5 . S DIVMODE="C"
6 . D DEVSEL^DIV Q:$G(POP)
7 . D INIT^DIV
8 S W="W !,""ENTRY#"_$S(V:"'S",1:"")_""",?10,"""_$P(^DD(A,.01,0),U)_""",?40,""ERROR"""
9 D LF Q:$D(DIRUT) S T=$E(T) S:"PS"[T&($D(DIVZ)[0) DIVZ=Z
10 K DIVREQK,DIVTYPE,DIVTMP
11 S DIVREQK=$D(^DD("KEY","F",A,DA))>9
12 I $D(^DD("IX","F",A,DA)) D
13 . S DIVTYPE=T,T="INDEX",DIVROOT=$$FROOTDA^DIKCU(A)
14 . D LOADVER^DIVC(A,DA,"DIVTMP")
15 K DG
16 F %=0:0 S %=$O(^DD(A,DA,1,%)) Q:%'>0 I $D(^(%,1)),$P(^(0),U,2,9)?1.A,^(2)?1"K ^".E1")",^(1)?1"S ^".E S DG(%)="I $D("_$E(^(2),3,99)_"),"_$E(^(1),3,99)
17 I T'="INDEX",'$D(^(+$O(^DD(A,DA,1,0)),1)) G E
18 I T'="INDEX",'$D(DG) W $C(7)_"(CANNOT CHECK"
19 E W "(CHECKING"
20 W " CROSS-REFERENCE)" D LF I $D(DIRUT) Q:$D(DQI) G Q
21 I $D(DG) D
22 . I T="INDEX" S E=DIVTYPE,DIVTYPE="IX"
23 . E S E=T,T="IX"
24E S Y=$F(DDC,"%DT=""E") S:Y DDC=$E(DDC,1,Y-2)_$E(DDC,Y,999)
25 I DR["*" S DDC="Q" I $D(^DD(A,DA,12.1)) X ^(12.1) I $D(DIC("S")) S DDC(1)=DIC("S"),DDC="X DDC(1) E K X"
26 D 0 S X=$P(Y(0),U,4),Y=$P(X,S,2),X=$P(X,S)
27 I +X'=X S X=Q_X_Q I Y="" S DE=DE_"S X=DA D R" G XEC
28 S M="S X=$S($D(^(DA,"_X_")):$"_$S(Y:"P(^("_X_"),U,"_Y,1:"E(^("_X_"),"_$E(Y,2,9))_"),1:"""") D R"
29 I $L(M)+$L(DE)>250 S DE=DE_"X DE(1)",DE(1)=M
30 E S DE=DE_M
31XEC K DIC,M,Y X DE Q:$D(DQI)
32 W:'$D(M) $C(7),!,"NO PROBLEMS"
33Q S M=$O(^UTILITY("DIVR",$J,0)),E=$O(^(M)),DK=J(0)
34 I $D(ZTQUEUED) S ZTREQ="@"
35 E I $T(+0^%ZISC)]"" D
36 . D ^%ZISC
37 E X $G(^%ZIS("C"))
38 G:'E!$D(DIRUT)!$D(ZTQUEUED) QX K DIBT,DISV D
39 . N C,D,I,J,L,O,Q,S,D0,DDA,DICL,DIFLD,DIU0
40 . D S2^DIBT1 Q
41 S DDC=0 I '$D(DIRUT) G Q:Y<0 F E=0:0 S E=$O(^UTILITY("DIVR",$J,E)) Q:E="" S DDC=DDC+1,^DIBT(+Y,1,E)=""
42 S:DDC>0 ^DIBT(+Y,"QR")=DT_U_DDC
43QX K DIVINDEX,DIVKEY,DIVREQK,DIVROOT,DIVTMP,DIVTYPE
44 K ^UTILITY("DIVR",$J),DIRUT,DIROUT,DTOUT,DUOUT,DQI,DK,DA,DG,DQ,DE,T,P,E,M,DR,W,DDC,DIVZ Q
45 ;
46R Q:$D(DIRUT)
47 I X?." " Q:DR'["R"&'DIVREQK D G X
48 . I X="" S M="Missing"_$S(DIVREQK:" key value",1:"")
49 . E S M="Equals only 1 or more spaces"
50 G @T
51 ;
52P I @("$D(^"_DIVZ_"X,0))") S Y=X G F
53 S M="No '"_X_"' in pointed-to File" G X
54 ;
55S S Y=X X DDC I '$D(X) S M=Q_Y_Q_" fails screen" G X
56 Q:S_DIVZ[(S_X_":") S M=Q_X_Q_" not in Set" G X
57 ;
58D S Y=X,X=$E(Y,1,3)+1700,%=$E(Y,6,7) S:% X=%_"-"_X S:$E(Y,4,5) X=+$E(Y,4,5)_"-"_X
59 S:Y["." X=X_"@"_$E(Y_"00",9,10)_":"_$E(Y_"0000",11,12)_$S($E(Y,13,14):":"_$E(Y_"0",13,14),1:"")
60N ;
61K ;
62F S DQ=X I X'?.ANP S M="Non-printing character" G X
63 X DDC Q:$D(X) S M=Q_DQ_Q_" fails Input Transform"
64X I $O(^UTILITY("DIVR",$J,0))="" X W
65 S X=$S(V:DA(V),1:DA),^UTILITY("DIVR",$J,X)=""
66 S X=V I @(I(0)_"0)")
67DA I 'X D Q
68 . D LF Q:$D(DIRUT)
69 . W DA,?10,$S($D(^(DA,0)):$P(^(0),U),1:DA),?40,$E(M,1,40)
70 . D:V LF
71 D LF Q:$D(DIRUT) W DA(X),?10,$P(^(DA(X),0),U) S X=X-1,@("Y=$D(^("_I(V-X)_",0))") G DA
72 ;
730 ;
74 S Y=I(0),DE="",X=V
75L S DA="DA" S:X DA=DA_"("_X_")" S Y=Y_DA,DE=DE_"F "_DA_"=0:0 ",%="S "_DA_"=$O("_Y_"))" I V>2 S DE(X+X)=%,DE=DE_"X DE("_(X+X)_")"
76 E S DE=DE_%
77 S DE=DE_" Q:"_DA_"'>0 S D"_(V-X)_"="_DA_" "
78 ;I X=1,DIFLD=.01 S DE=DE_"X P:$D(^(DA(1),"_I(V)_",0)) ",P="S $P(^(0),U,2)="""_$P(^DD(J(V-1),P,0),U,2)_Q
79 S X=X-1 Q:X<0 S Y=Y_","_I(V-X)_"," G L
80 ;
81IX F %=0:0 S %=$O(DG(%)) Q:+%'>0 X DG(%) I '$T S M=Q_X_Q_" not properly Cross-referenced" G X
82 G @E
83 ;
84V I $P(X,S,2)'?1A.AN1"(".ANP,$P(X,S,2)'?1"%".AN1"(".ANP S M=Q_X_Q_" has the wrong format" G X
85 S M=$S($D(@(U_$P(X,S,2)_"0)")):^(0),1:"")
86 I '$D(^DD(A,DIFLD,"V","B",+$P(M,U,2))) S M=$P(M,U)_" FILE not in the DD" G X
87 I '$D(@(U_$P(X,S,2)_+X_",0)")) S M=U_$P(X,S,2)_+X_",0) does not exist" G X
88 G F
89 ;
90INDEX ;Check new indexes
91 ;
92 ;Set DIVINDEX(indexName,index#) = "" for indexes aren't set
93 ;Set DIVKEY(file#,keyName,uiNumber) = "null" : if key field is null
94 ; "uniq" : if key is not unique
95 K DIVKEY,DIINDEX
96 D VER^DIVC(A,DIVROOT,.DA,"DIVTMP",.DIVINDEX,.DIVKEY)
97 ;
98 ;If some indexes aren't set properly, print index info
99 I $D(DIVINDEX) D K DIVINDEX Q:$D(DIRUT)
100 . N DIVNAME,DIVNUM
101 . S DIVNAME="" F S DIVNAME=$O(DIVINDEX(DIVNAME)) Q:DIVNAME="" D Q:$D(DIRUT)
102 .. S DIVNUM=0 F S DIVNUM=$O(DIVINDEX(DIVNAME,DIVNUM)) Q:'DIVNUM D Q:$D(DIRUT)
103 ... S M=Q_X_Q_": "_DIVNAME_" index (#"_DIVNUM_") not properly set"
104 ... D IER
105 ;
106 ;If keys integrity is violated, print key info
107 I $D(DIVKEY) D K DIVKEY Q:$D(DIRUT)
108 . N DIVFILE,DIVKNM,DIVPROB,DIVXRNM
109 . S DIVFILE="" F S DIVFILE=$O(DIVKEY(DIVFILE)) Q:DIVFILE="" D Q:$D(DIRUT)
110 .. S DIVKNM="" F S DIVKNM=$O(DIVKEY(DIVFILE,DIVKNM)) Q:DIVKNM="" D Q:$D(DIRUT)
111 ... S DIVXRNM="" F S DIVXRNM=$O(DIVKEY(DIVFILE,DIVKNM,DIVXRNM)) Q:DIVXRNM="" D Q:$D(DIRUT)
112 .... S DIVPROB=DIVKEY(DIVFILE,DIVKNM,DIVXRNM)
113 .... S M=Q_X_Q_": "_$S(DIVPROB="null":"Key values are missing.",1:"Key is not unique.")
114 .... S M=M_" (File #"_DIVFILE_", Key "_DIVKNM_", Index "_DIVXRNM_")"
115 .... D IER
116 ;
117 ;Continue with checking traditional xrefs (if any) and data type
118 G @DIVTYPE
119 ;
120IER ;Print info about invalid indexes. (Modeled after DA subroutine above)
121 N DIVTXT,DIVI,X
122 ;
123 ;Wrap message M to within 40 columns
124 S DIVTXT(0)=M D WRAP^DIKCU2(.DIVTXT,40)
125 ;
126 ;If nothing was written yet, write column headers
127 I $O(^UTILITY("DIVR",$J,0))="" X W
128 ;
129 ;Set ^UTILITY("DIVR",$J,topIen)="", X = level#, naked = top level root
130 S X=$S(V:DA(V),1:DA),^UTILITY("DIVR",$J,X)=""
131 S X=V I @(I(0)_"0)")
132 ;
133IER1 ;If top level, write record info and message
134 I 'X D Q
135 . D LF Q:$D(DIRUT) W DA,?10,$S($D(^(DA,0)):$P(^(0),U),1:DA)
136 . F DIVI=0:1 Q:$D(DIVTXT(DIVI))[0 D Q:$D(DIRUT)
137 .. I DIVI D LF Q:$D(DIRUT)
138 .. W ?40,DIVTXT(DIVI)
139 . D:V LF
140 ;
141 ;Else write subrecord info, decrement level, set naked = ^naked(node,0)
142 D LF Q:$D(DIRUT)
143 W DA(X),?10,$P(^(DA(X),0),U) S X=X-1,@("Y=$D(^("_I(V-X)_",0))")
144 G IER1
145 ;
146LF ;Issue a line feed or EOP read
147 I $Y+3<IOSL W ! Q
148 ;
149 N DINAKED S DINAKED=$$LGR^%ZOSV
150 I IOST?1"C-".E D
151 . N DIR,X,Y
152 . S DIR(0)="E" W ! D ^DIR
153 ;
154 I '$D(DIRUT) D
155 . I $D(ZTQUEUED),$$S^%ZTLOAD S (ZTSTOP,DIRUT)=1
156 . E W @IOF D HDR
157 S:DINAKED]"" DINAKED=$S(DINAKED["""""":$O(@DINAKED),1:$D(@DINAKED))
158 Q
159 ;
160HDR ;Print header
161 N DIVTAB
162 S DIVPG=$G(DIVPG)+1
163 W "VERIFY FIELDS REPORT"
164 ;
165 S DIVTAB=IOM-1-$L(DIVFIL)-$L(DIVDAT)-$L(DIVPG)
166 I DIVTAB>1 W !,DIVFIL_$J("",DIVTAB)_DIVDAT_DIVPG
167 E W !,DIVFIL,!,$J("",IOM-1-$L(DIVDAT)-$L(DIVPG))_DIVDAT_DIVPG
168 W !,$TR($J("",IOM-1)," ","-"),!
169 Q
Note: See TracBrowser for help on using the repository browser.