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

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

initial load of FOIAVistA 6/30/08 version

File size: 4.5 KB
Line 
1DIE ;SFISC/GFT,XAK-PROC.DR-STR ;2:40 PM 17 Sep 2002
2 ;;22.0;VA FileMan;**1,4,8,11,59,95**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 N DG,DNM,DICRREC K DB I DIE S DIE=^DIC(DIE,0,"GL")
5 Q:$D(@(DIE_DA_",-9)")) Q:'$D(@(DIE_"0)")) S U="^",DP=+$P(^(0),U,2) Q:$P($G(^DD($$FNO^DILIBF(DP),0,"DI")),U,2)["Y"&'$D(DIOVRD)&'$G(DIFROM)
6GO Q:DIE?1"^DIA(".E K DE,DOV,DIOV,DIEC,DTOUT N DIEDA D
7 . N %
8 . F %=1:1 Q:'$G(DA(%)) S DIEDA(%)=DA(%)
9 . S DIEDA=DA
10 . Q
11 I $D(DIETMP)[0 N DIETMP S DIETMP=$$GETTMP^DIKC1("DIE")
12 N DIEFXREF,DIIENS K DIEFIRE,DIEBADK S DIIENS=$$IENS^DIKCU(DP,.DA)
13 S DL=1,D0=DA,DI=DP,DR(1,DP)=DR D INI I $E(DR)'="[" D DR^DIE17
14 S DP=DI,DA=D0,(DQ,DIEL,DK,DP(0))=0 K DIC("S")
15MR S DK=DK+1,DH=$P(DR,";",DK) I +DH=DH S (DI,DM)=DH G S:$D(^DD(DP,DI)),MR
16 S DI=$P(DH,":",1) I 'DI G K:DI=0,PB
17J I DH["//" S DE(DQ+1,0)=$P(DH,"//",2,9),DI=$P(DI,"//",1),DH=""
18 G K:+DI=DI S DM=+DI,Y=$P(DI,DM,2,99),DI=DM G MR:Y=""!'$D(^DD(DP,DI,0)) S DQ=DQ+1,(DZ,DQ(DQ))=^(0),DIFLD(DQ)=DI
19 F %=1:1 S DIG=$P(Y,$C(126),%) Q:DIG="" S DZ=$S(DIG="d"!(DIG="R"):$P(DZ,U,1,2)_DIG_U_$P(DZ,U,3,99),DIG="T":$S($D(^(.1)):^(.1),1:$P(DZ,U))_U_$P(DZ,U,2,99),1:DIG_U_$P(DZ,U,2,99))
20 S:DH'[$C(126) DH=DH_$C(126) S DQ(DQ)=DZ K DZ,DIG G Y
21K S DM=$P(DH,":",2),DM=$S(DM:DM,1:DI) I DI,$D(^DD(DP,DI)) G S
22NX S DI=$O(^DD(DP,DI)) S:DI="" DI=-1 G MR:DI'>0,MR:DI>DM
23S I DQ'<50,'$D(DE(DQ+1)) G H
24 S DQ=DQ+1,DQ(DQ)=^(DI,0),DIFLD(DQ)=DI
25Y S Y=$P(DQ(DQ),"^",4),DG=$P(Y,";",1)
26 ;Determine whether field has a xref defined in the Index file
27 S DIEXREF=0 F S DIEXREF=$O(^DD("IX","F",DP,DI,DIEXREF)) Q:'DIEXREF I $P($G(^DD("IX",DIEXREF,0)),U) S DIEXREF=1 Q
28 I $D(^DD(DP,DI,1))!($P(DQ(DQ),U,2)["a")!DIEXREF S DE=0,DB=DM,DM=0,DE(Y)=DQ K DIEXREF F DW=1:1 S DE=$O(^DD(DP,DI,1,DE)) Q:DE<1 S DE(Y,DW,1)=^(DE,1),DE(Y,DW,2)=^(2)
29 I S:DE="" DE=-1
30 I $P(DQ(DQ),U,2)["a" S DE(Y,DW,2)="S DIIX=2_U_DIFLD(DE(DQ)) D AUDIT^DIET",DE(Y,DW,1)="S DIIX=3_U_DIFLD(DE(DQ)) D AUDIT^DIET",DE(Y)=DQ I ^DD(DP,DI,"AUDIT")="e" S DE(Y,DW,1)="I $D(DE(DE(DQ)))#2 "_DE(Y,DW,1)
31 S Y=$P(Y,";",2) I DU'=DG S D="",DU=DG,@DC G M:Y=0,B:DU=" ",EQ:DW[0 S D=^(DG)
32 I Y S:$P(D,"^",Y)]"" DE(DQ)=$P(D,"^",Y)
33 E S Y=$E(D,+$E(Y,2,9),$P(Y,",",2)) S:Y'?." " DE(DQ)=Y
34EQ G MR:DI=DM,NX:DM S DM=DB K DB G D
35 ;
36INI K DIC("S") S DIC=DIE,DU=-1,DC="DW=$D("_DIE_DA_",DG))"
37Q Q
38MORE ;
39 D INI G MR:DI=DM,NX:DI'[U S DI=+DI G S:$D(^DD(DP,DI)),MR
40JMP ;
41 D INI G J
42 ;
43PB I DH="" G D:$D(DR(DL,DP))<9 S:'$D(DOV) DOV=0,DR(DL,DP)=DR S DOV=$O(DR(DL,DP,DOV)) S:DOV="" DOV=-1 G D:DOV'>0 S DR=DR(DL,DP,DOV),DK=0 G MR
44 G MR:DH?1"@".N I 'DQ G TEM:DH?1"[".E S:"Q"'=DH DQ=1,DQ(0,1)=DH G MR:$A(DH)-94 S DC=$P(DH,U,1,4) X $P(DH,U,5,999) G O^DIE0
45E S DK=DK-1,(DI,DM)=1
46D G DQ^DIED
47H S DI=DI_U G D
48M S Y=$P(DQ(DQ),U,2)_U_DG G DC:DW<9
49 I $D(DSC(+Y))#2,$P(DSC(+Y),"I $D(^UTILITY(",1)="" S D=DIEL+1 D D1 X DSC(+Y) S D=$O(^(0)) S:D="" D=-1 S @DC S DC=$O(^(DG,0)) S:DC="" DC=-1 G DE
50 I $D(^(DG,0)) S D=$P(^(0),U,3,4) S:$P(^(0),U,2)'=$P(Y,U) $P(^(0),U,2)=$P(Y,U)
51 E S D=$O(^(0)) S:D="" D=-1
52DE I D>0 S Y=Y_U_D I DP(0)-Y,$D(^(+D,0)) S DE(DQ)=$P(^(0),U,1)
53DC S DC=$P(^DD(+Y,0),U,4)_U_Y,%=DQ(DQ),Y=^(.01,0) I $P(Y,U,2)'["W" S DQ(DQ)="Select "_$P(Y,U,1)_U_1_$P(Y,U,2,99) G D
54 I DQ>1 K DQ(DQ) G E:$D(DE(DQ,0)),H
55 D
56 .Q:DH'[$C(126)
57 .N DIEA S DIEA=$P($P(DH,+DH,2),$C(126)) Q:DIEA=""!(DIEA="d")!(DIEA="R")
58 .S $P(%,U)=$S(DIEA="T"&$D(^DD(+$P(%,U,2),.01,.1)):^(.1),1:DIEA)
59 .Q
60 S Y=$P(%,U,1)_U_$P(Y,U,2) D DIEN^DIWE K DQ,DG,DE S DQ=0 G QY^DIE1:$D(DTOUT) G MORE
61 ;
62D1 Q:D'>0 S:'$D(@("D"_D)) @("D"_D)=0 S D=D-1 G D1
63 ;
64B K DQ(DQ) S DQ=DQ-1,DU=-9 G EQ
65 ;
66TEM K:$D(DIETMP)#2 @DIETMP,DIETMP
67 S Y=0 F S Y=$O(^DIE("B",$P($E(DR,2,99),"]",1),Y)) S:Y="" Y=-1 G Q:Y=-1,Q:'$D(^DIE(+Y,0)) Q:$P(^(0),U,4)=DP
68 S $P(^(0),U,7)=DT I $G(^("ROU"))[U,$$ROUEXIST^DILIBF($P(^("ROU"),U,2)) G @^DIE(+Y,"ROU")
69 S:$D(^("W")) DIE("W")=^("W") S %X="^DIE(+Y,""DR"",",%Y="DR(" D %XY^%RCR
70 S DIE("^")=DR,DR=$S($D(^DIE(Y,"DR"))#2:^("DR"),1:DR(1,DP)) D DIE K DR S DR=DIE(U)
71 Q
72 ;
73 ;Silent call concerning editing and filing of data.
74 ;
75FILE(DIEFFLAG,DIEFAR,DIEFOUT) ;
76 G FILEX^DIEF
77 ;
78WP(DIEFF,DIEFIEN,DIEFFLD,DIEFWPFL,DIEFTSRC,DIEFOUT) ;
79 G WPX^DIEFW
80 ;
81HELP(DIEHF,DIEHIEN,DIEHFLD,DIEHFLG,DIEHOUT) ;
82 G GETX^DIEH
83 ;
84VAL(DIEVF,DIEVIEN,DIEVFLD,DIEVFLG,DIEVAL,DIEVANS,DIEVFAR,DIOUTAR) ;
85 G VALX^DIEV
86 ;
87KEYVAL(DIVKFLAG,DIVKFDA,DIVKOUT) ;
88 G KEYVALX^DIEVK
89 ;
90VALS(DIVSFLAG,DIVSEFDA,DIVSIFDA,DIVSMSG) ;
91 G VALSX^DIEVS
92 ;
93CHK(DIEVF,DIEVFLD,DIEVFLG,DIEVAL,DIEVANS,DIOUTAR) ;
94 G CHKX^DIEV
95 ;
96UPDATE(DIFLAGS,DIFDA,DIEN,DIMSGA) ;SEA/TOAD
97 ; ENTRY POINT--update database
98 ; procedure, all passed by value
99 G ADDX^DICA
100 ;
Note: See TracBrowser for help on using the repository browser.