DMSQ ;SFISC/EZ-CALLS INTO SQLI CODE ;10/30/97 16:25
;;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
SETUP ;entry point to begin SQLI projection process
;gives interactive user a chance to cancel out before continuing
;requires programmer mode (DUZ(0)="@")
I $D(ZTQUEUED) D RUN Q
I $$WAIT^DMSQT1 D Q
. W !?5,"Another SQLI projection is already running right now."
. W !?5,"Try later if you want to re-run the SQLI projection."
S DIR(0)="Y",DIR("B")="NO"
S DIR("A")="This process takes several hours. Want to Continue"
S DIR("?",1)="This will project FileMan data dictionary information into SQLI files."
S DIR("?",2)="It may consume up to 30Mb of space in a full hospital account."
S DIR("?",3)=" "
S DIR("?",4)="It is safe to run on all systems, even if you don't have SQLI-to-SQL mapping."
S DIR("?",5)="(Note: SQLI print options won't report anything if SQLI files are empty.)"
S DIR("?",6)=" "
S DIR("?",7)="To experiment, you can run this and then use the purge option afterwards."
S DIR("?",8)="(It isn't necessary to run the purge option beforehand, by the way.)"
S DIR("?",9)=" "
S DIR("?",10)="If you do have SQLI-to-SQL mapping, be aware that this is step 2 of 3:"
S DIR("?",11)=" "
S DIR("?",12)=" (1) Populate the SQLI Key Word file - KW^DMSQD(SCR,ERR)"
S DIR("?",13)=" (2) Run this utility - SETUP^DMSQ"
S DIR("?",14)=" (3) Run your SQLI-to-SQL mapper (vendor product)"
S DIR("?",15)=" "
S DIR("?")="These 3 steps should be done in sequence, one right after the other."
D ^DIR K DIR Q:'Y
I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
W !!?5,"Running this job on your terminal (HOME device) will tie up"
W !?5,"your terminal for the several hours it takes to run, but you"
W !?5,"will see the job's status as it's running."
W !!?5,"Queuing will send it to the background for processing. The"
W !?5,"status will be apparent from the printed output (if there's an"
W !?5,"error, it's text will be printed). TaskMan/Kernel tools can also"
W !?5,"be used to determine whether the job ran to completion or not."
W !!?5,"Don't send this directly to a printer (without queuing) unless"
W !?5,"you are prepared to tie up your terminal AND the printer for"
W !?5,"the duration of the process.",!
S %ZIS="QM" D ^%ZIS Q:POP
I $D(IO("Q")) D Q
. S ZTRTN="RUN^DMSQ",ZTDESC="SQLI PROJECTION"
. D ^%ZTLOAD D HOME^%ZIS K IO("Q")
S:IO'=IO(0) DMDOT="" D RUN
EXIT K DMDOT
Q
RUN ;runs the projection of all files (called from SETUP)
U IO
I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
I $$WAIT^DMSQT1 D Q
. W !?5,"Another SQLI projection is being run right now. So"
. W !?5,"this attempt to re-run the projection is aborted."
D ALLF^DMSQF(1) ;using param=1 schema/domains/datatypes (re)done
D ^%ZISC
S:$D(ZTQUEUED) ZTREQ="@"
Q
RUNONE ;re-runs the projection of one file - for testing purposes only.
;if the selected file has subfiles, they will not be processed.
;to process one subfile, use the subfile number in this call.
;to select a (sub)file, it must already be an SQLI Table (re-runs only).
I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
N DM1,DM2,DMQ,DMFN S DMQ="" D ASK
I DMQ W !?5,"No file selected; nothing done." Q
D ONEF^DMSQF(DMFN) W !?5,"Done. See SQLI files for changes."
Q
ASK ; select (sub)file number
S DM1=$O(^DMSQ("T","C",0)),DM2=$O(^DMSQ("T","C",99999999999),-1)
S DIR(0)="NO^"_DM1_":"_DM2_":999999999",DIR("A")="File or Subfile Number"
S DIR("?")="Enter the number of a file or subfile to re-project"
D ^DIR S:$D(DIRUT) DMQ=1 K DIR Q:DMQ S DMFN=Y
I '$D(^DMSQ("T","C",DMFN)) D G ASK
. W !?5,"Invalid selection: no SQLI table for this (sub)file."
Q
PURGE ;entry point to clear data from SQLI files, all except keywords
;requires programmer mode (DUZ(0)="@")
;header nodes of the files are reset, indicating empty status
N I
I $G(DUZ(0))'["@" W !,"PROGMODE REQUIRED (NOTHING DONE)",! Q
I $$WAIT^DMSQT1 D Q
. W !?5,"Purging can't be done right now. The SQLI structures"
. W !?5,"are in the process of being built, a job that might take"
. W !?5,"a few hours. So try again later (when the job finishes)."
S DIR("A")="Removes all records from SQLI files. Continue"
S DIR("?",1)="Clears all SQLI files (between 1.52 and 1.53) except SQLI_KEY_WORD."
S DIR("?",2)="(You can re-generate SQLI data at a future time as needed.)",DIR("?",3)=" "
S DIR("?")="Data can be cleared if you don't have an SQL system or you don't use SQLI."
S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR Q:$D(DIRUT)!(Y'=1)
W !,"Working..."
F I="S","KF","T","E","C","P","F","EX","ET","DT","DM","OF" D CLF^DMSQU(I)
W "Done!"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDMSQ 5015 printed Dec 13, 2024@02:55:04 Page 2
DMSQ ;SFISC/EZ-CALLS INTO SQLI CODE ;10/30/97 16:25
+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
SETUP ;entry point to begin SQLI projection process
+1 ;gives interactive user a chance to cancel out before continuing
+2 ;requires programmer mode (DUZ(0)="@")
+3 IF $DATA(ZTQUEUED)
DO RUN
QUIT
+4 IF $$WAIT^DMSQT1
Begin DoDot:1
+5 WRITE !?5,"Another SQLI projection is already running right now."
+6 WRITE !?5,"Try later if you want to re-run the SQLI projection."
End DoDot:1
QUIT
+7 SET DIR(0)="Y"
SET DIR("B")="NO"
+8 SET DIR("A")="This process takes several hours. Want to Continue"
+9 SET DIR("?",1)="This will project FileMan data dictionary information into SQLI files."
+10 SET DIR("?",2)="It may consume up to 30Mb of space in a full hospital account."
+11 SET DIR("?",3)=" "
+12 SET DIR("?",4)="It is safe to run on all systems, even if you don't have SQLI-to-SQL mapping."
+13 SET DIR("?",5)="(Note: SQLI print options won't report anything if SQLI files are empty.)"
+14 SET DIR("?",6)=" "
+15 SET DIR("?",7)="To experiment, you can run this and then use the purge option afterwards."
+16 SET DIR("?",8)="(It isn't necessary to run the purge option beforehand, by the way.)"
+17 SET DIR("?",9)=" "
+18 SET DIR("?",10)="If you do have SQLI-to-SQL mapping, be aware that this is step 2 of 3:"
+19 SET DIR("?",11)=" "
+20 SET DIR("?",12)=" (1) Populate the SQLI Key Word file - KW^DMSQD(SCR,ERR)"
+21 SET DIR("?",13)=" (2) Run this utility - SETUP^DMSQ"
+22 SET DIR("?",14)=" (3) Run your SQLI-to-SQL mapper (vendor product)"
+23 SET DIR("?",15)=" "
+24 SET DIR("?")="These 3 steps should be done in sequence, one right after the other."
+25 DO ^DIR
KILL DIR
if 'Y
QUIT
+26 IF $GET(DUZ(0))'["@"
WRITE !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",!
QUIT
+27 WRITE !!?5,"Running this job on your terminal (HOME device) will tie up"
+28 WRITE !?5,"your terminal for the several hours it takes to run, but you"
+29 WRITE !?5,"will see the job's status as it's running."
+30 WRITE !!?5,"Queuing will send it to the background for processing. The"
+31 WRITE !?5,"status will be apparent from the printed output (if there's an"
+32 WRITE !?5,"error, it's text will be printed). TaskMan/Kernel tools can also"
+33 WRITE !?5,"be used to determine whether the job ran to completion or not."
+34 WRITE !!?5,"Don't send this directly to a printer (without queuing) unless"
+35 WRITE !?5,"you are prepared to tie up your terminal AND the printer for"
+36 WRITE !?5,"the duration of the process.",!
+37 SET %ZIS="QM"
DO ^%ZIS
if POP
QUIT
+38 IF $DATA(IO("Q"))
Begin DoDot:1
+39 SET ZTRTN="RUN^DMSQ"
SET ZTDESC="SQLI PROJECTION"
+40 DO ^%ZTLOAD
DO HOME^%ZIS
KILL IO("Q")
End DoDot:1
QUIT
+41 if IO'=IO(0)
SET DMDOT=""
DO RUN
EXIT KILL DMDOT
+1 QUIT
RUN ;runs the projection of all files (called from SETUP)
+1 USE IO
+2 IF $GET(DUZ(0))'["@"
WRITE !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",!
QUIT
+3 IF $$WAIT^DMSQT1
Begin DoDot:1
+4 WRITE !?5,"Another SQLI projection is being run right now. So"
+5 WRITE !?5,"this attempt to re-run the projection is aborted."
End DoDot:1
QUIT
+6 ;using param=1 schema/domains/datatypes (re)done
DO ALLF^DMSQF(1)
+7 DO ^%ZISC
+8 if $DATA(ZTQUEUED)
SET ZTREQ="@"
+9 QUIT
RUNONE ;re-runs the projection of one file - for testing purposes only.
+1 ;if the selected file has subfiles, they will not be processed.
+2 ;to process one subfile, use the subfile number in this call.
+3 ;to select a (sub)file, it must already be an SQLI Table (re-runs only).
+4 IF $GET(DUZ(0))'["@"
WRITE !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",!
QUIT
+5 NEW DM1,DM2,DMQ,DMFN
SET DMQ=""
DO ASK
+6 IF DMQ
WRITE !?5,"No file selected; nothing done."
QUIT
+7 DO ONEF^DMSQF(DMFN)
WRITE !?5,"Done. See SQLI files for changes."
+8 QUIT
ASK ; select (sub)file number
+1 SET DM1=$ORDER(^DMSQ("T","C",0))
SET DM2=$ORDER(^DMSQ("T","C",99999999999),-1)
+2 SET DIR(0)="NO^"_DM1_":"_DM2_":999999999"
SET DIR("A")="File or Subfile Number"
+3 SET DIR("?")="Enter the number of a file or subfile to re-project"
+4 DO ^DIR
if $DATA(DIRUT)
SET DMQ=1
KILL DIR
if DMQ
QUIT
SET DMFN=Y
+5 IF '$DATA(^DMSQ("T","C",DMFN))
Begin DoDot:1
+6 WRITE !?5,"Invalid selection: no SQLI table for this (sub)file."
End DoDot:1
GOTO ASK
+7 QUIT
PURGE ;entry point to clear data from SQLI files, all except keywords
+1 ;requires programmer mode (DUZ(0)="@")
+2 ;header nodes of the files are reset, indicating empty status
+3 NEW I
+4 IF $GET(DUZ(0))'["@"
WRITE !,"PROGMODE REQUIRED (NOTHING DONE)",!
QUIT
+5 IF $$WAIT^DMSQT1
Begin DoDot:1
+6 WRITE !?5,"Purging can't be done right now. The SQLI structures"
+7 WRITE !?5,"are in the process of being built, a job that might take"
+8 WRITE !?5,"a few hours. So try again later (when the job finishes)."
End DoDot:1
QUIT
+9 SET DIR("A")="Removes all records from SQLI files. Continue"
+10 SET DIR("?",1)="Clears all SQLI files (between 1.52 and 1.53) except SQLI_KEY_WORD."
+11 SET DIR("?",2)="(You can re-generate SQLI data at a future time as needed.)"
SET DIR("?",3)=" "
+12 SET DIR("?")="Data can be cleared if you don't have an SQL system or you don't use SQLI."
+13 SET DIR(0)="Y"
SET DIR("B")="NO"
DO ^DIR
KILL DIR
if $DATA(DIRUT)!(Y'=1)
QUIT
+14 WRITE !,"Working..."
+15 FOR I="S","KF","T","E","C","P","F","EX","ET","DT","DM","OF"
DO CLF^DMSQU(I)
+16 WRITE "Done!"
+17 QUIT