Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DMSQ

DMSQ.m

Go to the documentation of this file.
  1. DMSQ ;SFISC/EZ-CALLS INTO SQLI CODE ;10/30/97 16:25
  1. ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
  1. ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
  1. ;;Licensed under the terms of the Apache License, Version 2.0.
  1. ;
  1. Q
  1. SETUP ;entry point to begin SQLI projection process
  1. ;gives interactive user a chance to cancel out before continuing
  1. ;requires programmer mode (DUZ(0)="@")
  1. I $D(ZTQUEUED) D RUN Q
  1. I $$WAIT^DMSQT1 D Q
  1. . W !?5,"Another SQLI projection is already running right now."
  1. . W !?5,"Try later if you want to re-run the SQLI projection."
  1. S DIR(0)="Y",DIR("B")="NO"
  1. S DIR("A")="This process takes several hours. Want to Continue"
  1. S DIR("?",1)="This will project FileMan data dictionary information into SQLI files."
  1. S DIR("?",2)="It may consume up to 30Mb of space in a full hospital account."
  1. S DIR("?",3)=" "
  1. S DIR("?",4)="It is safe to run on all systems, even if you don't have SQLI-to-SQL mapping."
  1. S DIR("?",5)="(Note: SQLI print options won't report anything if SQLI files are empty.)"
  1. S DIR("?",6)=" "
  1. S DIR("?",7)="To experiment, you can run this and then use the purge option afterwards."
  1. S DIR("?",8)="(It isn't necessary to run the purge option beforehand, by the way.)"
  1. S DIR("?",9)=" "
  1. S DIR("?",10)="If you do have SQLI-to-SQL mapping, be aware that this is step 2 of 3:"
  1. S DIR("?",11)=" "
  1. S DIR("?",12)=" (1) Populate the SQLI Key Word file - KW^DMSQD(SCR,ERR)"
  1. S DIR("?",13)=" (2) Run this utility - SETUP^DMSQ"
  1. S DIR("?",14)=" (3) Run your SQLI-to-SQL mapper (vendor product)"
  1. S DIR("?",15)=" "
  1. S DIR("?")="These 3 steps should be done in sequence, one right after the other."
  1. D ^DIR K DIR Q:'Y
  1. I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
  1. W !!?5,"Running this job on your terminal (HOME device) will tie up"
  1. W !?5,"your terminal for the several hours it takes to run, but you"
  1. W !?5,"will see the job's status as it's running."
  1. W !!?5,"Queuing will send it to the background for processing. The"
  1. W !?5,"status will be apparent from the printed output (if there's an"
  1. W !?5,"error, it's text will be printed). TaskMan/Kernel tools can also"
  1. W !?5,"be used to determine whether the job ran to completion or not."
  1. W !!?5,"Don't send this directly to a printer (without queuing) unless"
  1. W !?5,"you are prepared to tie up your terminal AND the printer for"
  1. W !?5,"the duration of the process.",!
  1. S %ZIS="QM" D ^%ZIS Q:POP
  1. I $D(IO("Q")) D Q
  1. . S ZTRTN="RUN^DMSQ",ZTDESC="SQLI PROJECTION"
  1. . D ^%ZTLOAD D HOME^%ZIS K IO("Q")
  1. S:IO'=IO(0) DMDOT="" D RUN
  1. EXIT K DMDOT
  1. Q
  1. RUN ;runs the projection of all files (called from SETUP)
  1. U IO
  1. I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
  1. I $$WAIT^DMSQT1 D Q
  1. . W !?5,"Another SQLI projection is being run right now. So"
  1. . W !?5,"this attempt to re-run the projection is aborted."
  1. D ALLF^DMSQF(1) ;using param=1 schema/domains/datatypes (re)done
  1. D ^%ZISC
  1. S:$D(ZTQUEUED) ZTREQ="@"
  1. Q
  1. RUNONE ;re-runs the projection of one file - for testing purposes only.
  1. ;if the selected file has subfiles, they will not be processed.
  1. ;to process one subfile, use the subfile number in this call.
  1. ;to select a (sub)file, it must already be an SQLI Table (re-runs only).
  1. I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
  1. N DM1,DM2,DMQ,DMFN S DMQ="" D ASK
  1. I DMQ W !?5,"No file selected; nothing done." Q
  1. D ONEF^DMSQF(DMFN) W !?5,"Done. See SQLI files for changes."
  1. Q
  1. ASK ; select (sub)file number
  1. S DM1=$O(^DMSQ("T","C",0)),DM2=$O(^DMSQ("T","C",99999999999),-1)
  1. S DIR(0)="NO^"_DM1_":"_DM2_":999999999",DIR("A")="File or Subfile Number"
  1. S DIR("?")="Enter the number of a file or subfile to re-project"
  1. D ^DIR S:$D(DIRUT) DMQ=1 K DIR Q:DMQ S DMFN=Y
  1. I '$D(^DMSQ("T","C",DMFN)) D G ASK
  1. . W !?5,"Invalid selection: no SQLI table for this (sub)file."
  1. Q
  1. PURGE ;entry point to clear data from SQLI files, all except keywords
  1. ;requires programmer mode (DUZ(0)="@")
  1. ;header nodes of the files are reset, indicating empty status
  1. N I
  1. I $G(DUZ(0))'["@" W !,"PROGMODE REQUIRED (NOTHING DONE)",! Q
  1. I $$WAIT^DMSQT1 D Q
  1. . W !?5,"Purging can't be done right now. The SQLI structures"
  1. . W !?5,"are in the process of being built, a job that might take"
  1. . W !?5,"a few hours. So try again later (when the job finishes)."
  1. S DIR("A")="Removes all records from SQLI files. Continue"
  1. S DIR("?",1)="Clears all SQLI files (between 1.52 and 1.53) except SQLI_KEY_WORD."
  1. S DIR("?",2)="(You can re-generate SQLI data at a future time as needed.)",DIR("?",3)=" "
  1. S DIR("?")="Data can be cleared if you don't have an SQL system or you don't use SQLI."
  1. S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR Q:$D(DIRUT)!(Y'=1)
  1. W !,"Working..."
  1. F I="S","KF","T","E","C","P","F","EX","ET","DT","DM","OF" D CLF^DMSQU(I)
  1. W "Done!"
  1. Q