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

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

initial load of FOIAVistA 6/30/08 version

File size: 6.6 KB
Line 
1DINIT2A5 ;SFISC/MKO-KEY AND INDEX FILES ;10:50 AM 30 Mar 1999
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 F I=1:2 S X=$T(Q+I) Q:X="" S Y=$E($T(Q+I+1),4,999),X=$E(X,4,999) S:$A(Y)=126 I=I+1,Y=$E(Y,2,999)_$E($T(Q+I+1),5,99) S:$A(Y)=61 Y=$E(Y,2,999) S @X=Y
5 G ^DINIT2A6
6Q Q
7 ;;^DIC(.31,0,"GL")
8 ;;=^DD("KEY",
9 ;;^DIC("B","KEY",.31)
10 ;;=
11 ;;^DIC(.31,"%D",0)
12 ;;=^^12^12^2980911^
13 ;;^DIC(.31,"%D",1,0)
14 ;;=This file stores information about keys on a file or subfile. A key is a
15 ;;^DIC(.31,"%D",2,0)
16 ;;=set of one or more fields that uniquely identifies a record in a file. If
17 ;;^DIC(.31,"%D",3,0)
18 ;;=more than one set of fields can uniquely identify a record, one of those
19 ;;^DIC(.31,"%D",4,0)
20 ;;=sets should be designated the primary key; all others should be designated
21 ;;^DIC(.31,"%D",5,0)
22 ;;=secondary keys. The primary key is the principal means of identifying
23 ;;^DIC(.31,"%D",6,0)
24 ;;=records in the file.
25 ;;^DIC(.31,"%D",7,0)
26 ;;=
27 ;;^DIC(.31,"%D",8,0)
28 ;;=To allow FileMan to enforce key uniqueness, the database designer must
29 ;;^DIC(.31,"%D",9,0)
30 ;;=define a regular index that consists of all the fields that make up the
31 ;;^DIC(.31,"%D",10,0)
32 ;;=key. This index is called the uniqueness index.
33 ;;^DIC(.31,"%D",11,0)
34 ;;=
35 ;;^DIC(.31,"%D",12,0)
36 ;;=All key fields must have values. They cannot be null.
37 ;;^DD(.31,0)
38 ;;=FIELD^^3^5
39 ;;^DD(.31,0,"DDA")
40 ;;=N
41 ;;^DD(.31,0,"DT")
42 ;;=2980611
43 ;;^DD(.31,0,"IX","B",.31,.01)
44 ;;=
45 ;;^DD(.31,0,"NM","KEY")
46 ;;=
47 ;;^DD(.31,.01,0)
48 ;;=FILE^RNJ20,7^^0;1^K:+X'=X!(X>999999999999)!(X<0)!(X?.E1"."8N.N) X
49 ;;^DD(.31,.01,1,0)
50 ;;=^.1^^-1
51 ;;^DD(.31,.01,1,1,0)
52 ;;=.31^B
53 ;;^DD(.31,.01,1,1,1)
54 ;;=S ^DD("KEY","B",$E(X,1,30),DA)=""
55 ;;^DD(.31,.01,1,1,2)
56 ;;=K ^DD("KEY","B",$E(X,1,30),DA)
57 ;;^DD(.31,.01,1,1,3)
58 ;;=Lets developers pick keys by their file number
59 ;;^DD(.31,.01,1,1,"%D",0)
60 ;;=^^2^2^2980911^^
61 ;;^DD(.31,.01,1,1,"%D",1,0)
62 ;;=The B index on the .01 (File) of the Key file lets developers pick keys by
63 ;;^DD(.31,.01,1,1,"%D",2,0)
64 ;;=the file whose records they uniquely distinguish.
65 ;;^DD(.31,.01,3)
66 ;;=Type a Number between 0 and 999999999999, 7 Decimal Digits. Answer '??' for more help.
67 ;;^DD(.31,.01,4)
68 ;;=
69 ;;^DD(.31,.01,21,0)
70 ;;=^^2^2^2980908^
71 ;;^DD(.31,.01,21,1,0)
72 ;;=Answer should be the number of the file or subfile identified by this key.
73 ;;^DD(.31,.01,21,2,0)
74 ;;=A file may have more than one key, but only one primary key.
75 ;;^DD(.31,.01,"DT")
76 ;;=2980611
77 ;;^DD(.31,.02,0)
78 ;;=NAME^RF^^0;2^K:$L(X)>1!($L(X)<1)!'(X?1U) X
79 ;;^DD(.31,.02,3)
80 ;;=Answer must be 1 upper case letter. Answer '??' for more help.
81 ;;^DD(.31,.02,4)
82 ;;=
83 ;;^DD(.31,.02,21,0)
84 ;;=^^3^3^2980908^^
85 ;;^DD(.31,.02,21,1,0)
86 ;;=Answer must be the name of this key. The name of a file's primary key
87 ;;^DD(.31,.02,21,2,0)
88 ;;=should be A, with subsequent keys for the same file named B, C, and so
89 ;;^DD(.31,.02,21,3,0)
90 ;;=on.
91 ;;^DD(.31,.02,"DT")
92 ;;=2960122
93 ;;^DD(.31,1,0)
94 ;;=PRIORITY^RS^P:PRIMARY;S:SECONDARY;^0;3^Q
95 ;;^DD(.31,1,3)
96 ;;=Answer '??' for more help.
97 ;;^DD(.31,1,21,0)
98 ;;=^^2^2^2980911^
99 ;;^DD(.31,1,21,1,0)
100 ;;=Answer 'PRIMARY' if this is the primary key of the file, the key that will
101 ;;^DD(.31,1,21,2,0)
102 ;;=usually be used for identifying entries. Otherwise, answer 'SECONDARY'.
103 ;;^DD(.31,1,"DT")
104 ;;=2970725
105 ;;^DD(.31,2,0)
106 ;;=FIELD^.312IA^^2;0
107 ;;^DD(.31,2,"DT")
108 ;;=2980310
109 ;;^DD(.31,3,0)
110 ;;=UNIQUENESS INDEX^*P.11'^DD("IX",^0;4^S DIC("S")="I 1 Q:'$D(DDS)!'$D(DIKKEY) I $P(^(0),U,9)=$P(^DD(""KEY"",DIKKEY,0),U)" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
111 ;;^DD(.31,3,3)
112 ;;=Answer '??' for more help.
113 ;;^DD(.31,3,12)
114 ;;=Root File of Index must equal File of Key.
115 ;;^DD(.31,3,12.1)
116 ;;=S DIC("S")="I 1 Q:'$D(DDS)!'$D(DIKKEY) I $P(^(0),U,9)=$P(^DD(""KEY"",DIKKEY,0),U)"
117 ;;^DD(.31,3,21,0)
118 ;;=^^3^3^2981120^
119 ;;^DD(.31,3,21,1,0)
120 ;;=Answer with the index that FileMan should use to ensure that new key
121 ;;^DD(.31,3,21,2,0)
122 ;;=values are unique. It must be a new-style index that resides in the
123 ;;^DD(.31,3,21,3,0)
124 ;;=Index file, and must cross-reference the key fields in proper sequence.
125 ;;^DD(.31,3,"DT")
126 ;;=2980611
127 ;;^DD(.312,0)
128 ;;=FIELD SUB-FIELD^^1^3
129 ;;^DD(.312,0,"DT")
130 ;;=2960219
131 ;;^DD(.312,0,"ID","WRITE")
132 ;;=D EN^DDIOL(" "_$P(^(0),U,2),"","?0")
133 ;;^DD(.312,0,"IX","B",.312,.01)
134 ;;=
135 ;;^DD(.312,0,"NM","FIELD")
136 ;;=
137 ;;^DD(.312,0,"UP")
138 ;;=.31
139 ;;^DD(.312,.01,0)
140 ;;=FIELD^MRFX^^0;1^D ITFLD^DIKKDD I $D(X) K:$L(X)>20!($L(X)<1) X
141 ;;^DD(.312,.01,1,0)
142 ;;=^.1
143 ;;^DD(.312,.01,1,1,0)
144 ;;=.312^B
145 ;;^DD(.312,.01,1,1,1)
146 ;;=S ^DD("KEY",DA(1),2,"B",$E(X,1,30),DA)=""
147 ;;^DD(.312,.01,1,1,2)
148 ;;=K ^DD("KEY",DA(1),2,"B",$E(X,1,30),DA)
149 ;;^DD(.312,.01,1,1,3)
150 ;;=LETS DEVELOPER PICK KEY FIELDS BY NUMBER
151 ;;^DD(.312,.01,1,1,"%D",0)
152 ;;=^^2^2^2980908^
153 ;;^DD(.312,.01,1,1,"%D",1,0)
154 ;;=The B index, on the .01 (Field) of the Fields multiple, lets the developer
155 ;;^DD(.312,.01,1,1,"%D",2,0)
156 ;;=pick key fields by field number.
157 ;;^DD(.312,.01,1,2,0)
158 ;;=^^TRIGGER^.312^.02
159 ;;^DD(.312,.01,1,2,1)
160 ;;=K DIV S DIV=X,D0=DA(1),DIV(0)=D0,D1=DA,DIV(1)=D1 S Y(1)=$S($D(^DD("KEY",D0,2,D1,0)):^(0),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y X ^DD(.312,.01,1,2,1.1) X ^DD(.312,.01,1,2,1.4)
161 ;;^DD(.312,.01,1,2,1.1)
162 ;;=S X=DIV S X=$P(^DD("KEY",DA(1),0),U)
163 ;;^DD(.312,.01,1,2,1.4)
164 ;;=S DIH=$S($D(^DD("KEY",DIV(0),2,DIV(1),0)):^(0),1:""),DIV=X S $P(^(0),U,2)=DIV,DIH=.312,DIG=.02 D ^DICR:$O(^DD(DIH,DIG,1,0))>0
165 ;;^DD(.312,.01,1,2,2)
166 ;;=Q
167 ;;^DD(.312,.01,1,2,"CREATE VALUE")
168 ;;=S X=$P(^DD("KEY",DA(1),0),U)
169 ;;^DD(.312,.01,1,2,"DELETE VALUE")
170 ;;=NO EFFECT
171 ;;^DD(.312,.01,1,2,"DT")
172 ;;=2980310
173 ;;^DD(.312,.01,1,2,"FIELD")
174 ;;=FILE
175 ;;^DD(.312,.01,3)
176 ;;=Answer must be 1-20 characters in length. Answer '??' for more help.
177 ;;^DD(.312,.01,4)
178 ;;=D EHFLD^DIKKDD
179 ;;^DD(.312,.01,21,0)
180 ;;=^^1^1^2980908^
181 ;;^DD(.312,.01,21,1,0)
182 ;;=Answer must be the number of one of this key's fields.
183 ;;^DD(.312,.01,"DT")
184 ;;=2980611
185 ;;^DD(.312,.02,0)
186 ;;=FILE^RNJ20,7I^^0;2^K:+X'=X!(X>999999999999)!(X<0)!(X?.E1"."8N.N) X
187 ;;^DD(.312,.02,.1)
188 ;;=
189 ;;^DD(.312,.02,1,0)
190 ;;=^.1^^0
191 ;;^DD(.312,.02,3)
192 ;;=Type a Number between 0 and 999999999999, 7 Decimal Digits. Answer '??' for more help.
193 ;;^DD(.312,.02,5,1,0)
194 ;;=.312^.01^2
195 ;;^DD(.312,.02,21,0)
196 ;;=^^3^3^2980908^
197 ;;^DD(.312,.02,21,1,0)
198 ;;=Answer must be the number of the file that holds this key field. It must
199 ;;^DD(.312,.02,21,2,0)
200 ;;=equal the number of the file whose records are uniquiely identified by
201 ;;^DD(.312,.02,21,3,0)
202 ;;=this key.
203 ;;^DD(.312,.02,"DT")
204 ;;=2980908
205 ;;^DD(.312,1,0)
206 ;;=SEQUENCE NUMBER^RNJ3,0^^0;3^K:+X'=X!(X>125)!(X<1)!(X?.E1"."1N.N) X
207 ;;^DD(.312,1,3)
208 ;;=Answer must be between 1 and 125, with no decimal digits. Answer '??' for more help.
Note: See TracBrowser for help on using the repository browser.