DMSQP ;SFISC/EZ-PRINT SQLI TABLE POINTERS ;10/30/97 16:49
;;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
EN1 ; in pointers (to this table from others)
D DT^DICRW S DMQ="" D D EXIT
. D OK,ASK:'DMQ,CHK:'DMQ,PR1:'DMQ
Q
EN2 ; out pointers (from this table out)
D DT^DICRW S DMQ="" D D EXIT
. D OK,ASK:'DMQ,CHK:'DMQ,CHK1:'DMQ,PR2:'DMQ
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
ASK S DIC="1.5215",DIC(0)="QEAM" ; select starting-point table
D ^DIC K DIC S DMY=+Y S:$D(DTOUT)!$D(DUOUT)!(Y=-1) DMQ=1
Q
CHK I '$D(^DMSQ("E","F",DMY,"F")) S DMQ=1 W !,?5,"NO POINTERS",!
Q
CHK1 ; check file access needed for navigation in PR2 report
I DUZ(0)'="@" F DIFILE=1.5212 D K DIAC
. S DIAC="RD" D EN^DIAC S:'% DMQ=1
D:DMQ
. W !!?5,"You need 'Read' access to one SQLI file to run this report."
. W !?5,"It is file 1.5212."
. W !!?5,"Contact your system manager to be granted single file access.",!
Q
PR1 S DIC="1.5216",L=0 ; only foreign keys (screen-out primary)
S DIS(0)="I '$D(^DMSQ(""E"",""E"",""P"",D0))"
S DHD="TABLES POINTING TO "_$P(^DMSQ("T",DMY,0),U,1)
S FLDS="""FROM TABLE: "";S;C5,!E_TABLE;X"
S FLDS(1)="""VIA FOREIGN KEY: "";C5,E_NAME;X"
S DMY1=$O(^DMSQ("DM","C",DMY,0))
S BY(0)="^DMSQ(""E"",""C"",DMY1,",L(0)=1 D EN1^DIP
Q
PR2 S DIC="1.5216",L=0
S DHD="TABLES POINTED-TO BY "_$P(^DMSQ("T",DMY,0),U,1)
S FLDS="""TO TABLE: "";S;C5,E_DOMAIN:,!DM_TABLE;X"
S FLDS(1)="""VA FOREIGN KEY: "";C5,E_NAME;X"
S BY(0)="DMSQ(""E"",""F"",DMY,""F"",",L(0)=1 D EN1^DIP
Q
EXIT K DMY,DMY1,DMQ Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDMSQP 1958 printed Dec 13, 2024@02:55:09 Page 2
DMSQP ;SFISC/EZ-PRINT SQLI TABLE POINTERS ;10/30/97 16:49
+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
EN1 ; in pointers (to this table from others)
+1 DO DT^DICRW
SET DMQ=""
Begin DoDot:1
+2 DO OK
if 'DMQ
DO ASK
if 'DMQ
DO CHK
if 'DMQ
DO PR1
End DoDot:1
DO EXIT
+3 QUIT
EN2 ; out pointers (from this table out)
+1 DO DT^DICRW
SET DMQ=""
Begin DoDot:1
+2 DO OK
if 'DMQ
DO ASK
if 'DMQ
DO CHK
if 'DMQ
DO CHK1
if 'DMQ
DO PR2
End DoDot:1
DO EXIT
+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
ASK ; select starting-point table
SET DIC="1.5215"
SET DIC(0)="QEAM"
+1 DO ^DIC
KILL DIC
SET DMY=+Y
if $DATA(DTOUT)!$DATA(DUOUT)!(Y=-1)
SET DMQ=1
+2 QUIT
CHK IF '$DATA(^DMSQ("E","F",DMY,"F"))
SET DMQ=1
WRITE !,?5,"NO POINTERS",!
+1 QUIT
CHK1 ; check file access needed for navigation in PR2 report
+1 IF DUZ(0)'="@"
FOR DIFILE=1.5212
Begin DoDot:1
+2 SET DIAC="RD"
DO EN^DIAC
if '%
SET DMQ=1
End DoDot:1
KILL DIAC
+3 if DMQ
Begin DoDot:1
+4 WRITE !!?5,"You need 'Read' access to one SQLI file to run this report."
+5 WRITE !?5,"It is file 1.5212."
+6 WRITE !!?5,"Contact your system manager to be granted single file access.",!
End DoDot:1
+7 QUIT
PR1 ; only foreign keys (screen-out primary)
SET DIC="1.5216"
SET L=0
+1 SET DIS(0)="I '$D(^DMSQ(""E"",""E"",""P"",D0))"
+2 SET DHD="TABLES POINTING TO "_$PIECE(^DMSQ("T",DMY,0),U,1)
+3 SET FLDS="""FROM TABLE: "";S;C5,!E_TABLE;X"
+4 SET FLDS(1)="""VIA FOREIGN KEY: "";C5,E_NAME;X"
+5 SET DMY1=$ORDER(^DMSQ("DM","C",DMY,0))
+6 SET BY(0)="^DMSQ(""E"",""C"",DMY1,"
SET L(0)=1
DO EN1^DIP
+7 QUIT
PR2 SET DIC="1.5216"
SET L=0
+1 SET DHD="TABLES POINTED-TO BY "_$PIECE(^DMSQ("T",DMY,0),U,1)
+2 SET FLDS="""TO TABLE: "";S;C5,E_DOMAIN:,!DM_TABLE;X"
+3 SET FLDS(1)="""VA FOREIGN KEY: "";C5,E_NAME;X"
+4 SET BY(0)="DMSQ(""E"",""F"",DMY,""F"","
SET L(0)=1
DO EN1^DIP
+5 QUIT
EXIT KILL DMY,DMY1,DMQ
QUIT