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

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

initial load of FOIAVistA 6/30/08 version

File size: 8.1 KB
Line 
1DMSQT ;SFISC/EZ-TROUBLE SHOOTING ;11/13/97 12:25
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ; DMQ - status flag for flow of control
6 ; DMTDATE, DMEDATE - dates when Tables and Errors last updates
7 ; DMLTBL - last table
8 ; DMLFILE, DMNFILE - last file being processed, next one to be done
9 ; DMLCOL, DMCNODE - last column processed, that column's node
10 ; DMLCTE, DMLCTBL - last column's table element and table
11 ; DMLCFILE, DMLCFLD - the last column's file and field reference
12 ; DMNCFLD - what would be the next column's field reference
13 ; (using ^DD to see what field is coming up next for processing)
14 ; DMNCFILE - what would be the next column's file reference
15 ; DMPARENT - parent to a subfile, may itself be a subfile
16 ; DMTOPFLD - the top (upper) level field number for a subfile
17 ; DMNXTFLD - the next field in the upper file to be processed
18 ; DMNEXTF - the next file to be processed, coming up a subfile path
19 ; DMNEXTSF - the next subfile to be processed, up from a subfile path
20 ; DMNAME - the name of a file or subfile
21 ; DMLFK, DMLFKTE - last foreign key, and it's last table element
22 ; DMFKTBL - foreign key table, pointer from table element record
23 ; DMPKTE - primary key table element record
24 ; DMKEYS, DMC - keys (primary keys), and a counter
25 ; DMFKFILE - foreign key file, the table element pointer
26 ; DMASTER - the master table for this index table
27 ; DMLO, DMLOF - where SQLI left off when building index tables
28 ; So DMLO would be the last regular table where SQLI left off
29 ; and DMLOF would be that table's file number.
30EN ; main driver logic
31 ; follows flow of ALLF^DMSQF, checking that each step completed
32 I $$WAIT^DMSQT1 D Q
33 . W !?5,"Try again later. An SQLI projection is running right"
34 . W !?5,"now. It might take a few hours to finish, but then you"
35 . W !?5,"can try again and get a final status report."
36 S %ZIS="QM" D ^%ZIS Q:POP
37 I $D(IO("Q")) D Q
38 . S ZTRTN="DQ^DMSQT",ZTDESC="SQLI DIAGNOSTICS REPORT"
39 . D ^%ZTLOAD D HOME^%ZIS K IO("Q")
40DQ U IO D INIT D
41 . D DATE
42 . D SCHEMA D PAGE Q:$D(DIRUT)
43 . D A D PAGE Q:$D(DIRUT)
44 . D B D PAGE Q:$D(DIRUT)
45 . D C D PAGE Q:$D(DIRUT)
46 . D D D PAGE Q:$D(DIRUT)
47 D @$S($D(DIRUT):"EXIT",DMQ=1:"DONE",DMQ=2:"ERROR",1:"EXIT")
48 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
49 Q
50INIT ; initialize variables
51 S DMQ="" D DT^DICRW
52 S DMTDATE=$P($G(^DMSQ("T",1,0)),U,8)
53 S DMEDATE=$O(^DMSQ("EX","D",0))
54 S DMLTBL=$O(^DMSQ("T",999999999999999999999999),-1)
55 S DMLCOL=$O(^DMSQ("C",999999999999999999999999),-1)
56 S DMLFK=$O(^DMSQ("F",999999999999999999999999),-1)
57 Q
58PAGE K DIRUT I $Y+4>IOSL S DIR(0)="E" D:IOST["C-" ^DIR W @IOF
59 Q
60DATE ; check when projection run, compare with today
61 S Y=DT D DD^%DT W !?10," TODAY'S DATE: ",Y,!
62 I 'DMTDATE D
63 . W !?5,"No date associated with first SQLI Table record."
64 I 'DMEDATE D
65 . W !?5,"No dates found in the SQLI Error Log."
66 I DMTDATE'=DMEDATE D
67 . W !?5,"Different dates on Table and Error Log files."
68 S Y=DMTDATE D DD^%DT W !?10,"LAST SQLI TABLE UPDATE: ",Y
69 S Y=DMEDATE D DD^%DT W !?10,"LAST SQLI ERROR UPDATE: ",Y,!
70 ;I DMTDATE,DMEDATE,DT'=DMTDATE,DT'=DMEDATE D
71 I (DMTDATE!DMEDATE)&(DT'=DMTDATE!(DT'=DMEDATE)) D
72 . W !?5,"SQLI was run in the past. DDs may have changed since then.",!
73 Q
74SCHEMA ; check if schema node set
75 I '$O(^DMSQ("S",0)) S DMQ=2 D Q
76 . W !?5,"No SQLI Schema records. Has the SQLI projection been run?"
77 Q
78A ; were all regular tables built?
79 I 'DMLTBL S DMQ=2 D Q
80 . W !!?5,"No records in the SQLI Table file."
81 I $P(^DMSQ("T",DMLTBL,0),U,4) D Q
82 . W !?5,"All regular tables appear to have been built."
83 S DMLFILE=$P(^DMSQ("T",DMLTBL,0),U,7) I 'DMLFILE S DMQ=2 Q
84 ;. W !!?5,"Not all files appear to have been built as tables."
85 W !?5,"The last regular file to be processed was ",DMLFILE,"."
86 S DMNFILE=+$O(^DIC(DMLFILE)) I DMNFILE S DMQ=2 D Q
87 . W !?5,"The next one, file ",DMNFILE," may be the problem."
88 . D BADFILE(DMNFILE)
89 S DMNFILE=+$O(^DD(DMLFILE)) I DMNFILE S DMQ=2 D Q
90 . I $D(^DD(DMNFILE,0,"UP")) D
91 .. W !?5,"The next one, subfile ",DMNFILE," may be the problem."
92 .. D BADFILE(DMNFILE)
93 Q
94B ; were all columns built?
95 I 'DMLCOL S DMQ=2 D Q
96 . W !!?5,"No records in the SQLI Column file."
97 S DMLCTE=$P(^DMSQ("C",DMLCOL,0),U,1)
98 S DMLCTBL=$P($G(^DMSQ("E",DMLCTE,0)),U,3)
99 I DMLCTBL=DMLTBL D Q
100 . W !!?5,"Columns have been built for the last table processed."
101 S DMQ=2 D
102 . W !!?5,"It looks like not all columns were processed."
103 S DMCNODE=^DMSQ("C",DMLCOL,0)
104 S DMLCFILE=$P(DMCNODE,U,5),DMLCFLD=$P(DMCNODE,U,6)
105 I DMLCFILE,DMLCFLD D
106 . W !?5,"The last file processed was ",DMLCFILE,"."
107 . W !?5,"The last field processed was ",DMLCFLD,"."
108 . S DMNCFLD=$O(^DD(DMLCFILE,DMLCFLD)) I +DMNCFLD D Q
109 .. W !!?5,"The next field to be processed looks like ",DMNCFLD,"."
110 .. D BADFILE(DMLCFILE)
111 . I $D(^DIC(DMLCFILE)) S DMNCFILE=$O(^DIC(DMLCFILE)) I +DMNCFILE D Q
112 .. W !?5,"Having finished with all fields of ",DMLCFILE,", SQLI was probably"
113 .. W !?5,"trying to process ",DMNCFILE,", the next file."
114 .. D BADFILE(DMNCFILE)
115 . S DMPARENT=$G(^DD(DMLCFILE,0,"UP")) I DMPARENT D
116 .. W !?5,"The last one (",DMLCFILE,") is a subfile of ",DMPARENT,"."
117 .. S DMTOPFLD=$O(^DD(DMPARENT,"SB",DMLCFILE,0))
118 .. W !?5,"It is field ",DMTOPFLD," of file ",DMPARENT,"."
119 .. S DMNXTFLD=$O(^DD(DMPARENT,DMTOPFLD)) I +DMNXTFLD D
120 ... W !?5,"The next field to be processed looks like ",DMNXTFLD,"."
121 ... D BADFILE(DMPARENT)
122 .. I '+DMNXTFLD D
123 ... W !?5,"That looks like the last field in ",DMPARENT,"."
124 ... I $D(^DIC(DMPARENT)) D Q
125 .... S DMNEXTF=$O(^DIC(DMPARENT)) I +DMNEXTF D
126 ..... W !?5,"The next file to be processed looks like ",DMNEXTF,"."
127 ..... D BADFILE(DMNEXTF)
128 ... S DMNEXTSF=$G(^DD(DMPARENT,0,"UP")) I DMNEXTSF D Q
129 .... W !?5,"The next subfile to be processed looks like ",DMNEXTSF,"."
130 .... D BADFILE(DMNEXTSF)
131 Q
132BADFILE(NUM) ;
133 S DMNAME=$P($G(^DIC(NUM,0)),U,1)
134 I 'DMNAME S DMNAME=$O(^DD(NUM,0,"NM",0))
135 D PAGE Q:$D(DIRUT)
136 W !!?5,"SUGGESTION: Investigate this file/subfile as the potential"
137 W !?5,"source of the problem. That's: ",NUM," ",DMNAME,!
138 Q
139C ; were all foreign keys built?
140 I 'DMLFK S DMQ=2 D Q
141 . W !!?5,"No foreign key records have been built."
142 S DMLFKTE=$O(^DMSQ("E","E","F",999999999999),-1)
143 I 'DMLFKTE S DMQ=2 D Q
144 . W !?5,"No table elements have been built for foreign keys."
145 S DMFKTBL=$P(^DMSQ("E",DMLFKTE,0),U,3)
146 S DMPKTE=$O(^DMSQ("E","F",DMFKTBL,"P",0))
147 S (DMKEYS,DMC)=0
148 F S DMKEYS=$O(^DMSQ("P","B",DMPKTE,DMKEYS)) Q:DMKEYS="" S DMC=DMC+1
149 S DMFKFILE=$P(^DMSQ("T",DMFKTBL,0),U,7)
150 I DMC>1 D Q
151 . W !!?5,"All regular foreign keys have been built (FKs)."
152 . W !?5,"Parent foreign keys (PFKs) have also been built, the"
153 . W !?5,"last one being for file/subfile ",DMFKFILE,"."
154 I DMC'>1 S DMQ=2 D Q
155 . W !!?5,"Only regular foreign keys (FKs) have been processed."
156 . W !?5,"The last was for file/subfile ",DMFKFILE,"."
157 Q
158D ; were all index tables built?
159 I 'DMLTBL S DMQ=2 D Q
160 . W !!?5,"No records for SQLI index tables."
161 S DMASTER=$P(^DMSQ("T",DMLTBL,0),U,4) I 'DMASTER S DMQ=2 D Q
162 . W !!?5,"Index tables don't appear to have been built."
163 S DMLO=$O(^DMSQ("T",DMASTER)) I 'DMLO S DMQ=2 Q
164 S DMLOF=$P(^DMSQ("T",DMLO,0),U,7) I DMLOF D
165 . ; find out if any indexes remain to be processed
166 . S DMLOOP=DMASTER F S DMLOOP=$O(^DMSQ("T",DMLOOP)) Q:DMLOOP'>0 D
167 .. Q:$P(^DMSQ("T",DMLOOP,0),U,4)
168 .. S:$$IDX^DMSQT1(DMLOOP) DMQ=2
169 I DMQ=2 W !!?5,"Index processing stopped at file ",DMLOF,"." Q
170 S DMQ=1
171 W !!?5,"All index tables appear to have been built. The last was for"
172 W !?5,"file/subfile ",$P(^DMSQ("T",DMASTER,0),U,7),"."
173 Q
174DONE ; come here if all checks succeed
175 W !!?5,"No problems detected in SQLI data structures themselves.",!
176 Q
177ERROR ; come here on error
178 W !!?5,"Problems found in SQLI data structures."
179 W !?5,"---------------------------------------"
180 W !?5,"See SQLI Site Manual, trouble-shooting section, for ideas about"
181 W !?5,"how to investigate the problem. For example, RUNONE^DMSQ may be"
182 W !?5,"used to explore a potential problem file."
183 Q
184EXIT K DMQ,DMTDATE,DMEDATE,DMLTBL,DMLFILE,DMNFILE
185 K DMLCOL,DMLCTE,DMLCTBL,DMCNODE,DMLCFILE,DMLCFLD,DMNCFLD
186 K DMNCFILE,DMPARENT
187 K DMTOPFLD,DMNXTFLD,DMNEXTF,DMNEXTSF,DMNAME,DMLFK,DMLFKTE,DMFKTBL
188 K DMPKTE,DMKEYS,DMC,DMFKFILE,DMASTER,DMLO,DMLOF,DMLOOP
189 Q
Note: See TracBrowser for help on using the repository browser.