source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/XUMF5II.m@ 824

Last change on this file since 824 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1XUMF5II ;ISS/PAVEL - XUMF5 MD5 Hash Entry point ;5/9/06 11:01
2 ;;8.0;KERNEL;**407**;July 10, 1995;Build 8
3 ;
4 ;MD5 based on info from 4.005 SORT BY VUID
5 ;
6 Q
7INIT ;
8 K ^TMP("PROOT",$J) ;ROOT of file in the case of pointer...
9 K ^TMP("UNIQUE",$J) ; Global of unique Values
10 N X1,X11,X2,X20,X22,X3,X10,X21
11 ;TMP5(sequence #)= 1 if unique value
12 S DIC=4.005,X=$S(X0:"`",1:"")_X0,DIC(0)="Z",U="^" D ^DIC
13 I Y=-1 S ERROR="1^Unknown entry of 4.005 File: "_X0 Q
14 S X0=+Y,X0NAME=$P(Y(0),U) S:'$G(MODE) MODE=+$P(Y(0),U,2) K TMP M TMP=@($$ROOT^DILFD(4.005,,0)_"""AC"",X0)")
15 ; Set TMP5 if pointer type of field
16 S X1=0,(X10,X20)=0 F S X1=$O(TMP(X1)) Q:'X1 S X2=$O(TMP(X1,X0,0)) D
17 .S X3=$O(TMP(X1,X0,X2,0))
18 .S X11=$O(TMP(X1)),X21=$O(TMP(+X11,X0,0))
19 .I X20'=X2,X2'=X21,'$D(^DIC(X2)),$G(^DD(X2,0))'["EFFECTIVE DATE/TIME" S TMP6(X2,X3)=1
20 .S X20=X2
21 .S POINTER=$$POINTER(X2,X3)
22 .S:POINTER TMP7(X2,X3)=POINTER
23 D GETS^DIQ(4.005,X0_",","**","","TMP1")
24 S A="" F S A=$O(TMP1(4.00511,A)) Q:'$L(A) D
25 .N X1,X2
26 .S X1=$P(A,",",2),X2=$P(A,",",1)
27 .S:TMP1(4.00511,A,2)="INTERNAL" TMP2(X1,X2)=""
28 .;+++++++++++++++Set array of fields of pointer type VUID into TMP4 +++++++++++++++++++++++++
29 .;TMP1(4.00511,A,3) = File Number Of Pointed to Field for VUID sort
30 .S:TMP1(4.00511,A,3) TMP4(X1,X2)=TMP1(4.00511,A,3)
31 .;+++++++++++++++Set array of columns with Unique value into TMP5 +++++++++++++++++++++++++
32 .;TMP1(4.00511,A,4) = Unique value YES
33 .S:TMP1(4.00511,A,4)="YES" TMP5(X1,X2)=1
34 ;
35 ;MODE set from input parameter or from file.
36 S A=$C(1,35,69,103)
37 S B=$C(137,171,205,239)
38 S C=$C(254,220,186,152)
39 S D=$C(118,84,50,16)
40 S ABCD=A_B_C_D
41 S (CNT,CNTT,CNHT)=0
42 S VALUE=""
43 ;X1 = SEQUENCE
44 ;X2 = FILE/SUBFILE #
45 ;X3 = Field #
46 ;TMP(MD5 Sequence ,IEN of entry from 4.005 file , File/Subfile#,field#)=""
47 ;TMP1 = FILE # ALL ENTRIES
48 ;TMP2(file#, field #)="" Set.. if INTERNAL value required
49 ;TMP4(file#, field #)=Subfile # Set if SORT by VUID for subfile = file #
50 ;TMP5(file#, field #)= 1 if unique value requested
51 ;TMP6(file#, field #)= 1 if column mode.. it's not used yet...
52 ;TMP7(file#, field #)=file # of pointer type field
53 S START=1,X1=0,LEV=0,X2OLD=0,XMD5=$O(^TMP("XUMF ERROR",$J,9999999999999),-1)+1,EXITMD5=0
54 Q
55END ;************ So get the final ABCD value... ************
56 S ABCD=$$MD5E^XUMF5AU(ABCD,VALUE,0,CNHT*64+$L(VALUE))
57 D:MODE
58 .W ! D SETACK^XUMF5I($S(MODE=1.1:"",1:"Last value: ")_VALUE)
59 .D SETACK^XUMF5I("LAST HASH: "_$$MAIN^XUMF5BYT($$HEX^XUMF5AU(ABCD))) W !
60 .D SETACK^XUMF5I("Total number of Characters included in Hash : "_(CNHT*64+$L(VALUE)))
61 .D SETACK^XUMF5I("Length of last value: "_$L(VALUE))
62 .D SETACK^XUMF5I("Number of file entries: "_CNTT)
63 .D SETACK^XUMF5I("Number of hash entries: "_(CNHT+1))
64 .D SETACK^XUMF5I("Number of values: "_CNT)
65 .W !
66 ;************ Hex conversion + storage of the final ABCD value ************
67 S VALUE=$$MAIN^XUMF5BYT($$HEX^XUMF5AU(ABCD))
68 K FDA
69 S FDA(4.005,X0_",",4)=$$NOW^XLFDT
70 S FDA(4.005,X0_",",5)=VALUE
71 K ERR D FILE^DIE(,"FDA","ERR")
72 I $D(ERR) D
73 .S ERROR="1^MD5 Date updating error"
74 .D EM^XUMFX("file DIE call error message in RDT",.ERR)
75 .K ERR
76 D SETACK^XUMF5I("MD5 Signature Entry: "_X0NAME)
77 D SETACK^XUMF5I("Local Hash value: "_VALUE)
78 S ERROR=$G(ERROR)
79 S X1=$O(@($$ROOT^DILFD(4.009,,0,"ERR")_"0)"))_","
80 D GETS^DIQ(4.009,X1,"*",,"TMP3") S VERSION=$G(TMP3(4.009,X1,1))
81 S $P(ERROR,U,2)=$P(ERROR,U,2)_";CHECKSUM:"_VALUE_";VERSION:"_VERSION_";"
82 D SETACK^XUMF5I("ERROR variable: "_ERROR)
83 K ^TMP("PROOT",$J)
84 Q VALUE
85 Q
86POINTER(X2,XXP) ;GET THE POINTER FILE #
87 N FTYPE,TT,I
88 S:'$G(XXP) XXP=.01
89 D FIELD^DID(X2,XXP,,"TYPE;POINTER","TT")
90 Q:$G(TT("TYPE"))'="POINTER" 0
91 Q:'$L($G(TT("POINTER"))) 0
92 S TT="1^"_TT("POINTER")
93 Q TT
Note: See TracBrowser for help on using the repository browser.