source: FOIAVistA/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DICOMP1.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 3.3 KB
Line 
1DICOMP1 ;SFISC/GFT-EVALUATE COMPUTED FLD EXPR ;19JUNE2007
2 ;;22.0;VA FileMan;**6,44,76,152**;Mar 30, 1999;Build 10
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 F Q:'$D(DPS(DPS,"ST")) D DPS^DICOMPW S K=K+1,K(K)=X
5 G 0:DPS
6INIT S T=99,DLV0=0,X="",K=1 D ST ;ST will build code to get top=level values
7NN I $D(K(K,1)) S DLV0=K(K,1) K K(K,1) D ST ;'1' flags a change in levels
8 I $D(K(K,9)) F %=1:1:K K DATE(%)
9 G S:$D(K(K))[0,K1:K(K)=""
10 I " "[$E(K(K)) D
11 .Q:X=""
12 .I K(K)?1" S ".E D Q
13AS ..D EX I $L(K(K))+$L(X)>160 D M Q
14 ..S K(K)=$E(K(K),4,999),X=X_","
15 .D EX:W,M:$L(X)+$L(K(K))>180
16 E I 'W D M:$L(X)+$L(K(K))>165 S X=X_" S X=",W=6
17 D:K(K)?1P
18P .I "\/"[K(K),$G(K(K+1))'?.NP S K=K+1,K(K)=",X=$S("_K(K)_":X"_K(K-1)_K(K)_",1:""*******"")"
19 .I $L(X)>150,$F(DPUNC,K(K))>3 D M,SX
20 G A:'$D(DATE(K))
21DATE I $G(K(K-1))="_",X?.E1"_" S X=$E(X,1,$L(X)-1) D EXTRASB S Y=$$DGI^DICOMP,X=X_" S "_Y_"=X,X="_K(K)_" S Y=X X ^DD(""DD"") S X="_Y_"_Y",K(K)="" G A
22 S Y=1 I $G(K(K-1))="+" S X=X_"0,X2=X,X1="_K(K) G DTC
232 G A:$D(K(K+2))[0
24 K DATE(K)
25 I $D(DATE(K+2))[0,$F("+-",K(K+1))>1 S X=X_K(K)_",X1=X,X2="_K(K+1)_K(K+2),DATE(K+2)=1
26 E G A:K(K+1)'="-" K DATE(K+2) S X=X_K(K)_",X1=X,X2="_K(K+2),Y=0
27 S K=K+2
28DTC S K=K+1,X=X_",X="""" D"_$P(":X2 ^ C",U,Y+1)_"^%DTC:X1" G S:'$D(K(K)) D SX G NN:'Y S K=K-1,K(K)="" G 2
29 ;
30A S W='$D(K(K,2)),X=X_K(K)
31K1 S K=K+1 G NN:$D(K(K))#2
32S S I="" F S I=$O(M(I)),W=0 Q:I="" D M:$L(X)>235 S K=$O(M(I,"")),X=X_" S D"_I_"="_$S(DA:DQI_(K+80),1:"I("_K_",0")_")"
33 S I=-1 D SS S:X?.E1" S X=X" X=$E(X,1,$L(X)-6) I X'?1"S X="1N.NP!(DICOMP["Z") G Q
340 ;NO GOT! Come here when parsing fails
35 K X,DIM,DATE I DUZ(0)="@",DICOMP'["X" D
36 .Q:DICO'[" "
37 .S DIM=1 I $L(DICO," ")=2 F Y="OPEN","CLOSE","BREAK","USE" D I '$D(DIM) Q
38 ..I $E(Y)=$P(DICO," ")!(Y=$P(DICO," ")) K DIM
39 .I $D(DIM) S X=DICO D ^DIM
40 S DICOMP="",DLV=DICO(1)
41Q I DICOMP'["S" S K=DICO(1) F S K=$O(I(K)) Q:K="" K I(K),J(K)
42 I $D(X) S:$D(DICO("DIERR")) X="N DIERR "_X I $G(DICOMPQI) S X="N Y "_X
43Y K Y I $D(DICO("RCR")) S Y=DICO("RCR")
44 E S Y=DLV_$E("W",$D(DPS("W")))_$S($G(DBOOL)=1:"B",$D(DATE)>9:"D",1:"")_$E("X",$D(DIM))_$E("L",$D(DICO(2)))
45 S Y=Y_DIMW
46 I $D(DICO("PT")) S Y=Y_"p"_DICO("PT")
47 K K,DLV,DICOMP,DICMX Q
48 ;
49ST S W=0,DG="" F S DG=$O(DG(DLV0,DG)),Y=$P(DG,U,2) Q:DG="" D
50 .I Y]"" S:+Y'=Y Y=""""_Y_"""" S I=DQI_DG(DLV0,DG)_")=$S($D(^(" D:T-DG!(DG<DLV0) S I=I_Y_")):^("_Y_"),1:"""")" G VP
51 ..N T,QI,%
52X ..S I=$P(I,U),%=DG\100*100
53 ..F T=0:1:DG#100 S QI=I(%) S I=I_QI_$E(",",1,T)_$S(DICOMP["T"&(DG<DICO(0)):"I("_%_",0)",1:"D"_T)_",",%=%+1
54 ..K DG(DLV0,DG)
55 ..;do not change above code to use "$G" until you change E2+4^DIP0 !
56C .F S %=$O(DG(DLV0,DG,0)) Q:'% D K DG(DLV0,DG,%) ;for Computed Fields
57 ..S I=" X ""N I,Y ""_$P(^DD("_J(DG)_","_%_",0),U,5,99)"
58 ..I DICOMP["T",DG<DICO(0) D
59 ...N W,SV S SV=X,X="N D0 S D0=I("_DG_",0)"_I D EXTRASB S I=X,X=SV
60 ..S I=I_" S "_DQI_DG(DLV0,DG,%)_")=X"
61 ..D EX:W,M:$L(X)+$L(I)>180 S X=X_I
62 .Q:$D(DG(DLV0,DG))[0
63 .S I=DG(DLV0,DG) I I?.N S I=$S(DA:DQI_(DLV0+I+80),1:"I("_(DLV0+I)_",0")_")=$G(D"_I_")"
64 .E S I=DQI_+DG_")="_I
65 .K DG(DLV0,DG) G OV:DG?.N1A
66VP .I $G(DICV)["V" S I=I_"_$C(59)_"""_$E(I(0),2,99)_""""
67OV .I $L(I)+$L(X)>180 D M
68 .S:'W X=X_" S " S X=X_I_",",W=2
69 D EX S W=0 Q
70 ;
71M D SS,EX
72EXTRASB D DIMP^DICOMPZ(X) S W=0 Q
73 ;
74SS Q:$A(X)-32 S X=$E(X,2,999) G SS
75 ;
76EX S X=$E(X,1,$L(X)-W+1) Q
77 ;
78SX S X=X_" S X=X",W=1
79 Q
Note: See TracBrowser for help on using the repository browser.