| 1 | DMSQ ;SFISC/EZ-CALLS INTO SQLI CODE ;10/30/97  16:25
 | 
|---|
| 2 |  ;;22.0;VA FileMan;;Mar 30, 1999
 | 
|---|
| 3 |  ;Per VHA Directive 10-93-142, this routine should not be modified.
 | 
|---|
| 4 |  Q
 | 
|---|
| 5 | SETUP ;entry point to begin SQLI projection process
 | 
|---|
| 6 |  ;gives interactive user a chance to cancel out before continuing
 | 
|---|
| 7 |  ;requires programmer mode (DUZ(0)="@")
 | 
|---|
| 8 |  I $D(ZTQUEUED) D RUN Q
 | 
|---|
| 9 |  I $$WAIT^DMSQT1 D  Q
 | 
|---|
| 10 |  . W !?5,"Another SQLI projection is already running right now."
 | 
|---|
| 11 |  . W !?5,"Try later if you want to re-run the SQLI projection."
 | 
|---|
| 12 |  S DIR(0)="Y",DIR("B")="NO"
 | 
|---|
| 13 |  S DIR("A")="This process takes several hours.  Want to Continue"
 | 
|---|
| 14 |  S DIR("?",1)="This will project FileMan data dictionary information into SQLI files."
 | 
|---|
| 15 |  S DIR("?",2)="It may consume up to 30Mb of space in a full hospital account."
 | 
|---|
| 16 |  S DIR("?",3)=" "
 | 
|---|
| 17 |  S DIR("?",4)="It is safe to run on all systems, even if you don't have SQLI-to-SQL mapping."
 | 
|---|
| 18 |  S DIR("?",5)="(Note: SQLI print options won't report anything if SQLI files are empty.)"
 | 
|---|
| 19 |  S DIR("?",6)=" "
 | 
|---|
| 20 |  S DIR("?",7)="To experiment, you can run this and then use the purge option afterwards."
 | 
|---|
| 21 |  S DIR("?",8)="(It isn't necessary to run the purge option beforehand, by the way.)"
 | 
|---|
| 22 |  S DIR("?",9)=" "
 | 
|---|
| 23 |  S DIR("?",10)="If you do have SQLI-to-SQL mapping, be aware that this is step 2 of 3:"
 | 
|---|
| 24 |  S DIR("?",11)=" "
 | 
|---|
| 25 |  S DIR("?",12)="  (1) Populate the SQLI Key Word file - KW^DMSQD(SCR,ERR)"
 | 
|---|
| 26 |  S DIR("?",13)="  (2) Run this utility - SETUP^DMSQ"
 | 
|---|
| 27 |  S DIR("?",14)="  (3) Run your SQLI-to-SQL mapper (vendor product)"
 | 
|---|
| 28 |  S DIR("?",15)=" "
 | 
|---|
| 29 |  S DIR("?")="These 3 steps should be done in sequence, one right after the other."
 | 
|---|
| 30 |  D ^DIR K DIR Q:'Y
 | 
|---|
| 31 |  I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
 | 
|---|
| 32 |  W !!?5,"Running this job on your terminal (HOME device) will tie up"
 | 
|---|
| 33 |  W !?5,"your terminal for the several hours it takes to run, but you"
 | 
|---|
| 34 |  W !?5,"will see the job's status as it's running."
 | 
|---|
| 35 |  W !!?5,"Queuing will send it to the background for processing.  The"
 | 
|---|
| 36 |  W !?5,"status will be apparent from the printed output (if there's an"
 | 
|---|
| 37 |  W !?5,"error, it's text will be printed).  TaskMan/Kernel tools can also"
 | 
|---|
| 38 |  W !?5,"be used to determine whether the job ran to completion or not."
 | 
|---|
| 39 |  W !!?5,"Don't send this directly to a printer (without queuing) unless"
 | 
|---|
| 40 |  W !?5,"you are prepared to tie up your terminal AND the printer for"
 | 
|---|
| 41 |  W !?5,"the duration of the process.",!
 | 
|---|
| 42 |  S %ZIS="QM" D ^%ZIS Q:POP
 | 
|---|
| 43 |  I $D(IO("Q")) D  Q
 | 
|---|
| 44 |  . S ZTRTN="RUN^DMSQ",ZTDESC="SQLI PROJECTION"
 | 
|---|
| 45 |  . D ^%ZTLOAD D HOME^%ZIS K IO("Q")
 | 
|---|
| 46 |  S:IO'=IO(0) DMDOT="" D RUN
 | 
|---|
| 47 | EXIT K DMDOT
 | 
|---|
| 48 |  Q
 | 
|---|
| 49 | RUN ;runs the projection of all files (called from SETUP)
 | 
|---|
| 50 |  U IO
 | 
|---|
| 51 |  I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
 | 
|---|
| 52 |  I $$WAIT^DMSQT1 D  Q
 | 
|---|
| 53 |  . W !?5,"Another SQLI projection is being run right now.  So"
 | 
|---|
| 54 |  . W !?5,"this attempt to re-run the projection is aborted."
 | 
|---|
| 55 |  D ALLF^DMSQF(1) ;using param=1 schema/domains/datatypes (re)done
 | 
|---|
| 56 |  D ^%ZISC
 | 
|---|
| 57 |  S:$D(ZTQUEUED) ZTREQ="@"
 | 
|---|
| 58 |  Q
 | 
|---|
| 59 | RUNONE ;re-runs the projection of one file - for testing purposes only.
 | 
|---|
| 60 |  ;if the selected file has subfiles, they will not be processed.
 | 
|---|
| 61 |  ;to process one subfile, use the subfile number in this call.
 | 
|---|
| 62 |  ;to select a (sub)file, it must already be an SQLI Table (re-runs only).
 | 
|---|
| 63 |  I $G(DUZ(0))'["@" W !,"PROGRAMMER MODE REQUIRED (NOTHING DONE)",! Q
 | 
|---|
| 64 |  N DM1,DM2,DMQ,DMFN S DMQ="" D ASK
 | 
|---|
| 65 |  I DMQ W !?5,"No file selected; nothing done." Q
 | 
|---|
| 66 |  D ONEF^DMSQF(DMFN) W !?5,"Done.  See SQLI files for changes."
 | 
|---|
| 67 |  Q
 | 
|---|
| 68 | ASK ; select (sub)file number
 | 
|---|
| 69 |  S DM1=$O(^DMSQ("T","C",0)),DM2=$O(^DMSQ("T","C",99999999999),-1)
 | 
|---|
| 70 |  S DIR(0)="NO^"_DM1_":"_DM2_":999999999",DIR("A")="File or Subfile Number"
 | 
|---|
| 71 |  S DIR("?")="Enter the number of a file or subfile to re-project"
 | 
|---|
| 72 |  D ^DIR S:$D(DIRUT) DMQ=1 K DIR Q:DMQ  S DMFN=Y
 | 
|---|
| 73 |  I '$D(^DMSQ("T","C",DMFN)) D  G ASK
 | 
|---|
| 74 |  . W !?5,"Invalid selection:  no SQLI table for this (sub)file."
 | 
|---|
| 75 |  Q
 | 
|---|
| 76 | PURGE ;entry point to clear data from SQLI files, all except keywords
 | 
|---|
| 77 |  ;requires programmer mode (DUZ(0)="@")
 | 
|---|
| 78 |  ;header nodes of the files are reset, indicating empty status
 | 
|---|
| 79 |  N I
 | 
|---|
| 80 |  I $G(DUZ(0))'["@" W !,"PROGMODE REQUIRED (NOTHING DONE)",! Q
 | 
|---|
| 81 |  I $$WAIT^DMSQT1 D  Q
 | 
|---|
| 82 |  . W !?5,"Purging can't be done right now.  The SQLI structures"
 | 
|---|
| 83 |  . W !?5,"are in the process of being built, a job that might take"
 | 
|---|
| 84 |  . W !?5,"a few hours.  So try again later (when the job finishes)."
 | 
|---|
| 85 |  S DIR("A")="Removes all records from SQLI files. Continue"
 | 
|---|
| 86 |  S DIR("?",1)="Clears all SQLI files (between 1.52 and 1.53) except SQLI_KEY_WORD."
 | 
|---|
| 87 |  S DIR("?",2)="(You can re-generate SQLI data at a future time as needed.)",DIR("?",3)=" "
 | 
|---|
| 88 |  S DIR("?")="Data can be cleared if you don't have an SQL system or you don't use SQLI."
 | 
|---|
| 89 |  S DIR(0)="Y",DIR("B")="NO" D ^DIR K DIR Q:$D(DIRUT)!(Y'=1)
 | 
|---|
| 90 |  W !,"Working..."
 | 
|---|
| 91 |  F I="S","KF","T","E","C","P","F","EX","ET","DT","DM","OF" D CLF^DMSQU(I)
 | 
|---|
| 92 |  W "Done!"
 | 
|---|
| 93 |  Q
 | 
|---|