Changeset 300 for ccr


Ignore:
Timestamp:
Dec 6, 2008, 8:50:51 PM (16 years ago)
Author:
George Lilly
Message:

separate out C0CRNF from C0CDIC

Location:
ccr/trunk/p
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • ccr/trunk/p/C0CDIC.m

    r299 r300  
    9999 Q
    100100 ;
    101 FIELDS(C0CFRTN,C0CF) ; RETURNS AN ARRAY OF THE FIELDS IN FILE C0CF,
    102  ; C0CFRTN IS PASSED BY NAME, C0CF IS PASSED BY VALUE
    103  ;
    104  N C0CFI,C0CFJ ;INNER LOOP, OUTER LOOP
    105  N C0CFN ; FIELD NAME
    106  S C0CFI=0 S C0CFJ=C0CF
    107  K @C0CFRTN ; CLEAR THE RETURN ARRAY
    108  F  Q:C0CFJ'[C0CF  D ; FOR THE C0CF FILE AND ALL SUBFILES INCLUSIVE
    109  . ;W "1: "_C0CFJ," ",C0CFI,!
    110  . F  S C0CFI=$O(^DD(C0CFJ,C0CFI)) Q:+C0CFI=0  D  ; EVERY FIELD
    111  . . ;W "2: "_C0CFJ," ",C0CFI,!
    112  . . S C0CFN=$P(^DD(C0CFJ,C0CFI,0),"^",1) ;PULL FIELD NAME FROM ^DD
    113  . . ;W "N: ",C0CFN,!
    114  . . ;I C0CFN="STR" W C0CFN," ",C0CFJ,!
    115  . . I $D(@C0CFRTN@(C0CFN)) D  ; IS THIS A DUPLICATE?
    116  . . . W "DUPLICATE FOUND! ",C0CFJ," ",C0CFI," ",C0CFN,!,@C0CFRTN@(C0CFN),!
    117  . . . S @C0CFRTN@(C0CFN_"_"_C0CFJ)=C0CFJ_"^"_C0CFI
    118  . . E  S @C0CFRTN@(C0CFN)=C0CFJ_"^"_C0CFI
    119  . S C0CFJ=$O(^DD(C0CFJ)) ; NEXT SUBFILE
    120  Q
    121  ;
    122 GET(GRTN,GFILE,GIEN,GNN) ; RETURN THE DICTIONARY RECORD GIEN IN ARRAY GRTN, PASSED
    123  ; BY NAME
    124  ;
    125  N C0CTMP,C0CI,C0CJ,C0CREF,C0CNAME
    126  I $D(GNN) I GNN="ALL" S C0CNN=0 ; NOT NON-NULL (ALL FIELDS TO BE RETURNED)
    127  E  S C0CNN=1 ; NON-NULL IS TRUE (ONLY POPULATED FIELDS RETURNED)
    128  S C0CREF=GIEN_"," ; OPEN ROOT REFERENCE INTO FILE
    129  D CLEAN^DILF ; MAKE SURE WE ARE CLEANED UP
    130  D GETS^DIQ(GFILE,C0CREF,"**","","C0CTMP")
    131  D FIELDS(GRTN,GFILE) ;GET ALL THE FIELD NAMES FOR THE FILE
    132  S (C0CI,C0CJ)=""
    133  F  S C0CJ=$O(C0CTMP(C0CJ)) Q:C0CJ=""  D  ; FOR ALL SUBFILES
    134  . S C0CREF=$O(C0CTMP(C0CJ,"")) ; RECORD REFERENCE
    135  . F  S C0CI=$O(C0CTMP(C0CJ,C0CREF,C0CI)) Q:C0CI=""  D  ; ARRAY OF FIELDS
    136  . . ;W C0CJ," ",C0CI,!
    137  . . S C0CNAME=$P(^DD(C0CJ,C0CI,0),"^",1) ;PULL THE FIELD NAME
    138  . . S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI) ;
    139  . . I C0CVALUE["C0CTMP" S C0CVALUE=C0CTMP(C0CJ,C0CREF,C0CI,1) ;1ST LINE OF WP
    140  . . S $P(@GRTN@(C0CNAME),"^",3)=C0CVALUE ;RETURN VALUE IN P3
    141  I C0CNN D  ; IF ONLY NON-NULL VALUES ARE TO BE RETURNED
    142  . S C0CI=""
    143  . F  S C0CI=$O(@GRTN@(C0CI)) Q:C0CI=""  D  ; GO THROUGH THE WHOLE ARRAY
    144  . . I $P(@GRTN@(C0CI),"^",3)="" K @GRTN@(C0CI) ; KILL THE NULL ENTRIES
    145  Q
    146  ;
    147 GETALL(GARFLD,GARVAL,GAFILE,GACNT,GASTRT,GANN) ; RETURN FIELD MAP AND VALUES
    148  ; GARFLD, PASSED BY NAME, RETURNS FIELD MAP @GARFLD@("FIELDNAME")
    149  ; .. ANY FIELD USED BY ANY RECORD PROCESSED IS IN THE FIELD MAP
    150  ; .. GARFLD IS NOT INITIALIZED, SO MULTIPLE CALLS ARE CUMULATIVE
    151  ; .. IF GANN="ALL" THEN ALL FIELDS FOR THE FILE ARE IN THE FIELD MAP
    152  ; GARVAL, PASSED BY NAME, RETURNS VALUES AS @GARVAL@(IEN,"FIELDNAME")=VALUE
    153  ; .. FOR EVERY RECORD PROCESSED. IT IS NOT INITIALEZED SO IT IS CUMMULATIVE
    154  ; .. EVEN IF GANN="ALL" ONLY POPULATED FIELDS ARE RETURNED IN GARVAL
    155  ; .. NUL FIELDS CAN BE DETERMINED BY CHECKING GARFLD - THIS SAVES SPACE
    156  ; GARFILE IS THE FILE NUMBER TO BE PROCESSED. IT IS PASSED BY VALUE
    157  ; GARCNT IS THE NUMBER OF RECORDS TO PROCESS. IT IS PASSED BY VALUE
    158  ; .. IF GARCNT IS NULL, ALL RECORDS ARE PROCESSED
    159  ; GARSTRT IS THE IEN OF THE FIRST RECORD TO PROCESS. IT IS PASSED BY VALUE
    160  ; .. IF GARSTART IS NULL, PROCESSING STARTS AT THE FIRST RECORD
    161  ; GANN= NOT NULL - IF GANN IS "ALL" THEN EVEN NULL FIELDS WILL BE RETURNED
    162  ; OTHERWISE, ONLY POPULATED FIELDS ARE RETURNED IN GARFLD AND GARVAL
    163  N GATMP,GAI,GAF
    164  S GAF=^DIC(GAFILE,0,"GL") ;OPEN ROOT TO FILE
    165  S GAF=$P(GAF,",",1)_")" ; CLOSE THE ROOT
    166  W $O(@GAF@(0)) ;
    167  S GAI=0 ;ITERATOR
    168  ; F  S GAI=$O(@GAF@
    169  Q
    170  ;
    171101INIT ; INITIALIZE CCR DICTIONARY BASED ON VARIABLE NAMES
    172102 ;
     
    192122 . ;W C0CZX,!
    193123 . K C0CA,C0CN ; CLEAR OUT THE LAST ONE
    194  . D GET("C0CA",170,C0CZX,"ALL") ; GET VARIABLE HASH
     124 . D GET^C0CRNF("C0CA",170,C0CZX,"ALL") ; GET VARIABLE HASH
    195125 . ;ZWR C0CA B ;
    196126 . S C0CN=$$ZVALUE("VARIABLE") ;NAME OF THE VARIABLE
     
    237167 ;
    238168 N C0CSI,C0CSJ
    239  S C0CSI=$$ZFILE(C0CSN) ; FILE NUMBER
    240  S C0CSJ=$$ZFIELD(C0CSN) ; FIELD NUMBER
     169 S C0CSI=$$ZFILE(C0CSN,"C0CA") ; FILE NUMBER
     170 S C0CSJ=$$ZFIELD(C0CSN,"C0CA") ; FIELD NUMBER
    241171 S C0CFDA(C0CZX,C0CSI,C0CZX_",",C0CSJ)=C0CSV
    242172 Q
    243 ZFILE(ZFN) ; INTERNAL EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
     173ZFILE(ZFN,ZTAB) ; EXTRINSIC TO RETURN FILE NUMBER FOR FIELD NAME PASSED
    244174 ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 1 OF C0CA(ZFN)
    245  Q $P(C0CA(ZFN),"^",1)
    246 ZFIELD(ZFN) ;INTERNAL EXTRINSIC TO RETURN FIELD NUMBER FOR FIELD NAME PASSED
     175 ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
     176 I '$D(ZTAB) S ZTAB="C0CA"
     177 Q $P(@ZTAB@(ZFN),"^",1)
     178ZFIELD(ZFN,ZTAB) ;EXTRINSIC TO RETURN FIELD NUMBER FOR FIELD NAME PASSED
    247179 ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 2 OF C0CA(ZFN)
    248  Q $P(C0CA(ZFN),"^",2)
    249 ZVALUE(ZFN) ;INTERNAL EXTRINSIC TO RETURN VALUE FOR FIELD NAME PASSED
     180 ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
     181 I '$D(ZTAB) S ZTAB="C0CA"
     182 Q $P(@ZTAB@(ZFN),"^",2)
     183ZVALUE(ZFN,ZTAB) ;EXTRINSIC TO RETURN VALUE FOR FIELD NAME PASSED
    250184 ; BY VALUE IN ZFN. FILE NUMBER IS PIECE 3 OF C0CA(ZFN)
    251  Q $P(C0CA(ZFN),"^",3)
     185 ; IF ZTAB IS NULL, IT DEFAULTS TO C0CA
     186 I '$D(ZTAB) S ZTAB="C0CA"
     187 Q $P(@ZTAB@(ZFN),"^",3)
    252188 ;
Note: See TracChangeset for help on using the changeset viewer.