1 | DMSQP1 ;SFISC/EZ-PRINT SAMPLE SQLI STATS ;10/30/97 17:06
|
---|
2 | ;;22.0;VA FileMan;;Mar 30, 1999
|
---|
3 | ;Per VHA Directive 10-93-142, this routine should not be modified.
|
---|
4 | Q
|
---|
5 | OK ; check if okay to run
|
---|
6 | I '$O(^DMSQ("S",0)) W !?5,"Sorry, SQLI files are empty.",! S DMQ=1 Q
|
---|
7 | I $$WAIT^DMSQT1 D S DMQ=1 Q
|
---|
8 | . W !?5,"Try later. SQLI is being re-built right now."
|
---|
9 | Q
|
---|
10 | EN1 ; print total regular tables
|
---|
11 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
12 | S DHD="SQLI TABLE COUNT (EXCLUDING INDEX-TYPE)"
|
---|
13 | S DIC="1.5215",L=0,FLDS="!T_NAME;""REGULAR TABLES"""
|
---|
14 | S BY="3",(FR,TO)="@"
|
---|
15 | D EN1^DIP K DMQ Q
|
---|
16 | EN2 ; print total columns
|
---|
17 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
18 | S DHD="SQLI COLUMN COUNT FOR ALL TABLES"
|
---|
19 | S DIC="1.5217",L=0,FLDS="!(#.01);""COLUMNS"""
|
---|
20 | S BY="NUMBER",(FR,TO)=""
|
---|
21 | D EN1^DIP K DMQ Q
|
---|
22 | EN3 ; print totals for indexes
|
---|
23 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
24 | S DHD="SQLI INDEX COUNT (INDEX-TYPE TABLES)"
|
---|
25 | S DIC="1.5215",L=0,FLDS="!T_NAME;""INDEXES"""
|
---|
26 | S BY(0)="^DMSQ(""T"",""E"",",L(0)=2
|
---|
27 | D EN1^DIP K DMQ Q
|
---|
28 | EN4 ; print totals for types of table elements
|
---|
29 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
30 | S DHD="SQLI TABLE ELEMENT TYPE TOTALS"
|
---|
31 | S DIC="1.5216",L=0,FLDS="!E_TYPE"
|
---|
32 | S BY(0)="^DMSQ(""E"",""E"",",L(0)=2
|
---|
33 | S DISPAR(0,1)="+^;""TYPE= "";C1;S"
|
---|
34 | S DISPAR(0,1,"OUT")="S Y=$$EXTERNAL^DILFD(1.5216,3,,Y)"
|
---|
35 | D EN1^DIP K DMQ Q
|
---|
36 | EN5 ; print totals for columns in tables
|
---|
37 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
38 | S DHD="SQLI COLUMN TOTALS BY TABLE"
|
---|
39 | S DIC="1.5216",L=0,FLDS="!(#.01);"""""
|
---|
40 | S BY(0)="^DMSQ(""E"",""F"",",L(0)=3
|
---|
41 | S DISPAR(0,1)="^;S;C1;""TABLE: """
|
---|
42 | S DISPAR(0,1,"OUT")="S Y=$P(^DMSQ(""T"",Y,0),U,1)"
|
---|
43 | S DISPAR(0,2)="+^;",(FR(0,2),TO(0,2))="C"
|
---|
44 | D EN1^DIP K DMQ Q
|
---|
45 | EN6 ; show totals of EN5 largest to smallest
|
---|
46 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
47 | S DHD="SQLI TABLES SORTED BY TOTAL COLUMNS" K ^TMP("DMSQ",$J)
|
---|
48 | S DM=0 F S DM=$O(^DMSQ("E","F",DM)) Q:DM'>0 D
|
---|
49 | . S DM1=0 F S DM1=$O(^DMSQ("E","F",DM,DM1)) Q:DM1="" D
|
---|
50 | .. Q:DM1'="C" S (DM2,DMC)=0
|
---|
51 | .. F S DM2=$O(^DMSQ("E","F",DM,DM1,DM2)) Q:DM2'>0 S DMC=DMC+1
|
---|
52 | .. S:DMC DMC1=9999999-DMC,^TMP("DMSQ",$J,DMC1,DMC,DM)=""
|
---|
53 | S DIC="1.5215",L=0,FLDS="T_NAME;C20"
|
---|
54 | S BY(0)="^TMP(""DMSQ"",$J,",L(0)=3
|
---|
55 | S DISPAR(0,2)="^;C1;S;""COLUMN COUNT: """
|
---|
56 | D EN1^DIP
|
---|
57 | K DM,DM1,DM2,DMC,DMC1,^TMP("DMSQ",$J) Q
|
---|
58 | EN7 ; print total columns just for regular tables
|
---|
59 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
60 | S DHD="SQLI COLUMN COUNT FOR REGULAR TABLES (EXCLUDING INDEXES)"
|
---|
61 | S DIC="1.5217",L=0,FLDS="!(#.01);""COLUMNS"""
|
---|
62 | S BY="NUMBER",(FR,TO)=""
|
---|
63 | S DIS(0)="I '$P(^DMSQ(""T"",$P(^DMSQ(""E"",$P(^DMSQ(""C"",D0,0),U,1),0),U,3),0),U,4)"
|
---|
64 | D EN1^DIP K DMQ Q
|
---|
65 | EN8 ; print total columns, regular tables, excluding Table_IDs
|
---|
66 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
67 | S DHD="SQLI COLUMN COUNT, REGULAR TABLES, EXCLUDING TABLE_IDS"
|
---|
68 | S DIC="1.5217",L=0,FLDS="!(#.01);""COLUMNS"""
|
---|
69 | S BY(0)="^DMSQ(""C"",""D"",",L(0)=3
|
---|
70 | D EN1^DIP K DMQ Q
|
---|
71 | EN9 ; print subtotals by domain for regular table columns
|
---|
72 | S DMQ="" D OK I DMQ K DMQ Q
|
---|
73 | S DHD="SQLI COLUMN COUNT BY DOMAIN (REGULAR TABLES, EXCLUDING TABLE_IDS)"
|
---|
74 | S DIC="1.5216",L=0,FLDS="!(#.01);""COLUMNS"""
|
---|
75 | S BY(0)="^DMSQ(""E"",""C"",",L(0)=2
|
---|
76 | S DISPAR(0,1)="+^;""DOMAIN= "";C1;S"
|
---|
77 | S DISPAR(0,1,"OUT")="S:Y Y=$P(^DMSQ(""DM"",Y,0),U,1)"
|
---|
78 | S DIS(0)="I $P(^DMSQ(""E"",D0,0),U,4)'=""P"",$P($G(^DMSQ(""C"",D0,0)),U,5)"
|
---|
79 | D EN1^DIP K DMQ Q
|
---|