DMSQP1 ;SFISC/EZ-PRINT SAMPLE SQLI STATS ;10/30/97 17:06
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
Q
OK ; check if okay to run
I '$O(^DMSQ("S",0)) W !?5,"Sorry, SQLI files are empty.",! S DMQ=1 Q
I $$WAIT^DMSQT1 D S DMQ=1 Q
. W !?5,"Try later. SQLI is being re-built right now."
Q
EN1 ; print total regular tables
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI TABLE COUNT (EXCLUDING INDEX-TYPE)"
S DIC="1.5215",L=0,FLDS="!T_NAME;""REGULAR TABLES"""
S BY="3",(FR,TO)="@"
D EN1^DIP K DMQ Q
EN2 ; print total columns
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI COLUMN COUNT FOR ALL TABLES"
S DIC="1.5217",L=0,FLDS="!(#.01);""COLUMNS"""
S BY="NUMBER",(FR,TO)=""
D EN1^DIP K DMQ Q
EN3 ; print totals for indexes
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI INDEX COUNT (INDEX-TYPE TABLES)"
S DIC="1.5215",L=0,FLDS="!T_NAME;""INDEXES"""
S BY(0)="^DMSQ(""T"",""E"",",L(0)=2
D EN1^DIP K DMQ Q
EN4 ; print totals for types of table elements
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI TABLE ELEMENT TYPE TOTALS"
S DIC="1.5216",L=0,FLDS="!E_TYPE"
S BY(0)="^DMSQ(""E"",""E"",",L(0)=2
S DISPAR(0,1)="+^;""TYPE= "";C1;S"
S DISPAR(0,1,"OUT")="S Y=$$EXTERNAL^DILFD(1.5216,3,,Y)"
D EN1^DIP K DMQ Q
EN5 ; print totals for columns in tables
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI COLUMN TOTALS BY TABLE"
S DIC="1.5216",L=0,FLDS="!(#.01);"""""
S BY(0)="^DMSQ(""E"",""F"",",L(0)=3
S DISPAR(0,1)="^;S;C1;""TABLE: """
S DISPAR(0,1,"OUT")="S Y=$P(^DMSQ(""T"",Y,0),U,1)"
S DISPAR(0,2)="+^;",(FR(0,2),TO(0,2))="C"
D EN1^DIP K DMQ Q
EN6 ; show totals of EN5 largest to smallest
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI TABLES SORTED BY TOTAL COLUMNS" K ^TMP("DMSQ",$J)
S DM=0 F S DM=$O(^DMSQ("E","F",DM)) Q:DM'>0 D
. S DM1=0 F S DM1=$O(^DMSQ("E","F",DM,DM1)) Q:DM1="" D
.. Q:DM1'="C" S (DM2,DMC)=0
.. F S DM2=$O(^DMSQ("E","F",DM,DM1,DM2)) Q:DM2'>0 S DMC=DMC+1
.. S:DMC DMC1=9999999-DMC,^TMP("DMSQ",$J,DMC1,DMC,DM)=""
S DIC="1.5215",L=0,FLDS="T_NAME;C20"
S BY(0)="^TMP(""DMSQ"",$J,",L(0)=3
S DISPAR(0,2)="^;C1;S;""COLUMN COUNT: """
D EN1^DIP
K DM,DM1,DM2,DMC,DMC1,^TMP("DMSQ",$J) Q
EN7 ; print total columns just for regular tables
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI COLUMN COUNT FOR REGULAR TABLES (EXCLUDING INDEXES)"
S DIC="1.5217",L=0,FLDS="!(#.01);""COLUMNS"""
S BY="NUMBER",(FR,TO)=""
S DIS(0)="I '$P(^DMSQ(""T"",$P(^DMSQ(""E"",$P(^DMSQ(""C"",D0,0),U,1),0),U,3),0),U,4)"
D EN1^DIP K DMQ Q
EN8 ; print total columns, regular tables, excluding Table_IDs
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI COLUMN COUNT, REGULAR TABLES, EXCLUDING TABLE_IDS"
S DIC="1.5217",L=0,FLDS="!(#.01);""COLUMNS"""
S BY(0)="^DMSQ(""C"",""D"",",L(0)=3
D EN1^DIP K DMQ Q
EN9 ; print subtotals by domain for regular table columns
S DMQ="" D OK I DMQ K DMQ Q
S DHD="SQLI COLUMN COUNT BY DOMAIN (REGULAR TABLES, EXCLUDING TABLE_IDS)"
S DIC="1.5216",L=0,FLDS="!(#.01);""COLUMNS"""
S BY(0)="^DMSQ(""E"",""C"",",L(0)=2
S DISPAR(0,1)="+^;""DOMAIN= "";C1;S"
S DISPAR(0,1,"OUT")="S:Y Y=$P(^DMSQ(""DM"",Y,0),U,1)"
S DIS(0)="I $P(^DMSQ(""E"",D0,0),U,4)'=""P"",$P($G(^DMSQ(""C"",D0,0)),U,5)"
D EN1^DIP K DMQ Q
DMSQP1 ;SFISC/EZ-PRINT SAMPLE SQLI STATS ;10/30/97 17:06
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 QUIT
OK ; check if okay to run
+1 IF '$ORDER(^DMSQ("S",0))
WRITE !?5,"Sorry, SQLI files are empty.",!
SET DMQ=1
QUIT
+2 IF $$WAIT^DMSQT1
Begin DoDot:1
+3 WRITE !?5,"Try later. SQLI is being re-built right now."
End DoDot:1
SET DMQ=1
QUIT
+4 QUIT
EN1 ; print total regular tables
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI TABLE COUNT (EXCLUDING INDEX-TYPE)"
+3 SET DIC="1.5215"
SET L=0
SET FLDS="!T_NAME;""REGULAR TABLES"""
+4 SET BY="3"
SET (FR,TO)="@"
+5 DO EN1^DIP
KILL DMQ
QUIT
EN2 ; print total columns
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI COLUMN COUNT FOR ALL TABLES"
+3 SET DIC="1.5217"
SET L=0
SET FLDS="!(#.01);""COLUMNS"""
+4 SET BY="NUMBER"
SET (FR,TO)=""
+5 DO EN1^DIP
KILL DMQ
QUIT
EN3 ; print totals for indexes
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI INDEX COUNT (INDEX-TYPE TABLES)"
+3 SET DIC="1.5215"
SET L=0
SET FLDS="!T_NAME;""INDEXES"""
+4 SET BY(0)="^DMSQ(""T"",""E"","
SET L(0)=2
+5 DO EN1^DIP
KILL DMQ
QUIT
EN4 ; print totals for types of table elements
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI TABLE ELEMENT TYPE TOTALS"
+3 SET DIC="1.5216"
SET L=0
SET FLDS="!E_TYPE"
+4 SET BY(0)="^DMSQ(""E"",""E"","
SET L(0)=2
+5 SET DISPAR(0,1)="+^;""TYPE= "";C1;S"
+6 SET DISPAR(0,1,"OUT")="S Y=$$EXTERNAL^DILFD(1.5216,3,,Y)"
+7 DO EN1^DIP
KILL DMQ
QUIT
EN5 ; print totals for columns in tables
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI COLUMN TOTALS BY TABLE"
+3 SET DIC="1.5216"
SET L=0
SET FLDS="!(#.01);"""""
+4 SET BY(0)="^DMSQ(""E"",""F"","
SET L(0)=3
+5 SET DISPAR(0,1)="^;S;C1;""TABLE: """
+6 SET DISPAR(0,1,"OUT")="S Y=$P(^DMSQ(""T"",Y,0),U,1)"
+7 SET DISPAR(0,2)="+^;"
SET (FR(0,2),TO(0,2))="C"
+8 DO EN1^DIP
KILL DMQ
QUIT
EN6 ; show totals of EN5 largest to smallest
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI TABLES SORTED BY TOTAL COLUMNS"
KILL ^TMP("DMSQ",$JOB)
+3 SET DM=0
FOR
SET DM=$ORDER(^DMSQ("E","F",DM))
IF DM'>0
QUIT
Begin DoDot:1
+4 SET DM1=0
FOR
SET DM1=$ORDER(^DMSQ("E","F",DM,DM1))
IF DM1=""
QUIT
Begin DoDot:2
+5 IF DM1'="C"
QUIT
SET (DM2,DMC)=0
+6 FOR
SET DM2=$ORDER(^DMSQ("E","F",DM,DM1,DM2))
IF DM2'>0
QUIT
SET DMC=DMC+1
+7 IF DMC
SET DMC1=9999999-DMC
SET ^TMP("DMSQ",$JOB,DMC1,DMC,DM)=""
End DoDot:2
End DoDot:1
+8 SET DIC="1.5215"
SET L=0
SET FLDS="T_NAME;C20"
+9 SET BY(0)="^TMP(""DMSQ"",$J,"
SET L(0)=3
+10 SET DISPAR(0,2)="^;C1;S;""COLUMN COUNT: """
+11 DO EN1^DIP
+12 KILL DM,DM1,DM2,DMC,DMC1,^TMP("DMSQ",$JOB)
QUIT
EN7 ; print total columns just for regular tables
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI COLUMN COUNT FOR REGULAR TABLES (EXCLUDING INDEXES)"
+3 SET DIC="1.5217"
SET L=0
SET FLDS="!(#.01);""COLUMNS"""
+4 SET BY="NUMBER"
SET (FR,TO)=""
+5 SET DIS(0)="I '$P(^DMSQ(""T"",$P(^DMSQ(""E"",$P(^DMSQ(""C"",D0,0),U,1),0),U,3),0),U,4)"
+6 DO EN1^DIP
KILL DMQ
QUIT
EN8 ; print total columns, regular tables, excluding Table_IDs
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI COLUMN COUNT, REGULAR TABLES, EXCLUDING TABLE_IDS"
+3 SET DIC="1.5217"
SET L=0
SET FLDS="!(#.01);""COLUMNS"""
+4 SET BY(0)="^DMSQ(""C"",""D"","
SET L(0)=3
+5 DO EN1^DIP
KILL DMQ
QUIT
EN9 ; print subtotals by domain for regular table columns
+1 SET DMQ=""
DO OK
IF DMQ
KILL DMQ
QUIT
+2 SET DHD="SQLI COLUMN COUNT BY DOMAIN (REGULAR TABLES, EXCLUDING TABLE_IDS)"
+3 SET DIC="1.5216"
SET L=0
SET FLDS="!(#.01);""COLUMNS"""
+4 SET BY(0)="^DMSQ(""E"",""C"","
SET L(0)=2
+5 SET DISPAR(0,1)="+^;""DOMAIN= "";C1;S"
+6 SET DISPAR(0,1,"OUT")="S:Y Y=$P(^DMSQ(""DM"",Y,0),U,1)"
+7 SET DIS(0)="I $P(^DMSQ(""E"",D0,0),U,4)'=""P"",$P($G(^DMSQ(""C"",D0,0)),U,5)"
+8 DO EN1^DIP
KILL DMQ
QUIT