DG53478I ; SLC/PKR - Create cross-references for clinical reminder index. ;10/12/2004
       ;;5.3;Registration;**478**;Aug 13, 1993
 ;
 Q
 ;===============================================================
CDGPTXR ;Create all the cross-references.
 D CDGPT0
 D CDGPT9
 D CHLOC
 Q
 ;
 ;===============================================================
CDGPT0 ;Create cross-references for PTF ICD0 data.
 ;For node 401 surgery node:
 ;ICD0 from nodes: 45.01,8; 45.01,9; 45.01,10; 45.01,11; 45.01,12
 ;For node 601, procedure node:
 ;ICD0 from nodes: 45.05,4; 45.05,5; 45.05,6; 45.05,7; 45.05,8
 N IND,MSG,NAME,NODE,NODENUM,RESULT,XREF
 D BMES^XPDUTL("Creating PTF ICD0 cross-references.")
 ;Set the XREF nodes that are the same for all cross-references.
 S XREF("FILE")=45
 S XREF("WHOLE KILL")="K ^PXRMINDX(45,""ICD0"")"
 S XREF("TYPE")="MU"
 S XREF("SHORT DESCR")="Clinical Reminders index for ICD0 lookup."
 S XREF("DESCR",1)="This cross-reference builds two indexes, one for finding"
 S XREF("DESCR",2)="all patients with a particular ICD0 code and one for finding all"
 S XREF("DESCR",3)="the ICD0 codes a patient has."
 S XREF("DESCR",4)="The indexes are stored in the Clinical Reminders index global as:"
 S XREF("DESCR",5)=" ^PXRMINDX(45,""ICD0"",""INP"",ICD0,NODE,DFN,DATE,DAS) and"
 S XREF("DESCR",6)=" ^PXRMINDX(45,""ICD0"",""PNI"",DFN,NODE,ICD0,DATE,DAS)"
 S XREF("DESCR",7)="respectively. DATE is the surgery/procedure date."
 S XREF("USE")="ACTION"
 S XREF("EXECUTION")="R"
 S XREF("ACTIVITY")="IR"
 ;
 ;These XREF nodes change for each cross-reference.
 S XREF("ROOT FILE")=45.01
 S XREF("VAL",1)=.01
 S XREF("VAL",1,"SUBSCRIPT")=1
 S XREF("VAL",2,"SUBSCRIPT")=2
 S IND=0
 S NODE="S"
 S XREF("DESCR",8)="NODE is S followed by code number. For example,"
 S XREF("DESCR",10)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 F NODENUM=8,9,10,11,12 D
 . S IND=IND+1
 . S XREF("DESCR",9)=NODE_IND_" means it was found on the S node and it was operation code "_IND_"."
 . S NAME="ACR0S"_IND
 . S XREF("NAME")=NAME
 . S XREF("VAL",2)=NODENUM
 . S XREF("SET")="D SDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 . S XREF("KILL")="D KDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 . D CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 . I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;
 S XREF("ROOT FILE")=45.05
 S XREF("VAL",1)=.01
 S XREF("VAL",1,"SUBSCRIPT")=1
 S XREF("VAL",2,"SUBSCRIPT")=2
 S IND=0
 S NODE="P"
 S XREF("DESCR",8)="NODE is S followed by code number. For example,"
 S XREF("DESCR",10)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 F NODENUM=4,5,6,7,8 D
 . S IND=IND+1
 . S XREF("DESCR",9)=NODE_IND_" means it was found on the P node and it was operation code "_IND_"."
 . S NAME="ACR0P"_IND
 . S XREF("NAME")=NAME
 . S XREF("VAL",2)=NODENUM
 . S XREF("SET")="D SDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 . S XREF("KILL")="D KDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 . D CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 . I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 Q
 ;
 ;===============================================================
CDGPT9 ;Create cross-references for PTF ICD9 data.
 ;ICD9 from nodes: 45,79; 45,80; 45,79.16 45,79.17; 45,79.18;
 ;45,79.19; 45,79.201; 45,79.21; 45,79.22; 45,79.22; 45.79.23;
 ;45,79.24; 45,79.241; 45,79.242; 45,79.243; 45,79.244
 ;By name these nodes are: DXLS, PRINCIPAL DIAGNOSIS, SECONDARY
 ;DIAGNOSIS 1, through SECONDARY DIAGNOSIS 12.
 N IND,MSG,NAME,NODE,RESULT,XREF
 D BMES^XPDUTL("Creating PTF ICD9 cross-references.")
 ;Set the XREF nodes that are the same for all cross-references.
 S XREF("FILE")=45
 S XREF("ROOT FILE")=45
 S XREF("WHOLE KILL")="K ^PXRMINDX(45)"
 S XREF("TYPE")="MU"
 S XREF("SHORT DESCR")="Clinical Reminders index for ICD9 lookup."
 S XREF("DESCR",1)="This cross-reference builds two indexes, one for finding"
 S XREF("DESCR",2)="all patients with a particular ICD9 code and one for finding all"
 S XREF("DESCR",3)="the ICD9 codes a patient has."
 S XREF("DESCR",4)="The indexes are stored in the Clinical Reminders index global as:"
 S XREF("DESCR",5)=" ^PXRMINDX(45,""ICD9"",""INP"",ICD9,NAME,DFN,DATE,DAS) and"
 S XREF("DESCR",6)=" ^PXRMINDX(45,""ICD9"",""PNI"",DFN,NAME,ICD9,DATE,DAS)"
 S XREF("DESCR",7)="respectively. DATE is the discharge date. If it does not"
 S XREF("DESCR",8)="exist then the admission date is used."
 S XREF("EXECUTION")="R"
 S XREF("ACTIVITY")="IR"
 S XREF("VAL",1)=.01
 S XREF("VAL",1,"SUBSCRIPT")=1
 S XREF("VAL",2)=2
 S XREF("VAL",2,"SUBSCRIPT")=2
 S XREF("VAL",3)=11
 S XREF("VAL",3,"SUBSCRIPT")=3
 S XREF("VAL",5)=70
 ;
 ;These XREF nodes change for each cross-reference.
 S XREF("DESCR",9)="NAME is the name of the ICD9 code field. An example is DXLS."
 S XREF("DESCR",10)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 S XREF("DESCR",11)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 S XREF("NAME")="ACR9DXLS"
 S XREF("VAL",4)=79
 S XREF("VAL",4,"SUBSCRIPT")=4
 S XREF("SET")="D SDGPT9D^DGPTDDCR(.X,.DA,""DXLS"")"
 S XREF("KILL")="D KDGPT9D^DGPTDDCR(.X,.DA,""DXLS"")"
 D CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;
 S XREF("DESCR",9)="NAME is the name of the ICD9 code field. An example is PDX."
 S XREF("DESCR",10)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 S XREF("DESCR",11)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 S XREF("NAME")="ACR9PDX"
 S XREF("VAL",4)=80
 S XREF("VAL",4,"SUBSCRIPT")=4
 S XREF("SET")="D SDGPT9D^DGPTDDCR(.X,.DA,""PDX"")"
 S XREF("KILL")="D KDGPT9D^DGPTDDCR(.X,.DA,""PDX"")"
 D CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;
 ;Remove the cross-references using the original names (this applies to
 ;test sites).
 S IND=1
 F FIELD=79.16,79.17,79.18,79.19,79.201,79.21,79.22,79.23,79.24 D
 . S IND=IND+1
 . S NAME="ACR9DICD"_IND
 . D DELIXN^DDMOD(45,NAME,"","","MSG")
 . I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;Remove ACR9DSD14, it was created in error.
 D DELIXN^DDMOD(45,"ACR9DSD14","","","MSG")
 I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;
 S IND=0
 F FIELD=79.16,79.17,79.18,79.19,79.201,79.21,79.22,79.23,79.24,79.241,79.242,79.243,79.244 D
 . S IND=IND+1
 . S XREF("DESCR",9)="NAME is the name of the ICD9 code field. An example is D SD"_IND_", where D SD tells us it is a discharge secondary diagnosis."
 . S XREF("DESCR",10)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 . S XREF("DESCR",11)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 . S NAME="SD"_IND
 . S NODE="D "_NAME
 . S XREF("NAME")="ACR9D"_NAME
 . S XREF("VAL",4)=FIELD
 . S XREF("VAL",4,"SUBSCRIPT")=4
 . S XREF("SET")="D SDGPT9D^DGPTDDCR(.X,.DA,"""_NODE_""")"
 . S XREF("KILL")="D KDGPT9D^DGPTDDCR(.X,.DA,"""_NODE_""")"
 . D CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 . I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;
 ;Add the movement nodes.
 K XREF("VAL")
 S XREF("ROOT FILE")=45.02
 S XREF("VAL",1)=10
 S XREF("VAL",1,"SUBSCRIPT")=1
 S XREF("DESCR",7)="respectively. DATE is movement date."
 K XREF("DESCR",8),XREF("DESCR",9),XREF("DESCR",10),XREF("DESCR",11)
 S XREF("DESCR",9)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 S XREF("DESCR",10)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 S IND=0
 F FIELD=5,6,7,8,9,11,12,13,14,15 D
 . S IND=IND+1
 . S XREF("DESCR",8)="NAME is the name of the ICD9 code field. An example is M ICD"_IND_", where M tells us it is a movement diagnosis."
 . S NAME="ICD"_IND
 . S NODE="M "_NAME
 . S XREF("NAME")="ACR9M"_NAME
 . S XREF("VAL",2)=FIELD
 . S XREF("VAL",2,"SUBSCRIPT")=2
 . S XREF("SET")="D SDGPT9M^DGPTDDCR(.X,.DA,"""_NODE_""")"
 . S XREF("KILL")="D KDGPT9M^DGPTDDCR(.X,.DA,"""_NODE_""")"
 . D CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 . I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 Q
 ;
 ;===============================================================
CHLOC ;Create cross-references for Hospital Location.
 N MSG,RESULT,XREF
 D BMES^XPDUTL("Creating Hospital Location cross-references.")
 S XREF("FILE")=44
 S XREF("ROOT FILE")=44
 S XREF("TYPE")="R"
 S XREF("USE")="SORTING ONLY"
 S XREF("EXECUTION")="F"
 S XREF("ACTIVITY")="IR"
 S XREF("SHORT DESCR")="Index credit stop codes"
 S XREF("DESCR",1)="This index can be used to find all hospital locations in a"
 S XREF("DESCR",2)="credit stop code."
 S XREF("WHOLE KILL")="K ^SC(""ACST"")"
 S XREF("VAL",1)=2503
 S XREF("VAL",1,"SUBSCRIPT")=1
 S XREF("NAME")="ACST"
 S XREF("SET")="S ^SC(""ACST"",X,DA)"
 S XREF("KILL")="K ^SC(""ACST"",X,DA)"
 D CREIXN^DDMOD(.XREF,"kS",.RESULT,"","MSG")
 I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;
 S XREF("SHORT DESCR")="Index stop codes"
 S XREF("DESCR",1)="This index can be used to find all hospital locations in a"
 S XREF("DESCR",2)="stop code."
 S XREF("WHOLE KILL")="K ^SC(""AST"")"
 S XREF("VAL",1)=8
 S XREF("VAL",1,"SUBSCRIPT")=1
 S XREF("NAME")="AST"
 S XREF("SET")="S ^SC(""AST"",X,DA)"
 S XREF("KILL")="K ^SC(""AST"",X,DA)"
 K MSG
 D CREIXN^DDMOD(.XREF,"kS",.RESULT,"","MSG")
 I RESULT="" D DCERRMSG^PXRMP12I(.MSG,.XREF)
 ;Eliminate the original CST and ST indexes.
 D DELIXN^DDMOD(44,"CST")
 D DELIXN^DDMOD(44,"ST")
 K ^SC("CST")
 K ^SC("ST")
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDG53478I   9604     printed  Sep 23, 2025@20:13:27                                                                                                                                                                                                    Page 2
DG53478I  ; SLC/PKR - Create cross-references for clinical reminder index. ;10/12/2004
 +1       ;;5.3;Registration;**478**;Aug 13, 1993
 +2       ;
 +3        QUIT 
 +4       ;===============================================================
CDGPTXR   ;Create all the cross-references.
 +1        DO CDGPT0
 +2        DO CDGPT9
 +3        DO CHLOC
 +4        QUIT 
 +5       ;
 +6       ;===============================================================
CDGPT0    ;Create cross-references for PTF ICD0 data.
 +1       ;For node 401 surgery node:
 +2       ;ICD0 from nodes: 45.01,8; 45.01,9; 45.01,10; 45.01,11; 45.01,12
 +3       ;For node 601, procedure node:
 +4       ;ICD0 from nodes: 45.05,4; 45.05,5; 45.05,6; 45.05,7; 45.05,8
 +5        NEW IND,MSG,NAME,NODE,NODENUM,RESULT,XREF
 +6        DO BMES^XPDUTL("Creating PTF ICD0 cross-references.")
 +7       ;Set the XREF nodes that are the same for all cross-references.
 +8        SET XREF("FILE")=45
 +9        SET XREF("WHOLE KILL")="K ^PXRMINDX(45,""ICD0"")"
 +10       SET XREF("TYPE")="MU"
 +11       SET XREF("SHORT DESCR")="Clinical Reminders index for ICD0 lookup."
 +12       SET XREF("DESCR",1)="This cross-reference builds two indexes, one for finding"
 +13       SET XREF("DESCR",2)="all patients with a particular ICD0 code and one for finding all"
 +14       SET XREF("DESCR",3)="the ICD0 codes a patient has."
 +15       SET XREF("DESCR",4)="The indexes are stored in the Clinical Reminders index global as:"
 +16       SET XREF("DESCR",5)=" ^PXRMINDX(45,""ICD0"",""INP"",ICD0,NODE,DFN,DATE,DAS) and"
 +17       SET XREF("DESCR",6)=" ^PXRMINDX(45,""ICD0"",""PNI"",DFN,NODE,ICD0,DATE,DAS)"
 +18       SET XREF("DESCR",7)="respectively. DATE is the surgery/procedure date."
 +19       SET XREF("USE")="ACTION"
 +20       SET XREF("EXECUTION")="R"
 +21       SET XREF("ACTIVITY")="IR"
 +22      ;
 +23      ;These XREF nodes change for each cross-reference.
 +24       SET XREF("ROOT FILE")=45.01
 +25       SET XREF("VAL",1)=.01
 +26       SET XREF("VAL",1,"SUBSCRIPT")=1
 +27       SET XREF("VAL",2,"SUBSCRIPT")=2
 +28       SET IND=0
 +29       SET NODE="S"
 +30       SET XREF("DESCR",8)="NODE is S followed by code number. For example,"
 +31       SET XREF("DESCR",10)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 +32       FOR NODENUM=8,9,10,11,12
               Begin DoDot:1
 +33               SET IND=IND+1
 +34               SET XREF("DESCR",9)=NODE_IND_" means it was found on the S node and it was operation code "_IND_"."
 +35               SET NAME="ACR0S"_IND
 +36               SET XREF("NAME")=NAME
 +37               SET XREF("VAL",2)=NODENUM
 +38               SET XREF("SET")="D SDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 +39               SET XREF("KILL")="D KDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 +40               DO CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 +41               IF RESULT=""
                       DO DCERRMSG^PXRMP12I(.MSG,.XREF)
               End DoDot:1
 +42      ;
 +43       SET XREF("ROOT FILE")=45.05
 +44       SET XREF("VAL",1)=.01
 +45       SET XREF("VAL",1,"SUBSCRIPT")=1
 +46       SET XREF("VAL",2,"SUBSCRIPT")=2
 +47       SET IND=0
 +48       SET NODE="P"
 +49       SET XREF("DESCR",8)="NODE is S followed by code number. For example,"
 +50       SET XREF("DESCR",10)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 +51       FOR NODENUM=4,5,6,7,8
               Begin DoDot:1
 +52               SET IND=IND+1
 +53               SET XREF("DESCR",9)=NODE_IND_" means it was found on the P node and it was operation code "_IND_"."
 +54               SET NAME="ACR0P"_IND
 +55               SET XREF("NAME")=NAME
 +56               SET XREF("VAL",2)=NODENUM
 +57               SET XREF("SET")="D SDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 +58               SET XREF("KILL")="D KDGPT0^DGPTDDCR(.X,.DA,"""_NODE_""","_IND_")"
 +59               DO CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 +60               IF RESULT=""
                       DO DCERRMSG^PXRMP12I(.MSG,.XREF)
               End DoDot:1
 +61       QUIT 
 +62      ;
 +63      ;===============================================================
CDGPT9    ;Create cross-references for PTF ICD9 data.
 +1       ;ICD9 from nodes: 45,79; 45,80; 45,79.16 45,79.17; 45,79.18;
 +2       ;45,79.19; 45,79.201; 45,79.21; 45,79.22; 45,79.22; 45.79.23;
 +3       ;45,79.24; 45,79.241; 45,79.242; 45,79.243; 45,79.244
 +4       ;By name these nodes are: DXLS, PRINCIPAL DIAGNOSIS, SECONDARY
 +5       ;DIAGNOSIS 1, through SECONDARY DIAGNOSIS 12.
 +6        NEW IND,MSG,NAME,NODE,RESULT,XREF
 +7        DO BMES^XPDUTL("Creating PTF ICD9 cross-references.")
 +8       ;Set the XREF nodes that are the same for all cross-references.
 +9        SET XREF("FILE")=45
 +10       SET XREF("ROOT FILE")=45
 +11       SET XREF("WHOLE KILL")="K ^PXRMINDX(45)"
 +12       SET XREF("TYPE")="MU"
 +13       SET XREF("SHORT DESCR")="Clinical Reminders index for ICD9 lookup."
 +14       SET XREF("DESCR",1)="This cross-reference builds two indexes, one for finding"
 +15       SET XREF("DESCR",2)="all patients with a particular ICD9 code and one for finding all"
 +16       SET XREF("DESCR",3)="the ICD9 codes a patient has."
 +17       SET XREF("DESCR",4)="The indexes are stored in the Clinical Reminders index global as:"
 +18       SET XREF("DESCR",5)=" ^PXRMINDX(45,""ICD9"",""INP"",ICD9,NAME,DFN,DATE,DAS) and"
 +19       SET XREF("DESCR",6)=" ^PXRMINDX(45,""ICD9"",""PNI"",DFN,NAME,ICD9,DATE,DAS)"
 +20       SET XREF("DESCR",7)="respectively. DATE is the discharge date. If it does not"
 +21       SET XREF("DESCR",8)="exist then the admission date is used."
 +22       SET XREF("EXECUTION")="R"
 +23       SET XREF("ACTIVITY")="IR"
 +24       SET XREF("VAL",1)=.01
 +25       SET XREF("VAL",1,"SUBSCRIPT")=1
 +26       SET XREF("VAL",2)=2
 +27       SET XREF("VAL",2,"SUBSCRIPT")=2
 +28       SET XREF("VAL",3)=11
 +29       SET XREF("VAL",3,"SUBSCRIPT")=3
 +30       SET XREF("VAL",5)=70
 +31      ;
 +32      ;These XREF nodes change for each cross-reference.
 +33       SET XREF("DESCR",9)="NAME is the name of the ICD9 code field. An example is DXLS."
 +34       SET XREF("DESCR",10)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 +35       SET XREF("DESCR",11)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 +36       SET XREF("NAME")="ACR9DXLS"
 +37       SET XREF("VAL",4)=79
 +38       SET XREF("VAL",4,"SUBSCRIPT")=4
 +39       SET XREF("SET")="D SDGPT9D^DGPTDDCR(.X,.DA,""DXLS"")"
 +40       SET XREF("KILL")="D KDGPT9D^DGPTDDCR(.X,.DA,""DXLS"")"
 +41       DO CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 +42       IF RESULT=""
               DO DCERRMSG^PXRMP12I(.MSG,.XREF)
 +43      ;
 +44       SET XREF("DESCR",9)="NAME is the name of the ICD9 code field. An example is PDX."
 +45       SET XREF("DESCR",10)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 +46       SET XREF("DESCR",11)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 +47       SET XREF("NAME")="ACR9PDX"
 +48       SET XREF("VAL",4)=80
 +49       SET XREF("VAL",4,"SUBSCRIPT")=4
 +50       SET XREF("SET")="D SDGPT9D^DGPTDDCR(.X,.DA,""PDX"")"
 +51       SET XREF("KILL")="D KDGPT9D^DGPTDDCR(.X,.DA,""PDX"")"
 +52       DO CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 +53       IF RESULT=""
               DO DCERRMSG^PXRMP12I(.MSG,.XREF)
 +54      ;
 +55      ;Remove the cross-references using the original names (this applies to
 +56      ;test sites).
 +57       SET IND=1
 +58       FOR FIELD=79.16,79.17,79.18,79.19,79.201,79.21,79.22,79.23,79.24
               Begin DoDot:1
 +59               SET IND=IND+1
 +60               SET NAME="ACR9DICD"_IND
 +61               DO DELIXN^DDMOD(45,NAME,"","","MSG")
 +62               IF RESULT=""
                       DO DCERRMSG^PXRMP12I(.MSG,.XREF)
               End DoDot:1
 +63      ;Remove ACR9DSD14, it was created in error.
 +64       DO DELIXN^DDMOD(45,"ACR9DSD14","","","MSG")
 +65       IF RESULT=""
               DO DCERRMSG^PXRMP12I(.MSG,.XREF)
 +66      ;
 +67       SET IND=0
 +68       FOR FIELD=79.16,79.17,79.18,79.19,79.201,79.21,79.22,79.23,79.24,79.241,79.242,79.243,79.244
               Begin DoDot:1
 +69               SET IND=IND+1
 +70               SET XREF("DESCR",9)="NAME is the name of the ICD9 code field. An example is D SD"_IND_", where D SD tells us it is a discharge secondary diagnosis."
 +71               SET XREF("DESCR",10)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 +72               SET XREF("DESCR",11)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 +73               SET NAME="SD"_IND
 +74               SET NODE="D "_NAME
 +75               SET XREF("NAME")="ACR9D"_NAME
 +76               SET XREF("VAL",4)=FIELD
 +77               SET XREF("VAL",4,"SUBSCRIPT")=4
 +78               SET XREF("SET")="D SDGPT9D^DGPTDDCR(.X,.DA,"""_NODE_""")"
 +79               SET XREF("KILL")="D KDGPT9D^DGPTDDCR(.X,.DA,"""_NODE_""")"
 +80               DO CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 +81               IF RESULT=""
                       DO DCERRMSG^PXRMP12I(.MSG,.XREF)
               End DoDot:1
 +82      ;
 +83      ;Add the movement nodes.
 +84       KILL XREF("VAL")
 +85       SET XREF("ROOT FILE")=45.02
 +86       SET XREF("VAL",1)=10
 +87       SET XREF("VAL",1,"SUBSCRIPT")=1
 +88       SET XREF("DESCR",7)="respectively. DATE is movement date."
 +89       KILL XREF("DESCR",8),XREF("DESCR",9),XREF("DESCR",10),XREF("DESCR",11)
 +90       SET XREF("DESCR",9)="If the TYPE OF RECORD is CENSUS then the entry is not indexed."
 +91       SET XREF("DESCR",10)="For all the details, see the Clinical Reminders Index Technical Guide/Programmer's Manual."
 +92       SET IND=0
 +93       FOR FIELD=5,6,7,8,9,11,12,13,14,15
               Begin DoDot:1
 +94               SET IND=IND+1
 +95               SET XREF("DESCR",8)="NAME is the name of the ICD9 code field. An example is M ICD"_IND_", where M tells us it is a movement diagnosis."
 +96               SET NAME="ICD"_IND
 +97               SET NODE="M "_NAME
 +98               SET XREF("NAME")="ACR9M"_NAME
 +99               SET XREF("VAL",2)=FIELD
 +100              SET XREF("VAL",2,"SUBSCRIPT")=2
 +101              SET XREF("SET")="D SDGPT9M^DGPTDDCR(.X,.DA,"""_NODE_""")"
 +102              SET XREF("KILL")="D KDGPT9M^DGPTDDCR(.X,.DA,"""_NODE_""")"
 +103              DO CREIXN^DDMOD(.XREF,"k",.RESULT,"","MSG")
 +104              IF RESULT=""
                       DO DCERRMSG^PXRMP12I(.MSG,.XREF)
               End DoDot:1
 +105      QUIT 
 +106     ;
 +107     ;===============================================================
CHLOC     ;Create cross-references for Hospital Location.
 +1        NEW MSG,RESULT,XREF
 +2        DO BMES^XPDUTL("Creating Hospital Location cross-references.")
 +3        SET XREF("FILE")=44
 +4        SET XREF("ROOT FILE")=44
 +5        SET XREF("TYPE")="R"
 +6        SET XREF("USE")="SORTING ONLY"
 +7        SET XREF("EXECUTION")="F"
 +8        SET XREF("ACTIVITY")="IR"
 +9        SET XREF("SHORT DESCR")="Index credit stop codes"
 +10       SET XREF("DESCR",1)="This index can be used to find all hospital locations in a"
 +11       SET XREF("DESCR",2)="credit stop code."
 +12       SET XREF("WHOLE KILL")="K ^SC(""ACST"")"
 +13       SET XREF("VAL",1)=2503
 +14       SET XREF("VAL",1,"SUBSCRIPT")=1
 +15       SET XREF("NAME")="ACST"
 +16       SET XREF("SET")="S ^SC(""ACST"",X,DA)"
 +17       SET XREF("KILL")="K ^SC(""ACST"",X,DA)"
 +18       DO CREIXN^DDMOD(.XREF,"kS",.RESULT,"","MSG")
 +19       IF RESULT=""
               DO DCERRMSG^PXRMP12I(.MSG,.XREF)
 +20      ;
 +21       SET XREF("SHORT DESCR")="Index stop codes"
 +22       SET XREF("DESCR",1)="This index can be used to find all hospital locations in a"
 +23       SET XREF("DESCR",2)="stop code."
 +24       SET XREF("WHOLE KILL")="K ^SC(""AST"")"
 +25       SET XREF("VAL",1)=8
 +26       SET XREF("VAL",1,"SUBSCRIPT")=1
 +27       SET XREF("NAME")="AST"
 +28       SET XREF("SET")="S ^SC(""AST"",X,DA)"
 +29       SET XREF("KILL")="K ^SC(""AST"",X,DA)"
 +30       KILL MSG
 +31       DO CREIXN^DDMOD(.XREF,"kS",.RESULT,"","MSG")
 +32       IF RESULT=""
               DO DCERRMSG^PXRMP12I(.MSG,.XREF)
 +33      ;Eliminate the original CST and ST indexes.
 +34       DO DELIXN^DDMOD(44,"CST")
 +35       DO DELIXN^DDMOD(44,"ST")
 +36       KILL ^SC("CST")
 +37       KILL ^SC("ST")
 +38       QUIT 
 +39      ;