Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: HDIZRT

HDIZRT.m

Go to the documentation of this file.
HDIZRT ;PBB/ - GENERIC UTILITY FOR MFN  MD5 and Discovery processing
 ;;1.0;HEALTH DATA & INFORMATICS;**19,21**;Feb 22, 2005;Build 9
 ;
 Q
DESC ; Discovery coding to get conversion to escape characters..
 N II,CNT,CNT1,VAL,VAL1
 S CNT=0,(VAL,VAL1)=""
 F  S CNT=$O(^TMP("HLA",$J,CNT)) Q:'CNT  S II=$G(^TMP("HLA",$J,CNT)) Q:'$L(II)  Q:$G(ERROR)  D:$P(II,HLFS)="ZRT"
 .S VAL=$P(II,HLFS,3)
 .Q:'$L(VAL) 
 .S VAL=$$ESC(VAL,.HL)
 .S $P(II,HLFS,3)=VAL
 .S ^TMP("HLA",$J,CNT)=II
 .D:$O(^TMP("HLA",$J,CNT,0))
 ..S CNT1=0 F  S CNT1=$O(^TMP("HLA",$J,CNT,CNT1)) Q:'CNT1  D
 ...S VAL=$G(^TMP("HLA",$J,CNT,CNT1))
 ...S ^TMP("HLA",$J,CNT,CNT1)=$$ESC(VAL,.HL)
 Q
ESC(VALUE,HL) ;Escape value
 N ESC,ESCFS,ESCCMP,ESCSUB,ESCREP,ESCESC,ESCSEQ,CVRT
 S ESC=$E(HL("ECH"),3)
 S ESCFS=ESC_"F"_ESC S CVRT("ESCFS")=HL("FS")
 S ESCCMP=ESC_"S"_ESC S CVRT("ESCCMP")=$E(HL("ECH"),1)
 S ESCREP=ESC_"R"_ESC S CVRT("ESCREP")=$E(HL("ECH"),2)
 S ESCESC=ESC_"E"_ESC S CVRT("ESCESC")=ESC
 S ESCSUB=ESC_"T"_ESC S CVRT("ESCSUB")=$E(HL("ECH"),4)
 ;F ESCSEQ="ESCFS","ESCCMP","ESCSUB","ESCREP","ESCESC" D
 F ESCSEQ="ESCFS","ESCCMP","ESCSUB","ESCREP" D
 .F  Q:VALUE'[CVRT(ESCSEQ)  D
 ..S VALUE=$P(VALUE,CVRT(ESCSEQ))_@ESCSEQ_$P(VALUE,CVRT(ESCSEQ),2,9999)
 Q VALUE