| 1 | IVMBULK2 ;ALB/KCL - IVM/ENROLLMENT Extract Utilities; 23-SEP-1997 | 
|---|
| 2 | ;;2.0;INCOME VERIFICATION MATCH;**9**; 21-OCT-94 | 
|---|
| 3 | ; | 
|---|
| 4 | ; | 
|---|
| 5 | GET(IVMARRY) ; -- | 
|---|
| 6 | ; Description: Used to obtain a record from the IVM Extract Management file into the local IVMARRY array. | 
|---|
| 7 | ; | 
|---|
| 8 | ; Input: None | 
|---|
| 9 | ; | 
|---|
| 10 | ; Output: | 
|---|
| 11 | ;   Function  Value - returns 1 if success, 0 if failure. | 
|---|
| 12 | ;   IVMARRY - this is the name of a local array, it should be passed by | 
|---|
| 13 | ;             reference. If the function is successful this array will | 
|---|
| 14 | ;             contain the record. | 
|---|
| 15 | ; | 
|---|
| 16 | ;     Subscript       Field Name | 
|---|
| 17 | ;     ==========      ======================= | 
|---|
| 18 | ;     "HOST"          Host File Name | 
|---|
| 19 | ;     "DIR"           Directory | 
|---|
| 20 | ;     "PROC"          # of Patients Processed | 
|---|
| 21 | ;     "TASK"          Task Number | 
|---|
| 22 | ;     "START"         Date/Time Job Started | 
|---|
| 23 | ;     "STOP"          Date/Time Job Stopped | 
|---|
| 24 | ;     "TERM"          Job Terminated? | 
|---|
| 25 | ;     "LASTPAT"       Last Patient Processed | 
|---|
| 26 | ;     "PROJECT"       Projected Completion Date/Time | 
|---|
| 27 | ;     "EXTRACT"       # of Patients Extracted | 
|---|
| 28 | ;     "FILES"          Number of Host Files | 
|---|
| 29 | ;     "ERROR"         Error | 
|---|
| 30 | ; | 
|---|
| 31 | N NODE,SUCCESS | 
|---|
| 32 | S SUCCESS=0 | 
|---|
| 33 | ; | 
|---|
| 34 | I '$D(^IVM(301.63,1,0)) G GETQ | 
|---|
| 35 | ; | 
|---|
| 36 | K IVMARRY S IVMARRY="" | 
|---|
| 37 | S NODE=$G(^IVM(301.63,1,0)) | 
|---|
| 38 | ; | 
|---|
| 39 | S IVMARRY("HOST")=$P(NODE,"^") | 
|---|
| 40 | S IVMARRY("DIR")=$P(NODE,"^",2) | 
|---|
| 41 | S IVMARRY("PROC")=$P(NODE,"^",3) | 
|---|
| 42 | S IVMARRY("TASK")=$P(NODE,"^",4) | 
|---|
| 43 | S IVMARRY("START")=$P(NODE,"^",5) | 
|---|
| 44 | S IVMARRY("STOP")=$P(NODE,"^",6) | 
|---|
| 45 | S IVMARRY("TERM")=$P(NODE,"^",7) | 
|---|
| 46 | S IVMARRY("LASTPAT")=$P(NODE,"^",8) | 
|---|
| 47 | S IVMARRY("PROJECT")=$P(NODE,"^",9) | 
|---|
| 48 | S IVMARRY("EXTRACT")=$P(NODE,"^",10) | 
|---|
| 49 | S IVMARRY("FILES")=$P(NODE,"^",11) | 
|---|
| 50 | S NODE=$G(^IVM(301.63,1,10)) | 
|---|
| 51 | S IVMARRY("ERROR")=$P(NODE,"^") | 
|---|
| 52 | ; | 
|---|
| 53 | S SUCCESS=1 | 
|---|
| 54 | ; | 
|---|
| 55 | GETQ Q SUCCESS | 
|---|
| 56 | ; | 
|---|
| 57 | ; | 
|---|
| 58 | STORE(IVMARRY) ; -- | 
|---|
| 59 | ; Description: Used to store the processing information for the | 
|---|
| 60 | ; execution of the initial extract in the IVM Extract Management file. | 
|---|
| 61 | ; | 
|---|
| 62 | ; Input: | 
|---|
| 63 | ;   IVMARRY - this is the name of a local array, it should be passed by | 
|---|
| 64 | ;             reference. This array should contain the processing | 
|---|
| 65 | ;             information to be stored. Missing subscripts will cause | 
|---|
| 66 | ;             the field to be deleted.  "HOST" is required. | 
|---|
| 67 | ; | 
|---|
| 68 | ;     Subscript       Field Name | 
|---|
| 69 | ;     ==========      ======================= | 
|---|
| 70 | ;     "HOST"          Host File Name | 
|---|
| 71 | ;     "DIR"           Directory | 
|---|
| 72 | ;     "PROC"          # of Patients Processed | 
|---|
| 73 | ;     "TASK"          Task Number | 
|---|
| 74 | ;     "START"         Date/Time Job Started | 
|---|
| 75 | ;     "STOP"          Date/Time Job Stopped | 
|---|
| 76 | ;     "TERM"          Job Terminated? | 
|---|
| 77 | ;     "LASTPAT"       Last Patient Processed | 
|---|
| 78 | ;     "PROJECT"       Projected Completion Date/Time | 
|---|
| 79 | ;     "EXTRACT"       # of Patients Extracted | 
|---|
| 80 | ;     "FILES"          Number of Host Files | 
|---|
| 81 | ;     "ERROR"         Error | 
|---|
| 82 | ; | 
|---|
| 83 | ; Output: | 
|---|
| 84 | ;   Function  Value - returns 1 if success, 0 if failure. | 
|---|
| 85 | ; | 
|---|
| 86 | N SUCCESS | 
|---|
| 87 | S SUCCESS=1 | 
|---|
| 88 | ; | 
|---|
| 89 | I $G(IVMARRY("HOST"))="" S SUCCESS=0 G STOREQ | 
|---|
| 90 | I '$D(^IVM(301.63,1,0)) D  G:('SUCCESS) STOREQ | 
|---|
| 91 | .S DATA(.01)=IVMARRY("HOST") | 
|---|
| 92 | .I '$$ADD^DGENDBS(301.63,,.DATA) S SUCCESS=0 | 
|---|
| 93 | ; | 
|---|
| 94 | ; | 
|---|
| 95 | S DATA(.01)=IVMARRY("HOST") | 
|---|
| 96 | S DATA(.02)=$G(IVMARRY("DIR")) | 
|---|
| 97 | S DATA(.03)=$G(IVMARRY("PROC")) | 
|---|
| 98 | S DATA(.04)=$G(IVMARRY("TASK")) | 
|---|
| 99 | S DATA(.05)=$G(IVMARRY("START")) | 
|---|
| 100 | S DATA(.06)=$G(IVMARRY("STOP")) | 
|---|
| 101 | S DATA(.07)=$G(IVMARRY("TERM")) | 
|---|
| 102 | S DATA(.08)=$G(IVMARRY("LASTPAT")) | 
|---|
| 103 | S DATA(.09)=$G(IVMARRY("PROJECT")) | 
|---|
| 104 | S DATA(.1)=$G(IVMARRY("EXTRACT")) | 
|---|
| 105 | S DATA(.11)=$G(IVMARRY("FILES")) | 
|---|
| 106 | S DATA(10)=$G(IVMARRY("ERROR")) | 
|---|
| 107 | I '$$UPD^DGENDBS(301.63,1,.DATA) S SUCCESS=0 | 
|---|
| 108 | ; | 
|---|
| 109 | STOREQ Q SUCCESS | 
|---|
| 110 | ; | 
|---|
| 111 | ; | 
|---|
| 112 | INIT(IVMARRY) ; -- | 
|---|
| 113 | ; Description: Used to initilized IVM Extract Management record in the local IVMARRY array. | 
|---|
| 114 | ; | 
|---|
| 115 | ; Input: None | 
|---|
| 116 | ; | 
|---|
| 117 | ; Output: | 
|---|
| 118 | ;   Function  Value - returns 1 if success, 0 if failure. | 
|---|
| 119 | ;   IVMARRY - this is the name of a local array, it should be passed by | 
|---|
| 120 | ;             reference. If the function is successful this array will | 
|---|
| 121 | ;             contain the initialized record. | 
|---|
| 122 | ; | 
|---|
| 123 | ;     Subscript       Field Name | 
|---|
| 124 | ;     ==========      ======================= | 
|---|
| 125 | ;     "HOST"          Host File Name | 
|---|
| 126 | ;     "DIR"           Directory | 
|---|
| 127 | ;     "PROC"          # of Patients Processed | 
|---|
| 128 | ;     "TASK"          Task Number | 
|---|
| 129 | ;     "START"         Date/Time Job Started | 
|---|
| 130 | ;     "STOP"          Date/Time Job Stopped | 
|---|
| 131 | ;     "TERM"          Job Terminated? | 
|---|
| 132 | ;     "LASTPAT"       Last Patient Processed | 
|---|
| 133 | ;     "PROJECT"       Projected Completion Date/Time | 
|---|
| 134 | ;     "EXTRACT"       # of Patients Extracted | 
|---|
| 135 | ;     "FILES"         Number of Host Files | 
|---|
| 136 | ;     "ERROR"         Error | 
|---|
| 137 | ; | 
|---|
| 138 | K IVMARRY S IVMARRY="" | 
|---|
| 139 | ; | 
|---|
| 140 | S IVMARRY("HOST")="" | 
|---|
| 141 | S IVMARRY("DIR")="" | 
|---|
| 142 | S IVMARRY("PROC")="" | 
|---|
| 143 | S IVMARRY("TASK")="" | 
|---|
| 144 | S IVMARRY("START")="" | 
|---|
| 145 | S IVMARRY("STOP")="" | 
|---|
| 146 | S IVMARRY("TERM")="" | 
|---|
| 147 | S IVMARRY("LASTPAT")="" | 
|---|
| 148 | S IVMARRY("PROJECT")="" | 
|---|
| 149 | S IVMARRY("EXTRACT")="" | 
|---|
| 150 | S IVMARRY("FILES")="" | 
|---|
| 151 | S IVMARRY("ERROR")="" | 
|---|
| 152 | ; | 
|---|
| 153 | INITQ Q 1 | 
|---|
| 154 | ; | 
|---|
| 155 | ; | 
|---|
| 156 | PATH(IVMARRY) ; -- | 
|---|
| 157 | ; Description: Ask user for for valid host file directory. | 
|---|
| 158 | ; | 
|---|
| 159 | ;  Input: | 
|---|
| 160 | ;   IVMARRY - a local array where the extract input parameters will be | 
|---|
| 161 | ;             stored, pass by reference | 
|---|
| 162 | ; | 
|---|
| 163 | ; Output: | 
|---|
| 164 | ;   Function Value - returns 1 if successful, 0 otherwise | 
|---|
| 165 | ;   IVMARRY("DIR") - directory | 
|---|
| 166 | ; | 
|---|
| 167 | N DIR,DTOUT,DUOUT,DIROUT,DIRUT,SUCCESS,Y | 
|---|
| 168 | ; | 
|---|
| 169 | S SUCCESS=0 | 
|---|
| 170 | ; | 
|---|
| 171 | W !!,?15,"* * * * *  I M P O R T A N T  * * * * *" | 
|---|
| 172 | W !,?5,"The host files created by this job will be placed in the" | 
|---|
| 173 | W !,?5,"current working directory.  A directory other than the" | 
|---|
| 174 | W !,?5,"current working directory may also be selected." | 
|---|
| 175 | W !!,?5,"Please check the following to ensure the extract runs correctly." | 
|---|
| 176 | W !!,?10,"1) The directory you have chosen the extract to run in" | 
|---|
| 177 | W !,?13,"is a valid directory." | 
|---|
| 178 | W !!,?10,"2) In order for TaskMan to have access to the directory, the" | 
|---|
| 179 | W !,?13,"WORLD file protection must be 'RW' (Read and Write).  For" | 
|---|
| 180 | W !,?13,"NT/OpenM systems, ensure that the directory is not read only.",! | 
|---|
| 181 | ; | 
|---|
| 182 | ; ask directory | 
|---|
| 183 | S DIR("A")="Select Directory" | 
|---|
| 184 | S DIR("B")=$$PWD^%ZISH,DIR(0)="F^3:50" | 
|---|
| 185 | D ^DIR | 
|---|
| 186 | G:$D(DTOUT)!($D(DUOUT))!($D(DIRUT))!($D(DIROUT)) PATHQ | 
|---|
| 187 | ; | 
|---|
| 188 | S IVMARRY("DIR")=Y | 
|---|
| 189 | S SUCCESS=1 | 
|---|
| 190 | ; | 
|---|
| 191 | PATHQ Q SUCCESS | 
|---|
| 192 | ; | 
|---|
| 193 | ; | 
|---|
| 194 | GETCONST(IVMARRY) ; -- | 
|---|
| 195 | ; Description: Places enrollment extract constants into the local IVMARRY array. | 
|---|
| 196 | ; | 
|---|
| 197 | ; Input: None | 
|---|
| 198 | ; | 
|---|
| 199 | ; Output: | 
|---|
| 200 | ;   Function  Value - returns 1 if success, 0 if failure. | 
|---|
| 201 | ;   IVMARRY - this is the name of a local array, it should be passed by | 
|---|
| 202 | ;             reference. If the function is successful this array will | 
|---|
| 203 | ;             contain the extract constants. | 
|---|
| 204 | ; | 
|---|
| 205 | ;     Subscript    Description | 
|---|
| 206 | ;     ==========   ======================= | 
|---|
| 207 | ;     "BEGDT"      as begin date/time for extract search | 
|---|
| 208 | ;     "HOST"       as name of host file | 
|---|
| 209 | ;     "MAILGRP"    as HEC mail group for notification msg | 
|---|
| 210 | ;     "MSGMAX"     as maximum # of HL7 msgs each host file may contain | 
|---|
| 211 | ;     "PERCNT"     as # of patients expected to be extracted | 
|---|
| 212 | ;     "AVG100"     as average time to extract 100 patients in seconds | 
|---|
| 213 | ;     "SIZE"       as average size of single patient record in bytes | 
|---|
| 214 | ; | 
|---|
| 215 | ; | 
|---|
| 216 | K IVMARRY | 
|---|
| 217 | S IVMARRY="" | 
|---|
| 218 | ; | 
|---|
| 219 | S IVMARRY("BEGDT")=2951231.2359 | 
|---|
| 220 | S IVMARRY("HOST")="HECHOST"_$P($$SITE^VASITE,"^",3) | 
|---|
| 221 | S IVMARRY("MAILGRP")="G.ENROLLMENT EXTRACT@IVM.VA.GOV" | 
|---|
| 222 | S IVMARRY("MSGMAX")=10000 | 
|---|
| 223 | S IVMARRY("PERCNT")=31 | 
|---|
| 224 | S IVMARRY("AVG100")=42 | 
|---|
| 225 | S IVMARRY("SIZE")=1050 | 
|---|
| 226 | ; | 
|---|
| 227 | CONSTQ Q 1 | 
|---|
| 228 | ; | 
|---|
| 229 | ; | 
|---|
| 230 | INQUIRE(ROOT,IEN) ; -- | 
|---|
| 231 | ; Description: Display data from file entry. | 
|---|
| 232 | ; | 
|---|
| 233 | ;  Input: | 
|---|
| 234 | ;    ROOT - global root of the file | 
|---|
| 235 | ;     IEN - IEN of file entry | 
|---|
| 236 | ; | 
|---|
| 237 | N DA,DIC | 
|---|
| 238 | ; | 
|---|
| 239 | S DIC=ROOT,DA=IEN | 
|---|
| 240 | D EN^DIQ | 
|---|
| 241 | Q | 
|---|
| 242 | ; | 
|---|
| 243 | ; | 
|---|
| 244 | LOCK(IEN) ; -- | 
|---|
| 245 | ; Description: This lock is used to prevent another process from editing | 
|---|
| 246 | ;     IVM Extract Management record. | 
|---|
| 247 | ; | 
|---|
| 248 | ;  Input: | 
|---|
| 249 | ;    IEN - Internal entry number of IVM EXTRACT MANAGEMENT file | 
|---|
| 250 | ; | 
|---|
| 251 | ; Output: | 
|---|
| 252 | ;  Function Value - Returns 1 if the lock was successful, 0 otherwise | 
|---|
| 253 | ; | 
|---|
| 254 | I $G(IEN) L +^IVM(IEN,301.63):10 | 
|---|
| 255 | Q $T | 
|---|
| 256 | ; | 
|---|
| 257 | ; | 
|---|
| 258 | UNLOCK(IEN) ; -- | 
|---|
| 259 | ; Description: Used to release a lock created by $$LOCK. | 
|---|
| 260 | ;  Input: | 
|---|
| 261 | ;    IEN - Internal entry number of IVM EXTRACT MANAGEMENT file | 
|---|
| 262 | ; | 
|---|
| 263 | ; Output: None | 
|---|
| 264 | ; | 
|---|
| 265 | I $G(IEN) L -^IVM(IEN,301.63) | 
|---|
| 266 | Q | 
|---|