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

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

initial load of FOIAVistA 6/30/08 version

File size: 7.7 KB
Line 
1DID ;SFISC/XAK-LIST DD'S ;2:19 PM 5 Mar 2002
2 ;;22.0;VA FileMan;**24,105**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 D KL,L^DICRW1 I $D(DIC) S (DUB,DIB,DFF)=+Y G O:Y'=+DIB(1),SUB
5KL K DIS,DIJS,DHIT,DIB,DINM,DIDX,DIGR,DIDH,BY,DICMX,DIOEND,FLDS
6 K DFF,DIFF,DID,DUB,DHD,DIC,DICS,POP,DA,DR,S,F,J,K,Z,W,X,Y,M,G,N,I
7 K DIWF,DIPP,DPP,DIMS,DIPQ,DJ,DDL1,DDL2,DDL3,DDLF,DDN1,X1,DDRG,I1
8 K DIDRANGE,DIDFLD,DIDTYP
9 Q
10 ;
11SUB S DIC="^DD("_+Y_"," G O:$O(^DD(+Y,"SB",0))'>0 S DIC(0)="AEQZ",DIC("A")=" Select SUB-FILE: ",DIC("S")="I $P(^(0),U,2)" D ^DIC G KL:$D(DTOUT) I Y>0 S (DFF,Y)=+$P(Y(0),U,2) G SUB
12 G KL:X[U
13O K DIC S:DFF-DUB DIC("S")="I Y-5" S DIC="^DOPT(""DID"",",DIC(0)="AEQ",DIC("B")=1 D ^DIC G KL:Y<0
14O1 K DIC S DIC="^DD(DFF,"
15 I +Y=3 D D EN^DIP G KL
16 .I $D(^DIC(DFF)) S DIB(1)=$O(^DD($O(^DIC(DIB(1)))),-1)
17 .S DIS(0)="I $D(^DD(DFF,D0,0))",DIOEND="G L^DIDC"
18 .S DIOBEG="S L=0 I $G(DQI),$D(^UTILITY($J,2)) S ^(1.5)=""W $O(^DD(DIB,0,""""NM"""",0)),"""" """" W:'$D(^DIC(DIB)) """"SUB-"""" W """"FILE """""",^(2)=""X ^(1.5) ""_^(2)"
19 I +Y=4,'$D(DIFORMAT) D MOD^DID2 G KL:X[U
20 S L=0,FLDS="",BY="@.001" I +Y=5 S (FR,TO)=.01,DHIT="S F(1)=DUB",DHD="W """" D H1^DIDG",DIOEND="D T^DID" G G
21 I +Y=8 D G:DIDTYP=""!(DIDFLD=-1) KL G G
22 . S DIDTYP=$$ASKTYP Q:DIDTYP=""
23 . S DIDFLD=$$ASKFLD(DFF) Q:DIDFLD=-1
24 . S (FR,TO)=.01,DHIT="S F(1)=DFF"
25 . S DHD="W """" D IXHEAD1^DID"
26 . S DIOEND="D IX^DID"
27 I +Y=9 S (FR,TO)=.01,DHIT="S F(1)=DFF",DHD="W """" D KEYHEAD1^DID",DIOEND="D KEY^DID" G G
28 S DHIT="D ^DID1",DHD="W """" D ^DIDH",(FR,TO)="",DIOEND="D END^DID"
29 I +Y=6 S DHIT="D ^DIDG",DIOEND="D END^DIDG"
30 I +Y=2 S DHIT="D ^DIDX",DIDX=0,%=2 I '$D(DIFORMAT) D AH^DIDX G KL:%<1
31 I +Y=7 S DHIT="S (X1,X2)=DFF D ^DIDC",DHD="@" S DIOEND="D IOF^DID"
32 I "^1^2^4^"[(U_+Y_U),'$D(DIGR) D ASKRANGE(DFF,BY,.FR,.TO) G:FR=-1 KL S DIDRANGE=FR]""
33G Q:DIB=0 S DIOEND(1)=DIOEND,DIOEND="D LOOP^DID" D EN1^DIP G KL
34LOOP I $D(Y),Y=U Q
35 X DIOEND(1) I $D(M),M=U Q
36 I IOST?1"C-".E W $C(7) R X:DTIME I X[U!'$T Q
37 S DN=1,D0=0,DIB=$O(^DIC(+DIB)) Q:DIB>DIB(1)!(+DIB'=DIB) S (F(1),DUB,DFF)=DIB,DC="," D ^DIO2 I $D(M),M=U Q
38 G LOOP
39 ;
40END ;
41 I $D(^UTILITY($J,"P")) W !!!?6,"FILES POINTED TO",?44,"FIELDS",! D PTR^DIDC
42D K ^UTILITY($J,"P") G IOF:DHIT["DIDX"!$G(DIDRANGE)
43 D IX I M=U S DN=0 Q
44T ;
45 S S=0,M=1
46T1 S S=S+1 D:$Y+3>IOSL HDR^DIDG Q:M=U
47 W !!,$S(S<4:$P("INPU^PRIN^SOR",U,S)_"T TEMPLATE(S):",1:"FORM(S)/BLOCK(S):")
48 S DFF="^DI"_$P("E^PT^BT^ST(.403)",U,S),DA=""
49 F S DA=$O(@DFF@("F"_F(1),DA)) Q:DA="" D Q:M=U
50 . S DUB=0 F S DUB=$O(@DFF@("F"_F(1),DA,DUB)) Q:'DUB D Q:M=U
51 .. I $D(@DFF@(DUB,0))#2 S %1=^(0) D TEMPL
52 K %1 G Q:M=U,T1:S<4
53IOF W:IOST'?1"C".E @IOF Q
54 ;
55TEMPL I $Y+3>IOSL D HDR^DIDG Q:M=U
56 W !,$P(%1,U),?30 G:DFF["DIST" FORM
57 S W="",Y=$P(%1,U,2) I Y D DD^%DT W Y
58 W ?50,"USER #"_+$P(%1,U,5),?61 I $D(@(DFF_"(DUB,""ROU"")")) W ^("ROU")_$P("*",U,DFF["DIBT")_" "
59 I $D(^("H")) S Y=^("H"),%=$L(Y) W:65+%>IOM ! W " ",?IOM-%-1,$E(Y,1,IOM-4)
60 G DES:DFF'="^DIBT"
61 I $D(^("DIPT")) W ?55 S Y=" '"_^("DIPT")_"' Print Template always used" W:$X+$L(Y)>IOM ! W ?IOM-$L(Y)-1,Y
62 I $D(^(2)) S D0=DUB,DICMX="W !?4,X" X $P(^DD(.401,1620,0),U,5,99)
63 F Y=1:1 Q:'$D(^DIBT(DUB,"O",Y,0)) W " " S %=^(0),D=IOM-$L(%)-5 W:$X>D !?$S(D>55:55,1:D) W %
64DES N A1,%1,X S A1=$P($G(@(DFF_"(DUB,""%D"",0)")),U,3) F %1=0:0 S %1=$O(@(DFF_"(DUB,""%D"",%1)")) Q:%1'>0 Q:+A1&(%1>A1) S X=^(%1,0) W !,?5,X
65Q W:DFF["DIBT" ! Q
66DT G DT^DIO2
67 ;
68EN ;
69 Q:'$D(DIC) I 'DIC,$D(@(DIC_"0)")) S DIC=+$P(^(0),U,2)
70 Q:'DIC!'$D(^DIC(DIC,0,"GL")) S (DFF,DUB,DIB,DIB(1))=DIC
71 G O:'$D(DIFORMAT) S Y=DIFORMAT I 'Y S Y=$O(^DOPT("DID","B",Y,0))
72 Q:Y>9!'Y G O1
73 ;
74FORM ;
75 S Y=$P(%1,U,5) I Y D DD^%DT W ?30,Y
76 W ?50,"USER #"_+$P(%1,U,4)
77 ;
78 N B,L,P
79 S L=1,L(1)=U
80 S P=0 F S P=$O(^DIST(.403,DUB,40,P)) Q:'P D Q:M=U
81 . Q:$D(^DIST(.403,DUB,40,P,0))[0 S B=$P(^(0),U,2) D:B BLOCK Q:M=U
82 . S B=0 F S B=$O(^DIST(.403,DUB,40,P,40,B)) Q:'B D BLOCK Q:M=U
83 S %1=0 F S %1=$O(@DFF@(DUB,15,%1)) Q:'%1 W:$D(^(%1,0))#2 !?5,^(0)
84 W !
85 Q
86BLOCK ;
87 N I
88 F I=1:1:L I L(I)[(U_B_U) G BLOCKQ
89 S:$L(L)+$L(B)+1>245 L=L+1,L(L)=U S L(L)=L(L)_B_U
90 Q:$D(^DIST(.404,B,0))[0 S %1=^(0)
91 ;
92 I $Y+3>IOSL D HDR^DIDG Q:M=U
93 W !?2,$P(%1,U) W:$P(%1,U,2)]"" ?32,"DD #"_$P(%1,U,2)
94BLOCKQ Q
95 ;
96IX ;Print index details
97 N DIDPG,DIDFLG
98 S DIDPG("H")="W """" D IXHEAD^DID S:M=U PAGE(U)=1"
99 D WRLN^DIKCP("",0,.DIDPG) Q:M=U
100 I DHIT="S F(1)=DFF" D
101 . S DIDFLG=$S(DIDTYP="B":"",DIDTYP="T":"O",1:"FR")_$E("M",'$G(DIDFLD))
102 E S DIDFLG="RM"
103 S DIDFLG=DIDFLG_"SL2"_$E("N",$D(DINM)#2)
104 D PRINT^DIKCP(F(1),$G(DIDFLD),DIDFLG,.DIDPG)
105 Q
106 ;
107IXHEAD S DC=DC+1 I IOST?1"C".E W $C(7) R M:DTIME S:'$T M=U Q:M=U
108IXHEAD1 W:$D(DIFF)&($Y) @IOF S DIFF=1
109 W $S("B"[$G(DIDTYP):"INDEX AND CROSS-REFERENCE",DIDTYP="T":"TRADITIONAL CROSS-REFERENCE",1:"NEW-STYLE INDEX")
110 W " LIST -- FILE #"_DIB_$S($G(DIDFLD):", FIELD #"_DIDFLD,1:"")
111 W ?(IOM-20),$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)_" PAGE "_DC
112 S M="",$P(M,"-",IOM)="" W !,M
113 Q
114 ;
115KEY ;Print keys
116 N DIDPG
117 S DIDPG("H")="W """" D KEYHEAD^DID S:M=U PAGE(U)=1"
118 D WRLN^DIKKP("",0,.DIDPG) Q:M=U
119 D PRINT^DIKKP(F(1),"","ML2",.DIDPG)
120 Q
121 ;
122KEYHEAD S DC=DC+1 I IOST?1"C".E W $C(7) R M:DTIME S:'$T M=U Q:M=U
123KEYHEAD1 W:$D(DIFF)&($Y) @IOF S DIFF=1 W "KEY LIST -- FILE #"_DIB,?(IOM-20),$E(DT,4,5)_"/"_$E(DT,6,7)_"/"_$E(DT,2,3)_" PAGE "_DC
124 S M="",$P(M,"-",IOM)="" W !,M
125 Q
126 ;
127ASKFLD(DIDFILE) ;Ask for a single field
128 Q:'$G(DIDFILE) ""
129 ;
130 N %,D,D0,DA,DDD,DIC,DICR,DIX,DO,DP,DZ,X,Y,DTOUT,DUOUT
131 S DIC="^DD("_DIDFILE_",",DIC(0)="QAEN"
132 S DIC("S")="I '$P(^(0),U,2)&($P(^(0),U,2)'[""C"")"
133 S DIC("A")="Which field: ALL// "
134 D ^DIC K DIC
135 Q $S(X="":"",1:+Y)
136 ;
137ASKTYP() ;Ask for type of cross-reference
138 N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
139 S DIR(0)="SAM^T:TRADITIONAL;N:NEW;B:BOTH"
140 S DIR("A")="What type of cross-reference (Traditional or New)? "
141 S DIR("B")="Both"
142 S DIR("?",1)="Enter 'T' to print only traditional cross-references."
143 S DIR("?",2)=" Traditional cross references are stored in the data"
144 S DIR("?",3)=" dictionary under ^DD(file#,field#,1)."
145 S DIR("?",4)=" "
146 S DIR("?",5)="Enter 'N' to print only new-style cross-references."
147 S DIR("?",6)=" New-Style cross references are stored in the Index file."
148 S DIR("?",7)=" "
149 S DIR("?")="Enter 'B' to print both kinds of cross-references."
150 D ^DIR
151 Q $S($D(DIRUT):"",1:Y)
152 ;
153ASKRANGE(DIDFILE,DIDBY,DIDFR,DIDTO) ;Ask for a range of fields
154 Q:'$G(DIDFILE)
155 ;
156 N %,D,D0,DA,DDD,DIC,DICR,DIX,DO,DP,DZ,X,Y,DTOUT,DUOUT
157 S DIC="^DD("_DIDFILE_",",DIC(0)="QAEN"
158 S DIC("A")="Start with field: FIRST// "
159 D ^DIC K DIC
160 I X="" S (DIDFR,DIDTO)="" Q
161 I Y=-1 S (DIDFR,DIDTO)=-1 Q
162 S DIDFR=$S(DIDBY[".001":+Y,1:$P(Y,U,2))
163 ;
164 S DIC="^DD("_DIDFILE_",",DIC(0)="QAEN"
165 S DIC("A")="Go to field: "
166 D ^DIC K DIC
167 I X="" S DIDTO="" Q
168 I Y=-1 S (DIDFR,DIDTO)=-1 Q
169 S DIDTO=$S(DIDBY[".001":+Y,1:$P(Y,U,2))
170 ;
171 S:DIDTO']]DIDFR %=DIDTO,DIDTO=DIDFR,DIDFR=%
172 Q
173 ;
174FILELST(DIDROOT) ;
175 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
176 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
177 N DIDARRAY
178 D EN4^DIQGDD
179 M @DIDROOT=DIDARRAY
180 Q
181 ;
182FILE(DIQGR,DIQGPARM,DR,DIQGTA,DIQGERRA,DIQGIPAR) ;
183 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
184 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
185 G EN2^DIQGDDF
186 ;
187FIELDLST(DIDROOT) ;
188 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
189 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
190 N DIDARRAY
191 D EN5^DIQGDD
192 M @DIDROOT=DIDARRAY
193 Q
194 ;
195FIELD(DIQGR,DA,DIQGPARM,DR,DIQGTA,DIQGERRA,DIQGIPAR) ;
196 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
197 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
198 G EN1^DIQGDD
199 ;
200GET1(DIQGR,DA,DIQGPARM,DR,DIQGETA,DIQGERRA,DIQGIPAR) ;
201 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
202 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
203 G EN3^DIQGDD
204 ;
205PIECE(DIQGR,DA,DIQGPARM,DR,DIQGTA,DIQGERRA,DIQGIPAR) ;CLOSEDREF,PIECE,FLAG,ATTRIBUTE,TARGETARRAY,ERRORARRAY,INTERNAL
206 ;PROCEDURE CALL AND * * RETURN RESULTS IN TARGET ARRAY * *
207 I '$D(DIQUIET) N DIQUIET S DIQUIET=1
208 I '$D(DIFM) N DIFM S DIFM=1 D INIZE^DIEFU
209 G EN6^DIQGDD0
Note: See TracBrowser for help on using the repository browser.