VistA-WorldVistAEHR/r/VA_FILEMAN-ARJT-DI-DD-DM-DT.../DIFG3.m

64 lines
3.5 KiB
Mathematica

DIFG3 ;SFISC/DG(OHPRD)-LOOKUP PROCESSING ;3/11/93 1:33 PM
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
S DIFGTYP="" X DIFGLINE
N DIC,DIFGDRAD,DIFGDRCT,DIFGFLUS
S DIFG=DIFG+1
D BEGIN G:DIFGER X5
S DIFGTYP=$S(DIFGTYPE="MV FIELD":"MV FIELD",DIFGTYPE="SV FIELD":"SV FIELD",1:"FILE")
I $D(DIFGDINM) K DIFGDINM S Y=^UTILITY("DIFG",$J,DIFGINCR,DIC,"DA") S:'$D(@(^DIC(DIC,0,"GL")_"Y)")) DIFGER=19_U_DIFGY D ERROR^DIFG:DIFGER,SET^DIFG3A:'DIFGER G X5
I '$D(DIFGNOLK) D PREDIC I 1
E I DIFGTYP="MV FIELD",$D(DIFGNOLK) D MVFIELD^DIFG3A I 1
E S DIFGDIC=DIC D ^DIFG4,SET^DIFG3A
X5 S DIFG=DIFG-1 K DIFGNOLK,DIFGCOND,DIFG("CONDSET") I DIFGTYP'="MV FIELD" K DIFGTYP
Q
BEGIN I $P(DIFGDIX,":")'="BEGIN" S DIFGER=6_U_DIFGY D ERROR^DIFG G X
S DIFGDRCT=0,DIC=$S(+$P(DIFGDIX,U,2):+$P(DIFGDIX,U,2),1:$O(^DIC("B",$P($P(DIFGDIX,U),":",2),""))),DIC("S")="F DIFGI=1:1 Q:'$D(DIFGDIC(DIFGDIC,DIFGI))!('$T) X DIFGDIC(DIFGDIC,DIFGI)"
I '$D(^DD(DIC)) S DIFGER=20_U_DIFGY D ERROR^DIFG G X
I DIFGTYP="" S %=DIFGLAGO NEW DIFGLAGO S DIFGHAT=$P(^DD(DIC,.01,0),U,2) S DIFGLAGO=$S(%=0:0,DIFGHAT'["'":1,$D(DIFGENV("LAYGO",DIC,.01)):1,1:0) K %
K DIFGHAT
I DIFGTYPE="SV FIELD"!($D(DIFG("CHKCOND"))) S:$D(^DD(DIC,0,"FD")) DIFGCOND(DIFG,DIC)="" K DIFG("CHKCOND")
D LINK^DIFG5
F DIFGL=0:0 X DIFGLINE S DIFGFIRP=$P(DIFGDIX,":") Q:DIFGFIRP="END"!DIFGER D LINES
Q
LINES I DIFGFIRP="BEGIN" D RCR S:$S($D(Y):Y<0,1:1) DIFGNOLK="" G:DIFGER X S:'$D(DIFGNOLK) X="`"_+Y S:$D(DIFGNOLK)&(DIFGTYP'="MV FIELD")&(DIFGTYP'="FILE") X=DIFGALNK D:$D(DIFGDIC(DIC))&'$D(DIFGNOLK) ARRAY^DIFG5 K Y G X
I DIFGFIRP="IDENTIFIER"!(DIFGFIRP="SPECIFIER") D ^DIFG0 G:DIFGER X S:'$D(DIFGPTER(DIFGCT)) DIFGSVVL(DIFGCT)=DIFGVAL(DIFGCT) I $D(DIFGPTER(DIFGCT)) D IDENSPEC^DIFG5 G X
I DIFGFIRP="KEY" S DIFGKEY="" D KEY^DIFG5
I DIFGFIRP="$DAT" S DIFGER=3_U_DIFGY D ERROR^DIFG
X Q
RCR N DIC,DIFGDRAD,DIFGDRCT,DIFGNOLK,DIFGFLUS
S DIFG=DIFG+1,DIFG("CHKCOND")=""
D BEGIN G:DIFGER X
I '$D(DIFGNOLK) D PREDIC I 1
E S DIFGDIC=DIC D ^DIFG4,SET^DIFG3A
I $D(DIFGDIC)#2 K DIFGCOND(DIFG,DIFGDIC)
S DIFG=DIFG-1
Q
PREDIC I $D(DIFGKEY) D:DIFGTYPE="MV FIELD" MVFIELD^DIFG3A G X2
S DIFGDIC=DIC
I DIFGTYP="MV FIELD" D MVFIELD^DIFG3A G X2
I DIFGTYP="FILE",$P(DIFGMO(DIFGMULT),U)="A" S DIFGSKIP(DIFGMULT)="" D ^DIFG4,SET^DIFG3A G X2
I '$D(DIFGFLUS) D CALLDIC I 1
E D SET^DIFG3A
X2 K DIFGKEY,DIFGSAVE(DIFG,"@NUM")
K:DIFGTYP'="MV FIELD" DIFG("ACGRV")
Q
CALLDIC K D
I $D(DIFGXRF(DIFGMULT)),(DIFGTYP="MV FIELD"!(DIFGTYP="FILE")) S DIFGX=X,X=^UTILITY("DIFG@",$J,$P(DIFGXRF(DIFGMULT),"=",2)) G:X["^UTILITY(""DIFG@""" NOLK S D=$P(DIFGXRF(DIFGMULT),"="),DIC(0)="FI" D G:$D(DIFGNK) NOLK
. I $E(DIFGX)="`" S DIFGGRAV="",DIFGX=$E(DIFGX,2,245)
. E NEW X S X=DIFGX X $P(^DD(DIFGDIC,.01,0),U,5,99) S:$D(X) DIFGX=X I '$D(X) S DIFGNK="" Q
. F DIFGI=1:1 Q:'$D(DIFGDIC(DIFGDIC,DIFGI))
. S DIFGDIC(DIFGDIC,DIFGI)="I $P(^(0),U)=DIFGX"
E I $E(X)'="`"!($P(^DD(DIFGDIC,.01,0),U,5,99)["DINUM") S DIC(0)="MFI"
E S X=$E(X,2,245),DIC(0)="FI",D="B",DIFG("ACGRV")=""
I $D(D),'$D(^DD(DIFGDIC,0,"IX",D)) D DOLO^DIFG5 I '$D(DIFG("FOUND")) S DIFGER=18_U_DIFGY D ERROR^DIFG G X6
K DIFGNK F DIFGI=1:1 Q:'$D(DIFGDIC(DIFGDIC,DIFGI))!$D(DIFGNK) I $P(DIFGDIC(DIFGDIC,DIFGI),"=",2)["DIFGVAL",@$P(DIFGDIC(DIFGDIC,DIFGI),"=",2)["DIFG(" S DIFGNK=""
I '$D(DIFG("FOUND")),'$D(DIFGNK) D @$S($D(D):"IX^DIC",1:"^DIC")
NOLK I X["^UTILITY(""DIFG@"""!$D(DIFGNK) S Y=-1
I $D(DIFGX) S X=$S($D(DIFGGRAV):"`",1:"")_DIFGX K DIFGX,DIFGGRAV
D CHECKY^DIFG5
D:'DIFGER SET^DIFG3A
X6 K DIFG("FOUND"),D,DR,DIFGNK
I DIFGTYP="MV FIELD"!(DIFGTYP="FILE") K DIFGXRF(DIFGMULT)
Q