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

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

initial load of FOIAVistA 6/30/08 version

File size: 7.5 KB
Line 
1DMSQP3 ;SFISC/EZ-DISPLAY POINTER COUNTS ;10/30/97 17:42
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4EN ; show individual table counts of links
5 S DMQ="" D OK I DMQ K DMQ Q
6 D PREASK I $D(DIRUT)!(DMQ) K DMQ Q
7 D DT^DICRW,HOME^%ZIS
8 D ASK D:'DMQ ASK1 D:'DMQ CLEAR,PAIRS,CNT,BUILD,PRT D EXIT Q
9EN1 ; show summary counts of table links
10 S DMQ="" D OK I DMQ K DMQ Q
11 D PREASK I $D(DIRUT)!(DMQ) K DMQ Q
12 D DT^DICRW,HOME^%ZIS D D EXIT
13 . D ASK2 Q:DMQ D CLEAR,PAIRS,CNT,BUILD,TOTS
14 . S DMDHD=$S(DMYN:"LISTING",1:"COUNTS")
15 . S DMFLDS=$S(DMYN:"!INTERNAL(#6);"""",.01;""""",1:"!(#.01);""""")
16 . S DMANS=""
17 . F D MENU Q:$D(DIRUT) D READ Q:$D(DIRUT)!(DMANS=9) D
18 .. D:DMANS=1 PRT3^DMSQP4
19 .. D:DMANS=2 PRT4^DMSQP4
20 .. D:DMANS=3 PRT5^DMSQP4
21 .. D:DMANS=4 PRT6^DMSQP4
22 .. D:DMANS=5 PRT7^DMSQP4
23 .. ; word-processing tables could be done calling PRT2^DMSQP4,
24 .. ; see commented code in BUILD for some ideas about how.
25 Q
26MENU ; present a choice of reports, now that TMP arrays are built
27 S DIR(0)="E" D ^DIR K DIR Q:$D(DIRUT) W @IOF
28 W !!!!!?9,"(1) SELF Tables with Self-referential Pointers"
29 W !?9,"(2) UP Tables with Upward Links"
30 W !?9,"(3) DOWN Tables Linked from Below"
31 W !?9,"(4) OUT Tables Pointing Outward"
32 W !?9,"(5) IN Tables with Incoming Pointers"
33 W !!?9,"(9) QUIT Exit this Menu"
34 W !! Q
35READ ; reader for the menu
36 S DIR(0)="SMA^1:SELF;2:UP;3:DOWN;4:OUT;5:IN;9:QUIT"
37 S DIR("A")="Select a report: " D ^DIR S DMANS=Y K DIR
38 Q
39EXIT K DOT,DMANS,DMFILE,DMWP,DMFK,DMPFK,DMSR,DME,DMF,DMCOL,DMDM,DMYN
40 K DMX,DMY,DMCT,DMBFK,DMBPFK,DMQ,DMFN,DMFN1,DMTBL,DMCI,DMEI,DMDI
41 K DM1,DM2,DM3,DM4,DM5,DM6,DM7,DMDHD,DMFLDS
42 K DMC1,DMC2,DMC3,DMC4,DMC5,DMC6,DMC7
43 K DMCN2,DMCN3,DMCN4,DMCN5,DMCN6,DMCN7,DMCN8
44CLEAR K ^TMP("DM",$J),^TMP("DMT",$J),^TMP("DMTN",$J)
45 K ^TMP("DMP1",$J),^TMP("DMP2",$J)
46 K ^TMP("DMCT1",$J),^TMP("DMCT2",$J),^TMP("DMFQ2",$J),^TMP("DMFQ3",$J)
47 K ^TMP("DMFQ4",$J),^TMP("DMFQ5",$J),^TMP("DMFQ6",$J),^TMP("DMFQ7",$J)
48 Q
49OK ; check of okay to run
50 I '$O(^DMSQ("S",0)) W !?5,"Sorry, SQLI files are empty.",! S DMQ=1 Q
51 I $$WAIT^DMSQT1 D S DMQ=1 Q
52 . W !?5,"Try later. SQLI is being re-built right now."
53 Q
54PREASK ; confirm that it's okay to wait for interactive processing
55 S DIR(0)="Y",DIR("A")="This can take 1-2 minutes. Continue"
56 S DIR("B")="NO" D ^DIR K DIR S:Y=0 DMQ=1
57 Q
58ASK ; select file numbers
59 S DM1=$O(^DMSQ("T","C",0)),DM2=$O(^DMSQ("T","C",99999999999),-1)
60 S DIR(0)="NO^"_DM1_":"_DM2_":999999999",DIR("A")="Starting File Number"
61 S DIR("?")="Enter the number of the file, e.g. 200 or 1.5215"
62 S DIR("B")=.401 D ^DIR S:$D(DIRUT) DMQ=1 K DIR Q:DMQ S DMFN=Y
63 I '$D(^DMSQ("T","C",DMFN)) W !,"SQLI table not found." G ASK
64 Q
65ASK1 S DIR("B")=DMFN ; default to one file (not a range)
66 S DIR(0)="NO^"_DM1_":"_DM2_":999999999",DIR("A")=" Ending File Number"
67 S DIR("?")="Optionally enter a larger number for a range, e.g. 1.5217"
68 D ^DIR S:$D(DTOUT)!$D(DUOUT) DMQ=1 K DIR Q:DMQ S DMFN1=Y
69 I '$D(^DMSQ("T","C",DMFN1)) D G ASK1
70 . W !!?5,"There isn't a table for the file number you've entered."
71 . W !?5,"(The highest possible number is "_DM2_".)",!
72 I DMFN1'=DMFN,DMFN1'>DMFN D G ASK1
73 . W !!?5,"Enter a LARGER number to get a range."
74 . W !?5,"The highest possible number here is "_DM2_".",!
75 Q
76ASK2 ; prompt for style of listing (summary counts or detail)
77 S DIR("A")="These reports show counts. Or would you prefer details"
78 S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR S DMYN=Y S:$D(DIRUT) DMQ=1
79 Q
80BUILD ;
81 S (DOT,DMFILE)=0
82 F S DMFILE=$O(^DMSQ("T","C",DMFILE)) Q:DMFILE'>0 D
83 . S DOT=DOT+1 W:DOT#20=1 "."
84 . S (DMWP,DMFK,DMPFK,DMSR)=0,DMX=$O(^DMSQ("T","C",DMFILE,0))
85 . I '$D(^DMSQ("E","F",DMX,"F")) D DEFINE Q
86 . ;word-processing domains are character, so DMWP never set
87 . ;perhaps use dbs field retriever to get type (e.g. wp)
88 . ;S DMCI=$O(^DMSQ("C","D",DMFILE,.01,0)) D:DMCI
89 . ;. S DMEI=$P(^DMSQ("C",DMCI,0),U,1)
90 . ;. S DMDI=$P(^DMSQ("E",DMEI,0),U,2)
91 . ;. S:DMDI=$O(^DMSQ("DM","B","WORD_PROCESSING",0)) DMWP=DMWP+1
92 . S DME=0 F S DME=$O(^DMSQ("E","F",DMX,"F",DME)) Q:DME'>0 D
93 .. S DMF=$O(^DMSQ("F","B",DME,0))
94 .. S DMCOL=$P(^DMSQ("F",DMF,0),U,3)
95 .. S:$P(^DMSQ("C",DMCOL,0),U,5) DMFK=DMFK+1
96 .. S:'$P(^DMSQ("C",DMCOL,0),U,5) DMPFK=DMPFK+1
97 .. S DMDM=$P(^DMSQ("E",DME,0),U,2)
98 .. S DMY=$P(^DMSQ("DM",DMDM,0),U,4)
99 .. S:DMX=DMY DMSR=DMSR+1
100 .. D:$O(^DMSQ("E","F",DMX,"F",DME))="" DEFINE
101 Q
102DEFINE ;
103 S DMBFK=0 S:$D(^TMP("DMCT1",$J,DMX))=1 DMBFK=^(DMX)
104 S DMBPFK=0 S:$D(^TMP("DMCT2",$J,DMX))=1 DMBPFK=^(DMX)
105 S ^TMP("DM",$J,DMFILE,DMWP,DMSR,DMPFK,DMBPFK,DMFK,DMBFK,DMX)=""
106 Q
107TOTS ;
108 S (DOT,DM1,DMC1,DMC2,DMC3,DMC4,DMC5,DMC6,DMC7)=0
109 S (DMCN2,DMCN3,DMCN4,DMCN5,DMCN6,DMCN7,DMCN8)=0
110 F S DM1=$O(^TMP("DM",$J,DM1)) Q:DM1="" D
111 . S DOT=DOT+1 W:DOT#20=1 "."
112 . S DMTBL=$O(^DMSQ("T","C",DM1,0)),DMC1=DMC1+1,DM2=""
113 . F S DM2=$O(^TMP("DM",$J,DM1,DM2)) Q:DM2="" D
114 .. S ^TMP("DMFQ2",$J,999-DM2,DM2,DMTBL)=""
115 .. S:DM2 DMCN2=DMCN2+1 S DMC2=DMC2+DM2,DM3=""
116 .. F S DM3=$O(^TMP("DM",$J,DM1,DM2,DM3)) Q:DM3="" D
117 ... S ^TMP("DMFQ3",$J,9999-DM3,DM3,DMTBL)=""
118 ... S:DM3 DMCN3=DMCN3+1 S DMC3=DMC3+DM3,DM4=""
119 ... F S DM4=$O(^TMP("DM",$J,DM1,DM2,DM3,DM4)) Q:DM4="" D
120 .... S ^TMP("DMFQ4",$J,DM2,9999-DM4,DM4,DMTBL)=""
121 .... S:DM4 DMCN4=DMCN4+1 S DMC4=DMC4+DM4,DM5=""
122 .... F S DM5=$O(^TMP("DM",$J,DM1,DM2,DM3,DM4,DM5)) Q:DM5="" D
123 ..... S ^TMP("DMFQ5",$J,9999-DM5,DM5,DMTBL)=""
124 ..... S:DM5 DMCN5=DMCN5+1 S DMC5=DMC5+DM5,DM6=""
125 ..... F S DM6=$O(^TMP("DM",$J,DM1,DM2,DM3,DM4,DM5,DM6)) Q:DM6="" D
126 ...... S ^TMP("DMFQ6",$J,9999-DM6,DM6,DMTBL)=""
127 ...... S:DM6 DMCN6=DMCN6+1 S DMC6=DMC6+DM6,DM7=""
128 ...... F S DM7=$O(^TMP("DM",$J,DM1,DM2,DM3,DM4,DM5,DM6,DM7)) Q:DM7="" D
129 ....... S ^TMP("DMFQ7",$J,9999-DM7,DM7,DMTBL)=""
130 ....... S:DM7 DMCN7=DMCN7+1 S DMC7=DMC7+DM7
131 ....... S:'(DM4+DM5+DM6+DM7) DMCN8=DMCN8+1
132 S ^TMP("DMTN",$J,DMC1,DMCN2,DMCN3,DMCN4,DMCN5,DMCN6,DMCN7,DMCN8)=""
133 S ^TMP("DMT",$J,DMC1,DMC2,DMC3,DMC4,DMC5,DMC6,DMC7)=""
134 Q
135PAIRS ; build array with to-table and from-tables that point
136 S (DOT,DMFILE)=0 W !,"Please wait..."
137 F S DMFILE=$O(^DMSQ("T","C",DMFILE)) Q:DMFILE'>0 D
138 . S DOT=DOT+1 W:DOT#20=1 "."
139 . S DMX=$O(^DMSQ("T","C",DMFILE,0))
140 . S DME=0 F S DME=$O(^DMSQ("E","F",DMX,"F",DME)) Q:DME'>0 D
141 .. S DMDM=$P(^DMSQ("E",DME,0),U,2)
142 .. S DMY=$P(^DMSQ("DM",DMDM,0),U,4)
143 .. S DMF=$O(^DMSQ("F","B",DME,0)) ; get foreign key ien
144 .. S DMCOL=$P(^DMSQ("F",DMF,0),U,3) ; get column pointer
145 .. I $P(^DMSQ("C",DMCOL,0),U,5) S ^TMP("DMP1",$J,DMY,DMX,DMF)=""
146 .. E S ^TMP("DMP2",$J,DMY,DMX)=""
147 Q
148CNT ; get reference counts
149 S DM1=0 W "." F S DM1=$O(^TMP("DMP1",$J,DM1)) Q:DM1'>0 D
150 . S (DM2,DMCT)=0
151 . F S DM2=$O(^TMP("DMP1",$J,DM1,DM2)) Q:DM2'>0 D
152 .. S DM3=0
153 .. F S DM3=$O(^TMP("DMP1",$J,DM1,DM2,DM3)) Q:DM3'>0 S DMCT=DMCT+1
154 .. S ^TMP("DMCT1",$J,DM1)=DMCT
155 S DM1=0 F S DM1=$O(^TMP("DMP2",$J,DM1)) Q:DM1'>0 D
156 . S (DM2,DMCT)=0
157 . F S DM2=$O(^TMP("DMP2",$J,DM1,DM2)) Q:DM2'>0 S DMCT=DMCT+1
158 . S ^TMP("DMCT2",$J,DM1)=DMCT
159 Q
160PRT ;
161 S DIC="1.5215",L=0,DHD="SQLI TABLE POINTER COUNTS"
162 S FLDS="""SQLI TABLE NAME: "";C28;S,.01;X"
163 S BY(0)="^TMP(""DM"",$J,",L(0)=8,FR(0,1)=DMFN,TO(0,1)=DMFN1
164 S DISPAR(0,1)="^;""FILE/SUBFILE: "";C1;S"
165 S DISPAR(0,1,"OUT")="S Y=Y_"" ""_$S($D(^DIC(Y)):$P(^(Y,0),U),1:$O(^DD(Y,0,""NM"",0)))"
166 ;S DISPAR(0,2)="^;""WORD-PROCESSING TABLE? "";C50"
167 ;S DISPAR(0,2,"OUT")="S Y=$S(+Y:""YES"",1:""NO"")"
168 S DISPAR(0,3)="^;""SELF-REFERENTIAL POINTERS: "";C18"
169 S DISPAR(0,4)="^;""POINTERS DOWNWARD TO THIS SUBFILE: "";C10;S"
170 S DISPAR(0,5)="^;""POINTERS UPWARD FROM DEEPER SUBFILES: "";C7"
171 S DISPAR(0,6)="^;""POINTERS OUTWARD TO OTHER FILES: "";C12;S"
172 S DISPAR(0,7)="^;""POINTERS INWARD FROM OTHER FILES: "";C11"
173 D EN1^DIP Q
Note: See TracBrowser for help on using the repository browser.