Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DINIT2A5

DINIT2A5.m

Go to the documentation of this file.
  1. DINIT2A5 ;SFISC/MKO-KEY AND INDEX FILES ;10:50 AM 30 Mar 1999
  1. ;;22.0;VA FileMan;;Mar 30, 1999
  1. ;Per VHA Directive 10-93-142, this routine should not be modified.
  1. 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
  1. G ^DINIT2A6
  1. Q Q
  1. ;;^DIC(.31,0,"GL")
  1. ;;=^DD("KEY",
  1. ;;^DIC("B","KEY",.31)
  1. ;;=
  1. ;;^DIC(.31,"%D",0)
  1. ;;=^^12^12^2980911^
  1. ;;^DIC(.31,"%D",1,0)
  1. ;;=This file stores information about keys on a file or subfile. A key is a
  1. ;;^DIC(.31,"%D",2,0)
  1. ;;=set of one or more fields that uniquely identifies a record in a file. If
  1. ;;^DIC(.31,"%D",3,0)
  1. ;;=more than one set of fields can uniquely identify a record, one of those
  1. ;;^DIC(.31,"%D",4,0)
  1. ;;=sets should be designated the primary key; all others should be designated
  1. ;;^DIC(.31,"%D",5,0)
  1. ;;=secondary keys. The primary key is the principal means of identifying
  1. ;;^DIC(.31,"%D",6,0)
  1. ;;=records in the file.
  1. ;;^DIC(.31,"%D",7,0)
  1. ;;=
  1. ;;^DIC(.31,"%D",8,0)
  1. ;;=To allow FileMan to enforce key uniqueness, the database designer must
  1. ;;^DIC(.31,"%D",9,0)
  1. ;;=define a regular index that consists of all the fields that make up the
  1. ;;^DIC(.31,"%D",10,0)
  1. ;;=key. This index is called the uniqueness index.
  1. ;;^DIC(.31,"%D",11,0)
  1. ;;=
  1. ;;^DIC(.31,"%D",12,0)
  1. ;;=All key fields must have values. They cannot be null.
  1. ;;^DD(.31,0)
  1. ;;=FIELD^^3^5
  1. ;;^DD(.31,0,"DDA")
  1. ;;=N
  1. ;;^DD(.31,0,"DT")
  1. ;;=2980611
  1. ;;^DD(.31,0,"IX","B",.31,.01)
  1. ;;=
  1. ;;^DD(.31,0,"NM","KEY")
  1. ;;=
  1. ;;^DD(.31,.01,0)
  1. ;;=FILE^RNJ20,7^^0;1^K:+X'=X!(X>999999999999)!(X<0)!(X?.E1"."8N.N) X
  1. ;;^DD(.31,.01,1,0)
  1. ;;=^.1^^-1
  1. ;;^DD(.31,.01,1,1,0)
  1. ;;=.31^B
  1. ;;^DD(.31,.01,1,1,1)
  1. ;;=S ^DD("KEY","B",$E(X,1,30),DA)=""
  1. ;;^DD(.31,.01,1,1,2)
  1. ;;=K ^DD("KEY","B",$E(X,1,30),DA)
  1. ;;^DD(.31,.01,1,1,3)
  1. ;;=Lets developers pick keys by their file number
  1. ;;^DD(.31,.01,1,1,"%D",0)
  1. ;;=^^2^2^2980911^^
  1. ;;^DD(.31,.01,1,1,"%D",1,0)
  1. ;;=The B index on the .01 (File) of the Key file lets developers pick keys by
  1. ;;^DD(.31,.01,1,1,"%D",2,0)
  1. ;;=the file whose records they uniquely distinguish.
  1. ;;^DD(.31,.01,3)
  1. ;;=Type a Number between 0 and 999999999999, 7 Decimal Digits. Answer '??' for more help.
  1. ;;^DD(.31,.01,4)
  1. ;;=
  1. ;;^DD(.31,.01,21,0)
  1. ;;=^^2^2^2980908^
  1. ;;^DD(.31,.01,21,1,0)
  1. ;;=Answer should be the number of the file or subfile identified by this key.
  1. ;;^DD(.31,.01,21,2,0)
  1. ;;=A file may have more than one key, but only one primary key.
  1. ;;^DD(.31,.01,"DT")
  1. ;;=2980611
  1. ;;^DD(.31,.02,0)
  1. ;;=NAME^RF^^0;2^K:$L(X)>1!($L(X)<1)!'(X?1U) X
  1. ;;^DD(.31,.02,3)
  1. ;;=Answer must be 1 upper case letter. Answer '??' for more help.
  1. ;;^DD(.31,.02,4)
  1. ;;=
  1. ;;^DD(.31,.02,21,0)
  1. ;;=^^3^3^2980908^^
  1. ;;^DD(.31,.02,21,1,0)
  1. ;;=Answer must be the name of this key. The name of a file's primary key
  1. ;;^DD(.31,.02,21,2,0)
  1. ;;=should be A, with subsequent keys for the same file named B, C, and so
  1. ;;^DD(.31,.02,21,3,0)
  1. ;;=on.
  1. ;;^DD(.31,.02,"DT")
  1. ;;=2960122
  1. ;;^DD(.31,1,0)
  1. ;;=PRIORITY^RS^P:PRIMARY;S:SECONDARY;^0;3^Q
  1. ;;^DD(.31,1,3)
  1. ;;=Answer '??' for more help.
  1. ;;^DD(.31,1,21,0)
  1. ;;=^^2^2^2980911^
  1. ;;^DD(.31,1,21,1,0)
  1. ;;=Answer 'PRIMARY' if this is the primary key of the file, the key that will
  1. ;;^DD(.31,1,21,2,0)
  1. ;;=usually be used for identifying entries. Otherwise, answer 'SECONDARY'.
  1. ;;^DD(.31,1,"DT")
  1. ;;=2970725
  1. ;;^DD(.31,2,0)
  1. ;;=FIELD^.312IA^^2;0
  1. ;;^DD(.31,2,"DT")
  1. ;;=2980310
  1. ;;^DD(.31,3,0)
  1. ;;=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
  1. ;;^DD(.31,3,3)
  1. ;;=Answer '??' for more help.
  1. ;;^DD(.31,3,12)
  1. ;;=Root File of Index must equal File of Key.
  1. ;;^DD(.31,3,12.1)
  1. ;;=S DIC("S")="I 1 Q:'$D(DDS)!'$D(DIKKEY) I $P(^(0),U,9)=$P(^DD(""KEY"",DIKKEY,0),U)"
  1. ;;^DD(.31,3,21,0)
  1. ;;=^^3^3^2981120^
  1. ;;^DD(.31,3,21,1,0)
  1. ;;=Answer with the index that FileMan should use to ensure that new key
  1. ;;^DD(.31,3,21,2,0)
  1. ;;=values are unique. It must be a new-style index that resides in the
  1. ;;^DD(.31,3,21,3,0)
  1. ;;=Index file, and must cross-reference the key fields in proper sequence.
  1. ;;^DD(.31,3,"DT")
  1. ;;=2980611
  1. ;;^DD(.312,0)
  1. ;;=FIELD SUB-FIELD^^1^3
  1. ;;^DD(.312,0,"DT")
  1. ;;=2960219
  1. ;;^DD(.312,0,"ID","WRITE")
  1. ;;=D EN^DDIOL(" "_$P(^(0),U,2),"","?0")
  1. ;;^DD(.312,0,"IX","B",.312,.01)
  1. ;;=
  1. ;;^DD(.312,0,"NM","FIELD")
  1. ;;=
  1. ;;^DD(.312,0,"UP")
  1. ;;=.31
  1. ;;^DD(.312,.01,0)
  1. ;;=FIELD^MRFX^^0;1^D ITFLD^DIKKDD I $D(X) K:$L(X)>20!($L(X)<1) X
  1. ;;^DD(.312,.01,1,0)
  1. ;;=^.1
  1. ;;^DD(.312,.01,1,1,0)
  1. ;;=.312^B
  1. ;;^DD(.312,.01,1,1,1)
  1. ;;=S ^DD("KEY",DA(1),2,"B",$E(X,1,30),DA)=""
  1. ;;^DD(.312,.01,1,1,2)
  1. ;;=K ^DD("KEY",DA(1),2,"B",$E(X,1,30),DA)
  1. ;;^DD(.312,.01,1,1,3)
  1. ;;=LETS DEVELOPER PICK KEY FIELDS BY NUMBER
  1. ;;^DD(.312,.01,1,1,"%D",0)
  1. ;;=^^2^2^2980908^
  1. ;;^DD(.312,.01,1,1,"%D",1,0)
  1. ;;=The B index, on the .01 (Field) of the Fields multiple, lets the developer
  1. ;;^DD(.312,.01,1,1,"%D",2,0)
  1. ;;=pick key fields by field number.
  1. ;;^DD(.312,.01,1,2,0)
  1. ;;=^^TRIGGER^.312^.02
  1. ;;^DD(.312,.01,1,2,1)
  1. ;;=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)
  1. ;;^DD(.312,.01,1,2,1.1)
  1. ;;=S X=DIV S X=$P(^DD("KEY",DA(1),0),U)
  1. ;;^DD(.312,.01,1,2,1.4)
  1. ;;=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
  1. ;;^DD(.312,.01,1,2,2)
  1. ;;=Q
  1. ;;^DD(.312,.01,1,2,"CREATE VALUE")
  1. ;;=S X=$P(^DD("KEY",DA(1),0),U)
  1. ;;^DD(.312,.01,1,2,"DELETE VALUE")
  1. ;;=NO EFFECT
  1. ;;^DD(.312,.01,1,2,"DT")
  1. ;;=2980310
  1. ;;^DD(.312,.01,1,2,"FIELD")
  1. ;;=FILE
  1. ;;^DD(.312,.01,3)
  1. ;;=Answer must be 1-20 characters in length. Answer '??' for more help.
  1. ;;^DD(.312,.01,4)
  1. ;;=D EHFLD^DIKKDD
  1. ;;^DD(.312,.01,21,0)
  1. ;;=^^1^1^2980908^
  1. ;;^DD(.312,.01,21,1,0)
  1. ;;=Answer must be the number of one of this key's fields.
  1. ;;^DD(.312,.01,"DT")
  1. ;;=2980611
  1. ;;^DD(.312,.02,0)
  1. ;;=FILE^RNJ20,7I^^0;2^K:+X'=X!(X>999999999999)!(X<0)!(X?.E1"."8N.N) X
  1. ;;^DD(.312,.02,.1)
  1. ;;=
  1. ;;^DD(.312,.02,1,0)
  1. ;;=^.1^^0
  1. ;;^DD(.312,.02,3)
  1. ;;=Type a Number between 0 and 999999999999, 7 Decimal Digits. Answer '??' for more help.
  1. ;;^DD(.312,.02,5,1,0)
  1. ;;=.312^.01^2
  1. ;;^DD(.312,.02,21,0)
  1. ;;=^^3^3^2980908^
  1. ;;^DD(.312,.02,21,1,0)
  1. ;;=Answer must be the number of the file that holds this key field. It must
  1. ;;^DD(.312,.02,21,2,0)
  1. ;;=equal the number of the file whose records are uniquiely identified by
  1. ;;^DD(.312,.02,21,3,0)
  1. ;;=this key.
  1. ;;^DD(.312,.02,"DT")
  1. ;;=2980908
  1. ;;^DD(.312,1,0)
  1. ;;=SEQUENCE NUMBER^RNJ3,0^^0;3^K:+X'=X!(X>125)!(X<1)!(X?.E1"."1N.N) X
  1. ;;^DD(.312,1,3)
  1. ;;=Answer must be between 1 and 125, with no decimal digits. Answer '??' for more help.