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

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

initial load of FOIAVistA 6/30/08 version

File size: 3.2 KB
Line 
1DICATT3 ;SFISC/COMPUTED FIELDS ;11:27 AM 24 May 2001
2 ;;22.0;VA FileMan;**76**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 K DIRUT,DTOUT D COMP I $P(^DD(A,DA,0),U,2)["C" G N^DICATT
5 S DTOUT=1 G CHECK^DICATT
6 ;
7COMP N DIR,DICOMPX,DISPEC,DICMIN,DIL,DIJ,DIE,DIDEC
8 S DISPEC=$P($G(^DD(A,DA,0)),U,2)
9 S DIR(0)="FU",DIR("A")="'COMPUTED-FIELD' EXPRESSION"
10 I O,$D(^DD(A,DA,9.1)) S DIR("B")=^(9.1)
11 S DIR("?")="^D DICATT3^DIQQ"
12 D ^DIR Q:$D(DIRUT)
13 I $D(DIR("B")),DIR("B")=Y G GETTYPE
14 K DICOMPX S DICOMPX=""
15 S DICMIN=Y,DQI="Y("_A_","_DA_",",DICMX="X DICMX",DICOMP="?I"
16 D ^DICOMP I '$D(X) W $C(7)," ...??" G 6
17 I DUZ(0)="@" W !,"TRANSLATES TO THE FOLLOWING CODE:",!,X,!
18 I Y["m" W !,"FIELD IS 'MULTIPLE-VALUED'!",!
19 I O,$D(^DD(A,DA,9.01))!(DICOMPX]"") D ACOMP
20 S DISPEC=$E("D",Y["D")_$E("B",Y["B")_"C"_$S(Y'["m":"",1:"m"_$E("w",Y["w"))_$S(Y["p":"p"_$S($P(Y,"p",2):+$P(Y,"p",2),1:""),1:"")_$S(Y'["B":"",1:"J1")
21 S ^DD(A,DA,0)=F_U_DISPEC_"^^ ; ^"_X,^(9)=U,^(9.1)=DICMIN,^(9.01)=DICOMPX
22 F Y=9.2:0 Q:'$D(X(Y)) S ^(Y)=X(Y),Y=$O(X(Y))
23 K X,DICOMPX
24GETTYPE K DIR S DIR(0)="SBA^S:STRING;N:NUMERIC;B:BOOLEAN;D:DATE;m:MULTIPLE;p:POINTER;mp:MULTIPLE POINTER"
25 S DIR("A")="TYPE OF RESULT: "
26 S DIR("B")=$P($E(DIR(0),$F(DIR(0),$$TYPE(DISPEC)_":"),99),";")
27 D ^DIR I $D(DIRUT) G END
28 S DISPEC=$TR(Y,"SN") I Y="B"!(Y="D") D P(Y) G END
29 I Y["p" D POINT G END
30 S DIJ="",DIE=$P($P(O,U,2),"J",2) F J=0:0 S N=$E(DIE) Q:N?.A S DIE=$E(DIE,2,99),DIJ=DIJ_N
31 S DIDEC=$P(DIJ,",",2),DIL=$S(DIJ:+DIJ,1:8)
32 I DISPEC'["m" D DEC:Y="N" I '$D(DIRUT) D LEN
33END I O S DI=A D PZ^DIU0 Q
34 D SDIK^DICATT22
356 Q ;leave this here
36 ;
37 ;
38DEC N DG,O,M
39FRAC K DIR S DIR("A")="NUMBER OF FRACTIONAL DIGITS TO OUTPUT: "
40 I DIDEC]"" S DIR("B")=DIDEC
41 S DIR("?")="Enter the number of decimal digits that should normally appear in the result."
42 S DIR(0)="NAO^0:14:0" D ^DIR Q:$D(DIRUT) S DIDEC=Y
43 S DG=" S X=$J(X,0,",M=$P(^DD(A,DA,0),DG),%=M_DG_DIDEC_")"'=^(0)+1
44 W !,"SHOULD VALUE ALWAYS BE INTERNALLY ROUNDED TO ",DIDEC," DECIMAL PLACE",$E("S",DIDEC'=1)
45 D YN^DICN G FRAC:'% Q:%'>0 S ^DD(A,DA,0)=M_$P(DG_DIDEC_")",U,%)
46S S DQI="Y(",O=$D(^(9.02)),X=^(9.1) K DICOMPX,^(9.02) Q:'$D(^(9.01))
47 F Y=1:1 S M=$P(^(9.01),";",Y) Q:M="" S DICOMPX(1,+M,+$P(M,U,2))="S("""_M_""")",DICOMPX=""
48 Q:Y<2 I X'["/",X'["\" Q:X'["*" Q:Y<3
49 D ^DICOMP Q:$D(X)-1
50 S %=2-O W !,"WHEN TOTALLING THIS FIELD, SHOULD THE SUM BE COMPUTED FROM",!?7,"THE SUMS OF THE COMPONENT FIELDS" D YN^DICN
51 I %=1 S ^DD(A,DA,9.02)=X_" S Y=X"
52 S:%<1 DIRUT=1
53 Q
54 ;
55LEN K DIR
56 S DIR(0)="NAO^1::0",DIR("A")="LENGTH OF FIELD: ",DIR("B")=DIL
57 S DIR("?")="Maximum number of character expected to be output."
58 D ^DIR Q:$D(DIRUT)
59 D P($P(DISPEC,"J")_"J"_Y_$E(",",DIDEC]"")_DIDEC_DIE) Q
60 ;
61POINT K DIR
62 S DIR(0)="P^1:QEF",DIR("A")="POINT TO WHAT FILE"
63 S DIR("S")="I $$OKFILE^DICOMPX(Y,""W"")"
64 S X=$P($P(^DD(A,DA,0),U,2),"p",2) I 'X S X=$P($P(O,U,2),"p",2)
65 I X,$D(^DIC(+X,0)) S DIR("B")=$P(^(0),U)
66 D ^DIR I '$D(DIRUT) S $P(DISPEC,"p",2)=+Y D P(DISPEC)
67 Q
68 ;
69P(C) S $P(^DD(A,DA,0),U,2)="C"_$TR(C,"C^") Q
70 ;
71ACOMP ;SET/KILL ACOMP NODES
72 N X,I I $G(^DD(A,DA,9.01))]"" S X=^(9.01) X ^DD(0,9.01,1,1,2)
73 I DICOMPX]"" S X=DICOMPX X ^DD(0,9.01,1,1,1)
74 Q
75 ;
76TYPE(S) ;
77 Q $S(S["D":"D",S["B":"B",S["mp":"mp",S["m":"m",S["p":"p",S'["J":"S",S[",":"N",1:"S") ;figure out TYPE OF RESULT
Note: See TracBrowser for help on using the repository browser.