[1544] | 1 | C0CFM2 ; CCDCCR/GPL - CCR FILEMAN utilities; 12/6/08
|
---|
[1586] | 2 | ;;1.2;CCD/CCR GENERATION UTILITIES;;Oct 30, 2012;Build 50
|
---|
| 3 | ;Copyright 2009 George Lilly.
|
---|
[1544] | 4 | ;
|
---|
[1586] | 5 | ; This program is free software: you can redistribute it and/or modify
|
---|
| 6 | ; it under the terms of the GNU Affero General Public License as
|
---|
| 7 | ; published by the Free Software Foundation, either version 3 of the
|
---|
| 8 | ; License, or (at your option) any later version.
|
---|
[1544] | 9 | ;
|
---|
[1586] | 10 | ; This program is distributed in the hope that it will be useful,
|
---|
| 11 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 12 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 13 | ; GNU Affero General Public License for more details.
|
---|
[1544] | 14 | ;
|
---|
[1586] | 15 | ; You should have received a copy of the GNU Affero General Public License
|
---|
| 16 | ; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
---|
[1544] | 17 | ;
|
---|
[1586] | 18 | ;
|
---|
[1544] | 19 | W "This is the CCR FILEMAN Utility Library ",!
|
---|
| 20 | ; THIS SET OF ROUTINES USE CCR E2 (^C0CE(, FILE 171.101) INSTEAD OF
|
---|
| 21 | ; CCR ELEMENTS (^C0C(179.201,
|
---|
| 22 | ; E2 IS A SIMPLIFICATION OF CCR ELEMENTS WHERE SUB-ELEMENTS ARE
|
---|
| 23 | ; AT THE TOP LEVEL. OCCURANCE, THE 4TH PART OF THE KEY IS NOW FREE TEXT
|
---|
| 24 | ; AND HAS THE FORM X;Y FOR SUB-ELEMENTS
|
---|
| 25 | ; ALL SUB-VARIABLES HAVE BEEN REMOVED
|
---|
| 26 | W !
|
---|
| 27 | Q
|
---|
| 28 | ;
|
---|
| 29 | RIMTBL(ZWHICH) ; PUT ALL PATIENT IN RIMTBL ZWHICH INTO THE CCR ELEMENTS FILE
|
---|
| 30 | ;
|
---|
| 31 | I '$D(RIMBASE) D ASETUP^C0CRIMA ; FOR COMMAND LINE CALLS
|
---|
| 32 | N ZI,ZJ,ZC,ZPATBASE
|
---|
| 33 | S ZPATBASE=$NA(@RIMBASE@("RIMTBL","PATS",ZWHICH))
|
---|
| 34 | S ZI=""
|
---|
| 35 | F ZJ=0:0 D Q:$O(@ZPATBASE@(ZI))="" ; TIL END
|
---|
| 36 | . S ZI=$O(@ZPATBASE@(ZI))
|
---|
| 37 | . D PUTRIM(ZI) ; EXPORT THE PATIENT TO A FILE
|
---|
| 38 | Q
|
---|
| 39 | ;
|
---|
| 40 | PUTRIM(DFN,ZWHICH) ;DFN IS PATIENT , WHICH IS ELEMENT TYPE
|
---|
| 41 | ;
|
---|
| 42 | S C0CGLB=$NA(^TMP("C0CRIM","VARS",DFN))
|
---|
| 43 | I '$D(ZWHICH) S ZWHICH="ALL"
|
---|
| 44 | I ZWHICH'="ALL" D ; SINGLE SECTION REQUESTED
|
---|
| 45 | . S C0CVARS=$NA(@C0CGLB@(ZWHICH))
|
---|
| 46 | . D PUTRIM1(DFN,ZWHICH,C0CVARS) ; IF ONE SECTION
|
---|
| 47 | E D ; MULTIPLE SECTIONS
|
---|
| 48 | . S C0CVARS=$NA(@C0CGLB)
|
---|
| 49 | . S C0CI=""
|
---|
| 50 | . F S C0CI=$O(@C0CVARS@(C0CI)) Q:C0CI="" D ;FOR EACH SECTION
|
---|
| 51 | . . S C0CVARSN=$NA(@C0CVARS@(C0CI)) ; GRAB ONE SECTION
|
---|
| 52 | . . D PUTRIM1(DFN,C0CI,C0CVARSN)
|
---|
| 53 | Q
|
---|
| 54 | ;
|
---|
| 55 | PUTRIM1(DFN,ZZTYP,ZVARS) ; PUT ONE SECTION OF VARIABLES INTO CCR ELEMENTS
|
---|
| 56 | ; ZVARS IS PASSED BY NAME AN HAS THE FORM @ZVARS@(1,"VAR1")="VAL1"
|
---|
| 57 | S C0CX=0
|
---|
| 58 | F S C0CX=$O(@ZVARS@(C0CX)) Q:C0CX="" D ; FOR EACH OCCURANCE
|
---|
| 59 | . W "ZOCC=",C0CX,!
|
---|
| 60 | . K C0CMDO ; MULTIPLE SUBELEMENTS FOR THIS OCCURANCE PASSED BY NAME
|
---|
| 61 | . S C0CV=$NA(@ZVARS@(C0CX)) ; VARIABLES FOR THIS OCCURANCE
|
---|
| 62 | . D PUTELS(DFN,ZZTYP,C0CX,C0CV) ; PUT THEM TO THE CCR ELEMENTS FILE
|
---|
| 63 | . I $D(C0CMDO) D ; MULTIPLES TO HANDLE (THIS IS INSTEAD OF RECURSION :()
|
---|
| 64 | . . N ZZCNT,ZZC0CI,ZZVALS,ZT,ZZCNT,ZV
|
---|
| 65 | . . S ZZCNT=0
|
---|
| 66 | . . S ZZC0CI=0
|
---|
| 67 | . . S ZZVALS=$NA(@C0CMDO@("M")) ; LOCATION OF THIS MULTILPE
|
---|
| 68 | . . S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
|
---|
| 69 | . . S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
|
---|
| 70 | . . W "MULTIPLE:",ZZVALS,!
|
---|
| 71 | . . ;B
|
---|
| 72 | . . F S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI="" D ; EACH MULTIPLE
|
---|
| 73 | . . . S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
|
---|
| 74 | . . . W "COUNT:",ZZCNT,!
|
---|
| 75 | . . . S ZV=$NA(@ZZVALS@(ZZC0CI))
|
---|
| 76 | . . . D PUTELS(DFN,ZT,C0CX_";"_ZZCNT,ZV)
|
---|
| 77 | Q
|
---|
| 78 | ;
|
---|
| 79 | PUTELS(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
|
---|
| 80 | ; 171.101, ^C0CE DFN IS THE PATIENT IEN PASSED BY VALUE
|
---|
| 81 | ; ZTYPE IS THE NODE TYPE IE RESULTS,PROBLEMS PASSED BY VALUE
|
---|
| 82 | ; ZOCC IS THE OCCURANCE NUMBER IE PROBLEM NUMBER 1,2,3 ETC
|
---|
| 83 | ; ZVALS ARE THE VARIABLES AND VALUES PASSED BY NAME AND IN THE FORM
|
---|
| 84 | ; @ZVALS@("VAR1")="VALUE1" FOR ALL VARIABLES IN THIS ELEMENT
|
---|
| 85 | ; AND @ZVALS@("M",SUBOCCUR,"VAR2")="VALUE2" FOR SUB VARIABLES
|
---|
| 86 | ;
|
---|
| 87 | N PATN,ZTYPN,XD0,ZTYP
|
---|
| 88 | I '$D(ZSRC) S ZSRC=1 ; CCR SOURCE IS ASSUMED, 1 IF NOT SET
|
---|
| 89 | ; PUT THIS IN PARAMETERS - SO SOURCE NUMBER FOR PROCESSING IN CONFIGURABLE
|
---|
| 90 | N C0CFPAT S C0CFPAT=171.101 ; FILE AT PATIENT LEVEL
|
---|
| 91 | N C0CFSRC S C0CFSRC=171.111 ; FILE AT CCR SOURCE LVL
|
---|
| 92 | N C0CFTYP S C0CFTYP=171.121 ; FILE AT ELEMENT TYPE LVL
|
---|
| 93 | N C0CFOCC S C0CFOCC=171.131 ; FILE AT OCCURANCE LVL
|
---|
| 94 | N C0CFVAR S C0CFVAR=171.1311 ; FILE AT VARIABLE LVL
|
---|
| 95 | ;FILE IS ^C0CE(PAT,1,SCR,1,TYP,1,OCC,1,VAR,1, ...
|
---|
| 96 | ; AND WE HAVE TO ADD THEM LEVEL AT A TIME I THINK
|
---|
| 97 | N C0CFDA
|
---|
| 98 | S C0CFDA(C0CFPAT,"?+1,",.01)=DFN
|
---|
| 99 | D UPDIE ; ADD THE PATIENT
|
---|
| 100 | S PATN=$O(^C0CE("B",DFN,"")) ; IEN FOR THE PATIENT
|
---|
| 101 | S C0CFDA(C0CFSRC,"?+1,"_PATN_",",.01)=ZSRC
|
---|
| 102 | D UPDIE ; ADD THE CCR SOURCE
|
---|
| 103 | N ZTYPN S ZTYPN=$O(^C0CDIC(170.101,"B",ZTYPE,"")) ; FIND THE ELE TYPE
|
---|
| 104 | S C0CFDA(C0CFTYP,"?+1,"_ZSRC_","_PATN_",",.01)=ZTYPN
|
---|
| 105 | D UPDIE ; ADD THE ELEMENT TYPE
|
---|
| 106 | S ZTYP=$O(^C0CE(PATN,1,ZSRC,1,"B",ZTYPN,"")) ; IEN OF ELEMENT TYPE
|
---|
| 107 | S C0CFDA(C0CFOCC,"?+1,"_ZTYP_","_ZSRC_","_PATN_",",.01)=ZOCC ; STRING OCC
|
---|
| 108 | ; OCC IS PRECEDED BY " " TO FORCE STRING STORAGE AND PRESERVE
|
---|
| 109 | ; STRING COLLATION ON THE INDEX
|
---|
| 110 | D UPDIE ; ADD THE OCCURANCE
|
---|
| 111 | S ZD0=$O(^C0CE(PATN,1,ZSRC,1,ZTYP,1,"B",ZOCC,""))
|
---|
| 112 | W "RECORD NUMBER: ",ZD0,!
|
---|
| 113 | ;I ZD0=32 B
|
---|
| 114 | ;I ZD0=31 B
|
---|
| 115 | N ZCNT,ZC0CI,ZVARN,C0CZ1
|
---|
| 116 | S ZCNT=0
|
---|
| 117 | S ZC0CI="" ;
|
---|
| 118 | F S ZC0CI=$O(@ZVALS@(ZC0CI)) Q:ZC0CI="" D ;
|
---|
| 119 | . I ZC0CI'="M" D ; NOT A SUBVARIABLE
|
---|
| 120 | . . S ZCNT=ZCNT+1 ;INCREMENT COUNT
|
---|
| 121 | . . S ZVARN=$$VARPTR(ZC0CI,ZTYPE) ;GET THE POINTER TO THE VAR IN THE CCR DICT
|
---|
| 122 | . . ; WILL ALLOW FOR LAYGO IF THE VARIABLE IS NOT FOUND
|
---|
| 123 | . . S C0CZ1=ZTYP_","_ZSRC_","_PATN_","
|
---|
| 124 | . . S C0CFDA(C0CFVAR,"?+"_ZCNT_","_ZD0_","_C0CZ1,.01)=ZVARN
|
---|
| 125 | . . S ZZVAL=$TR(@ZVALS@(ZC0CI),"^","|")
|
---|
| 126 | . . S C0CFDA(C0CFVAR,"?+"_ZCNT_","_ZD0_","_C0CZ1,1)=ZZVAL
|
---|
| 127 | . E D ; THIS IS A SUBELEMENT
|
---|
| 128 | . . ;PUT THE FOLLOWING BACK TO USE RECURSION
|
---|
| 129 | . . ;N ZZCNT,ZZC0CI,ZZVALS,ZT,ZZCNT,ZV
|
---|
| 130 | . . ;S ZZCNT=0
|
---|
| 131 | . . ;S ZZC0CI=0
|
---|
| 132 | . . ;S ZZVALS=$NA(@ZVALS@("M")) ; LOCATION OF THIS MULTILPE
|
---|
| 133 | . . ;S ZT=$O(@ZZVALS@("")) ; ELEMENT TYPE OF MULTIPLE
|
---|
| 134 | . . ;S ZZVALS=$NA(@ZZVALS@(ZT)) ; PAST MULTIPLE TYPE INDICATOR
|
---|
| 135 | . . ;W "MULTIPLE:",ZZVALS,!
|
---|
| 136 | . . ;B
|
---|
| 137 | . . ;F S ZZC0CI=$O(@ZZVALS@(ZZC0CI)) Q:ZZC0CI="" D ; EACH MULTIPLE
|
---|
| 138 | . . ;. S ZZCNT=ZZCNT+1 ;INCREMENT COUNT
|
---|
| 139 | . . ;. W "COUNT:",ZZCNT,!
|
---|
| 140 | . . ;. S ZV=$NA(@ZZVALS@(ZZC0CI))
|
---|
| 141 | . . ;. D PUTELS(DFN,ZT,ZOCC_";"_ZZCNT,ZV) ; PUT THIS BACK TO DEBUG RECURSION
|
---|
| 142 | . . S C0CMDO=ZVALS ; FLAG TO HANDLE MULTIPLES (INSTEAD OF RECURSION)
|
---|
| 143 | D UPDIE ; UPDATE
|
---|
| 144 | Q
|
---|
| 145 | ;
|
---|
| 146 | UPDIE ; INTERNAL ROUTINE TO CALL UPDATE^DIE AND CHECK FOR ERRORS
|
---|
| 147 | K ZERR
|
---|
| 148 | D CLEAN^DILF
|
---|
| 149 | D UPDATE^DIE("","C0CFDA","","ZERR")
|
---|
[1586] | 150 | I $D(ZERR) S $EC=",U1,"
|
---|
[1544] | 151 | K C0CFDA
|
---|
| 152 | Q
|
---|
| 153 | ;
|
---|
| 154 | CHECK ; CHECKSUM EXPERIMENTS
|
---|
| 155 | ;
|
---|
| 156 | ;B
|
---|
| 157 | S ZG=$NA(^C0CE(DA(2),1,DA(1),1,DA))
|
---|
| 158 | ;S G2=$NA(^C0CE(8,1,1,1,2,1,6))
|
---|
| 159 | S X=$$CHKSUM^XUSESIG1(ZG)
|
---|
| 160 | W G1,!
|
---|
| 161 | Q
|
---|
| 162 | ;
|
---|
| 163 | CHKELS(DFN) ; CHECKSUM ALL ELEMENTS FOR A PATIENT
|
---|
| 164 | ;
|
---|
| 165 | S ZGLB=$NA(^TMP("C0CCHK"))
|
---|
| 166 | S ZPAT=$O(^C0CE("B",DFN,""))
|
---|
| 167 | K @ZGLB@(ZPAT) ; CLEAR PREVIOUS CHECKSUMS
|
---|
| 168 | S ZSRC=""
|
---|
| 169 | F S ZSRC=$O(^C0CE(ZPAT,1,"B",ZSRC)) Q:ZSRC="" D ;
|
---|
| 170 | . W "PAT:",ZPAT," SRC:",ZSRC,!
|
---|
| 171 | . S ZEL=""
|
---|
| 172 | . F S ZEL=$O(^C0CE(ZPAT,1,ZSRC,1,"B",ZEL)) Q:ZEL="" D ;ELEMENTS
|
---|
| 173 | . . W "ELEMENT:",ZEL," "
|
---|
| 174 | . . S ZELE=$$GET1^DIQ(170.101,ZEL,.01,"E") ;ELEMENT NAME
|
---|
| 175 | . . W ZELE," "
|
---|
| 176 | . . S ZELI=$O(^C0CE(ZPAT,1,ZSRC,1,"B",ZEL,""))
|
---|
| 177 | . . S ZG=$NA(^C0CE(ZPAT,1,ZSRC,1,ZELI))
|
---|
| 178 | . . S ZCHK=$$CHKSUM^XUSESIG1(ZG) ; CHECKSUM FOR THE ELEMENT
|
---|
| 179 | . . W ZCHK,!
|
---|
| 180 | . . S @ZGLB@(ZPAT,ZELE,ZSRC)=ZCHK
|
---|
[1586] | 181 | ; ZWR ^TMP("C0CCHK",ZPAT,*)
|
---|
[1544] | 182 | Q
|
---|
| 183 | ;
|
---|
| 184 | DOIT(DFN) ; EXPERIMENT FOR TIMING CALLS USING mumps -dir DOIT^C0CFM2(DFN)
|
---|
| 185 | D SETXUP
|
---|
| 186 | D CHKELS(DFN)
|
---|
| 187 | Q
|
---|
| 188 | ;
|
---|
| 189 | SETXUP ; SET UP ENVIRONMENT
|
---|
| 190 | S DISYS=19
|
---|
| 191 | S DT=3090325
|
---|
| 192 | S DTIME=300
|
---|
| 193 | S DUZ=1
|
---|
| 194 | S DUZ(0)="@"
|
---|
| 195 | S DUZ(1)=""
|
---|
| 196 | S DUZ(2)=7247
|
---|
| 197 | S DUZ("AG")="I"
|
---|
| 198 | S DUZ("BUF")=1
|
---|
| 199 | S DUZ("LANG")=""
|
---|
| 200 | S IO="/dev/pts/20"
|
---|
| 201 | S IO(0)="/dev/pts/20"
|
---|
| 202 | S IO(1,"/dev/pts/20")=""
|
---|
| 203 | S IO("ERROR")=""
|
---|
| 204 | S IO("HOME")="344^/dev/pts/20"
|
---|
| 205 | S IO("ZIO")="/dev/pts/20"
|
---|
| 206 | S IOBS="$C(8)"
|
---|
| 207 | S IOF="#,$C(27,91,50,74,27,91,72)"
|
---|
| 208 | S IOM=80
|
---|
| 209 | S ION="TELNET"
|
---|
| 210 | S IOS=344
|
---|
| 211 | S IOSL=24
|
---|
| 212 | S IOST="C-VT100"
|
---|
| 213 | S IOST(0)=9
|
---|
| 214 | S IOT="VTRM"
|
---|
| 215 | S IOXY="W $C(27,91)_((DY+1))_$C(59)_((DX+1))_$C(72)"
|
---|
| 216 | S U="^"
|
---|
| 217 | S X="216;DIC(4.2,"
|
---|
| 218 | S XPARSYS="216;DIC(4.2,"
|
---|
| 219 | S XQXFLG="^^XUP"
|
---|
| 220 | Q
|
---|
| 221 | ;
|
---|
[1586] | 222 | PUTELSO(DFN,ZTYPE,ZOCC,ZVALS) ; PUT CCR VALUES INTO THE CCR ELEMENTS FILE
|
---|
[1544] | 223 | ; 171.101, ^C0CE DFN IS THE PATIENT IEN PASSED BY VALUE
|
---|
| 224 | ; ZTYPE IS THE NODE TYPE IE RESULTS,PROBLEMS PASSED BY VALUE
|
---|
| 225 | ; ZOCC IS THE OCCURANCE NUMBER IE PROBLEM NUMBER 1,2,3 ETC
|
---|
| 226 | ; ZVALS ARE THE VARIABLES AND VALUES PASSED BY NAME AND IN THE FORM
|
---|
| 227 | ; @ZVALS@("VAR1")="VALUE1" FOR ALL VARIABLES IN THIS ELEMENT
|
---|
| 228 | ; AND @ZVALS@("M",SUBOCCUR,"VAR2")="VALUE2" FOR SUB VARIABLES
|
---|
| 229 | ;
|
---|
| 230 | S ZSRC=1 ; CCR SOURCE IS ASSUMED TO BE THIS EHR, WHICH IS ALWAYS SOURCE 1
|
---|
| 231 | ; PUT THIS IN PARAMETERS - SO SOURCE NUMBER FOR PROCESSING IN CONFIGURABLE
|
---|
| 232 | N ZF,ZFV S ZF=171.101 S ZFV=171.1011
|
---|
| 233 | ;S ZSUBF=171.20122 ;FILE AND SUBFILE NUMBERS
|
---|
| 234 | ;N ZSFV S ZSFV=171.201221 ; SUBFILE VARIABLE FILE NUMBER
|
---|
| 235 | N ZTYPN S ZTYPN=$O(^C0CDIC(170.101,"B",ZTYPE,""))
|
---|
| 236 | W "ZTYPE: ",ZTYPE," ",ZTYPN,!
|
---|
| 237 | N ZVARN ; IEN OF VARIABLE BEING PROCESSED
|
---|
| 238 | ;N C0CFDA ; FDA FOR CCR ELEMENT UPDATE
|
---|
| 239 | K C0CFDA
|
---|
| 240 | S C0CFDA(ZF,"?+1,",.01)=DFN
|
---|
| 241 | S C0CFDA(ZF,"?+1,",.02)=ZSRC
|
---|
| 242 | S C0CFDA(ZF,"?+1,",.03)=ZTYPN
|
---|
| 243 | S C0CFDA(ZF,"?+1,",.04)=" "_ZOCC ;CREATE OCCURANCE
|
---|
| 244 | K ZERR
|
---|
| 245 | ;B
|
---|
| 246 | D UPDATE^DIE("","C0CFDA","","ZERR") ;ASSIGN RECORD NUMBER
|
---|
[1586] | 247 | I $D(ZERR) S $EC=",U1,"
|
---|
[1544] | 248 | K C0CFDA
|
---|
| 249 | S ZD0=$O(^C0CE("C",DFN,ZSRC,ZTYPN,ZOCC,""))
|
---|
| 250 | W "RECORD NUMBER: ",ZD0,!
|
---|
| 251 | S ZCNT=0
|
---|
| 252 | S ZC0CI="" ;
|
---|
| 253 | F S ZC0CI=$O(@ZVALS@(ZC0CI)) Q:ZC0CI="" D ;
|
---|
| 254 | . I ZC0CI'="M" D ; NOT A SUBVARIABLE
|
---|
| 255 | . . S ZCNT=ZCNT+1 ;INCREMENT COUNT
|
---|
| 256 | . . S ZVARN=$$VARPTR(ZC0CI,ZTYPE) ;GET THE POINTER TO THE VAR IN THE CCR DICT
|
---|
| 257 | . . ; WILL ALLOW FOR LAYGO IF THE VARIABLE IS NOT FOUND
|
---|
| 258 | . . S C0CFDA(ZFV,"?+"_ZCNT_","_ZD0_",",.01)=ZVARN
|
---|
| 259 | . . S C0CFDA(ZFV,"?+"_ZCNT_","_ZD0_",",1)=@ZVALS@(ZC0CI)
|
---|
| 260 | . . ;S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",.01)=ZVARN
|
---|
| 261 | . . ;S C0CFDA(ZSFV,"+1,"_DFN_","_ZSRC_","_ZTYPN_","_ZOCC_",",1)=@ZVALS@(ZC0CI)
|
---|
| 262 | ;S GT1(170,"?+1,",.01)="ZZZ NEW MEDVEHICLETEXT"
|
---|
| 263 | ;S GT1(170,"?+1,",12)="DIR"
|
---|
| 264 | ;S GT1(171.201221,"?+1,1,5,1,",.01)="ZZZ NEW MEDVEHICLETEXT"
|
---|
| 265 | ;S GT1(171.201221,"+1,1,5,1,",1)="THIRD NEW MED DIRECTION TEXT"
|
---|
| 266 | D CLEAN^DILF
|
---|
| 267 | D UPDATE^DIE("","C0CFDA","","ZERR")
|
---|
[1586] | 268 | I $D(ZERR) S $EC=",U1,"
|
---|
[1544] | 269 | K C0CFDA
|
---|
| 270 | Q
|
---|
| 271 | ;
|
---|
| 272 | VARPTR(ZVAR,ZTYP) ;EXTRINSIC WHICH RETURNS THE POINTER TO ZVAR IN THE
|
---|
| 273 | ; CCR DICTIONARY. IT IS LAYGO, AS IT WILL ADD THE VARIABLE TO
|
---|
| 274 | ; THE CCR DICTIONARY IF IT IS NOT THERE. ZTYP IS REQUIRED FOR LAYGO
|
---|
| 275 | ;
|
---|
| 276 | N ZCCRD,ZVARN,C0CFDA2
|
---|
| 277 | S ZCCRD=170 ; FILE NUMBER FOR CCR DICTIONARY
|
---|
| 278 | S ZVARN=$O(^C0CDIC(170,"B",ZVAR,"")) ;FIND IEN OF VARIABLE
|
---|
| 279 | I ZVARN="" D ; VARIABLE NOT IN CCR DICTIONARY - ADD IT
|
---|
| 280 | . I '$D(ZTYP) D Q ; WON'T ADD A VARIABLE WITHOUT A TYPE
|
---|
| 281 | . . W "CANNOT ADD VARIABLE WITHOUT A TYPE: ",ZVAR,!
|
---|
| 282 | . S C0CFDA2(ZCCRD,"?+1,",.01)=ZVAR ; NAME OF NEW VARIABLE
|
---|
| 283 | . S C0CFDA2(ZCCRD,"?+1,",12)=ZTYP ; TYPE EXTERNAL OF NEW VARIABLE
|
---|
| 284 | . D CLEAN^DILF ;MAKE SURE ERRORS ARE CLEAN
|
---|
| 285 | . D UPDATE^DIE("E","C0CFDA2","","ZERR") ;ADD VAR TO CCR DICTIONARY
|
---|
| 286 | . I $D(ZERR) D ; LAYGO ERROR
|
---|
| 287 | . . W "ERROR ADDING "_ZC0CI_" TO CCR DICTIONARY",!
|
---|
| 288 | . E D ;
|
---|
| 289 | . . D CLEAN^DILF ; CLEAN UP
|
---|
| 290 | . . S ZVARN=$O(^C0CDIC(170,"B",ZVAR,"")) ;FIND IEN OF VARIABLE
|
---|
| 291 | . . W "ADDED ",ZVAR," TO CCR DICTIONARY, IEN:",ZVARN,!
|
---|
| 292 | Q ZVARN
|
---|
| 293 | ;
|
---|
| 294 | BLDTYPS ; ROUTINE TO POPULATE THE CCR NODE TYPES FILE (^C0CDIC(170.101,)
|
---|
| 295 | ; THE CCR DICTIONARY (^C0CDIC(170, ) HAS MOST OF WHAT'S NEEDED
|
---|
| 296 | ;
|
---|
| 297 | N C0CDIC,C0CNODE ;
|
---|
| 298 | S C0CDIC=$$FILEREF^C0CRNF(170) ; CLOSED FILE REFERENCE TO THE CCR DICTIONARY
|
---|
| 299 | S C0CNODE=$$FILEREF^C0CRNF(170.101) ; CLOSED REF TO CCR NODE TYPE FILE
|
---|
| 300 | Q
|
---|
| 301 | ;
|
---|
| 302 | FIXSEC ;FIX THE SECTION FIELD OF THE CCR DICTIONARY.. IT HAS BEEN REDEFINED
|
---|
| 303 | ; AS A POINTER TO CCR NODE TYPE INSTEAD OF BEING A SET
|
---|
| 304 | ; THE SET VALUES ARE PRESERVED IN ^KBAI("SECTION") TO FACILITATE THIS
|
---|
| 305 | ; CONVERSION
|
---|
| 306 | ;N C0CC,C0CI,C0CJ,C0CN,C0CZX
|
---|
| 307 | D FIELDS^C0CRNF("C0CC",170)
|
---|
| 308 | S C0CI=""
|
---|
| 309 | F S C0CI=$O(^KBAI("SECTION",C0CI)) Q:C0CI="" D ; EACH SECTION
|
---|
| 310 | . S C0CZX=""
|
---|
| 311 | . F S C0CZX=$O(^KBAI("SECTION",C0CI,C0CZX)) Q:C0CZX="" D ; EACH VARIABLE
|
---|
| 312 | . . W "SECTION ",C0CI," VAR ",C0CZX
|
---|
| 313 | . . S C0CV=$O(^C0CDIC(170.101,"B",C0CI,""))
|
---|
| 314 | . . W " TYPE: ",C0CV,!
|
---|
| 315 | . . D SETFDA("SECTION",C0CV)
|
---|
| 316 | . . ;ZWR C0CFDA
|
---|
| 317 | Q
|
---|
| 318 | ;
|
---|
| 319 | SETFDA(C0CSN,C0CSV) ; INTERNAL ROUTINE TO MAKE AN FDA ENTRY FOR FIELD C0CSN
|
---|
| 320 | ; TO SET TO VALUE C0CSV.
|
---|
| 321 | ; C0CFDA,C0CC,C0CZX ARE ASSUMED FROM THE CALLING ROUTINE
|
---|
| 322 | ; C0CSN,C0CSV ARE PASSED BY VALUE
|
---|
| 323 | ;
|
---|
| 324 | N C0CSI,C0CSJ
|
---|
| 325 | S C0CSI=$$ZFILE(C0CSN,"C0CC") ; FILE NUMBER
|
---|
| 326 | S C0CSJ=$$ZFIELD(C0CSN,"C0CC") ; FIELD NUMBER
|
---|
| 327 | S C0CFDA(C0CSI,C0CZX_",",C0CSJ)=C0CSV
|
---|
| 328 | Q
|
---|
| 329 | ZFILE(ZFN,ZTAB) ; EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
|
---|
| 330 | ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 1 OF C0CA(ZFN)
|
---|
| 331 | ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
---|
| 332 | I '$D(ZTAB) S ZTAB="C0CA"
|
---|
| 333 | N ZR
|
---|
| 334 | I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",1)
|
---|
| 335 | E S ZR=""
|
---|
| 336 | Q ZR
|
---|
| 337 | ZFIELD(ZFN,ZTAB) ;EXTRINSIC TO RETURN FIELD NUMBER FOR FIELD NAME PASSED
|
---|
| 338 | ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 2 OF C0CA(ZFN)
|
---|
| 339 | ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
---|
| 340 | I '$D(ZTAB) S ZTAB="C0CA"
|
---|
| 341 | N ZR
|
---|
| 342 | I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",2)
|
---|
| 343 | E S ZR=""
|
---|
| 344 | Q ZR
|
---|
| 345 | ;
|
---|
| 346 | ZVALUE(ZFN,ZTAB) ;EXTRINSIC TO RETURN VALUE FOR FIELD NAME PASSED
|
---|
| 347 | ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 3 OF C0CA(ZFN)
|
---|
| 348 | ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
|
---|
| 349 | I '$D(ZTAB) S ZTAB="C0CA"
|
---|
| 350 | N ZR
|
---|
| 351 | I $D(@ZTAB@(ZFN)) S ZR=$P(@ZTAB@(ZFN),"^",3)
|
---|
| 352 | E S ZR=""
|
---|
| 353 | Q ZR
|
---|
| 354 | ;
|
---|