DMSQP1 ;SFISC/EZ-PRINT SAMPLE SQLI STATS ;10/30/97 17:06
;;22.2;VA FileMan;;Jan 05, 2016;Build 42
;;Per VA Directive 6402, this routine should not be modified.
;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
;;Licensed under the terms of the Apache License, Version 2.0.
;
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
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDMSQP1 3458 printed Dec 13, 2024@02:55:10 Page 2
DMSQP1 ;SFISC/EZ-PRINT SAMPLE SQLI STATS ;10/30/97 17:06
+1 ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
+2 ;;Per VA Directive 6402, this routine should not be modified.
+3 ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
+4 ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
+5 ;;Licensed under the terms of the Apache License, Version 2.0.
+6 ;
+7 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