DINIT2A1 ;SFISC/MKO-KEY AND INDEX FILES ;8:42 AM  4 Jun 1999
 ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
 ;;Per VA Directive 6402, this routine should not be modified.
 ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
 ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
 ;;Licensed under the terms of the Apache License, Version 2.0.
 ;
 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
 G ^DINIT2A2
Q Q
 ;;^DD(.11,.42,21,5,0)
 ;;=the FileMan Sort and Print (EN1^DIP).
 ;;^DD(.11,.42,21,6,0)
 ;;= 
 ;;^DD(.11,.42,21,7,0)
 ;;=SORTING ONLY - The index name starts with "A". Calls to Classic FileMan
 ;;^DD(.11,.42,21,8,0)
 ;;=lookup (^DIC) or the Finder (FIND^DIC or $$FIND1^DIC) will not use this
 ;;^DD(.11,.42,21,9,0)
 ;;=index unless it is specified in the input parameters. The index will be
 ;;^DD(.11,.42,21,10,0)
 ;;=available for use by the FileMan Sort and Print (EN1^DIP).
 ;;^DD(.11,.42,21,11,0)
 ;;= 
 ;;^DD(.11,.42,21,12,0)
 ;;=ACTION - The index name starts with "A". This is used for M code that
 ;;^DD(.11,.42,21,13,0)
 ;;=performs some actions and does NOT build an index. Therefore, it is not
 ;;^DD(.11,.42,21,14,0)
 ;;=available for use by either the Classic FileMan lookup (^DIC), the Finder
 ;;^DD(.11,.42,21,15,0)
 ;;=(FIND^DIC or $$FIND1^DIC) or the Sort and Print (EN1^DIP).
 ;;^DD(.11,.42,"DT")
 ;;=2980416
 ;;^DD(.11,.5,0)
 ;;=ROOT TYPE^S^I:INDEX FILE;W:WHOLE FILE;^0;8^Q
 ;;^DD(.11,.5,3)
 ;;=Answer '??' for more help.
 ;;^DD(.11,.5,21,0)
 ;;=^^6^6^2980911^
 ;;^DD(.11,.5,21,1,0)
 ;;=Answer 'I' if the fields that make up the file are defined at the same
 ;;^DD(.11,.5,21,2,0)
 ;;=level at which the index is located.
 ;;^DD(.11,.5,21,3,0)
 ;;= 
 ;;^DD(.11,.5,21,4,0)
 ;;=Answer 'W' if this is a whole file cross-reference in which the fields
 ;;^DD(.11,.5,21,5,0)
 ;;=that make up the index are defined in a subfile, but the index is
 ;;^DD(.11,.5,21,6,0)
 ;;=physically located at a parent file level.
 ;;^DD(.11,.5,"DT")
 ;;=2980908
 ;;^DD(.11,.51,0)
 ;;=ROOT FILE^RNJ20,7^^0;9^K:+X'=X!(X>999999999999)!(X<0)!(X?.E1"."8N.N) X
 ;;^DD(.11,.51,1,0)
 ;;=^.1
 ;;^DD(.11,.51,1,1,0)
 ;;=.11^AC
 ;;^DD(.11,.51,1,1,1)
 ;;=S ^DD("IX","AC",$E(X,1,30),DA)=""
 ;;^DD(.11,.51,1,1,2)
 ;;=K ^DD("IX","AC",$E(X,1,30),DA)
 ;;^DD(.11,.51,1,1,3)
 ;;=Lets FileMan find indexes defined on fields from a particular file
 ;;^DD(.11,.51,1,1,"DT")
 ;;=2980929
 ;;^DD(.11,.51,3)
 ;;=Type a Number between 0 and 999999999999, 7 Decimal Digits. Answer '??' for more help.
 ;;^DD(.11,.51,21,0)
 ;;=^^3^3^2980910^
 ;;^DD(.11,.51,21,1,0)
 ;;=Answer with the number of the file or subfile where this index is defined.
 ;;^DD(.11,.51,21,2,0)
 ;;=For whole file indexes, answer with the subfile number, not the number of
 ;;^DD(.11,.51,21,3,0)
 ;;=the file where the index physically resides.
 ;;^DD(.11,.51,"DT")
 ;;=2980929
 ;;^DD(.11,1.1,0)
 ;;=SET LOGIC^RK^^1;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 ;;^DD(.11,1.1,3)
 ;;=Answer must be Standard M code. Answer '??' for more help.
 ;;^DD(.11,1.1,9)
 ;;=@
 ;;^DD(.11,1.1,21,0)
 ;;=^^16^16^2990430^^
 ;;^DD(.11,1.1,21,1,0)
 ;;=Answer with the M code that FileMan should execute when the values of
 ;;^DD(.11,1.1,21,2,0)
 ;;=fields that make up the cross-reference are set or changed. When field
 ;;^DD(.11,1.1,21,3,0)
 ;;=values are changed, FileMan executes first the KILL LOGIC, then the SET
 ;;^DD(.11,1.1,21,4,0)
 ;;=LOGIC.
 ;;^DD(.11,1.1,21,5,0)
 ;;= 
 ;;^DD(.11,1.1,21,6,0)
 ;;=Assume the DA array describes the record to be cross-referenced, and that
 ;;^DD(.11,1.1,21,7,0)
 ;;=the X(order#) array contains values after the transform for storage is
 ;;^DD(.11,1.1,21,8,0)
 ;;=applied, but before the truncation to the maximum length.  The variable X
 ;;^DD(.11,1.1,21,9,0)
 ;;=also equals X(order#) of the lowest order number.
 ;;^DD(.11,1.1,21,10,0)
 ;;= 
 ;;^DD(.11,1.1,21,11,0)
 ;;=When fields that make up a cross-reference are edited and the kill and set
 ;;^DD(.11,1.1,21,12,0)
 ;;=logic are executed, the X1(order#) array contains the old field values,
 ;;^DD(.11,1.1,21,13,0)
 ;;=and the X2(order#) array contains the new field values. If a record is
 ;;^DD(.11,1.1,21,14,0)
 ;;=being added, and there is an X1(order#) array element that corresponds to
 ;;^DD(.11,1.1,21,15,0)
 ;;=the .01 field, it is set to null. When a record is deleted, all X2(order#)
 ;;^DD(.11,1.1,21,16,0)
 ;;=array elements are null.
 ;;^DD(.11,1.1,"DT")
 ;;=2960116
 ;;^DD(.11,1.2,0)
 ;;=OVERFLOW SET LOGIC^.111^^1.2;0
 ;;^DD(.11,1.2,"DT")
 ;;=2960124
 ;;^DD(.11,1.3,0)
 ;;=SET CONDITION^F^^1.3;E1,245^K:$L(X)>245!($L(X)<1) X
 ;;^DD(.11,1.3,3)
 ;;=Answer must be a valid FileMan computed expression. Answer '??' for more help.
 ;;^DD(.11,1.3,21,0)
 ;;=^^5^5^2960124^
 ;;^DD(.11,1.3,21,1,0)
 ;;=Answer with a FileMan computed expression that will evaluate to Boolean
 ;;^DD(.11,1.3,21,2,0)
 ;;=true (according to the M rules for Boolean interpretation). FileMan will
 ;;^DD(.11,1.3,21,3,0)
 ;;=evaluate this expression whenever it would normally execute the
 ;;^DD(.11,1.3,21,4,0)
 ;;=cross-reference's Set Logic, and will not execute the Set Logic unless
 ;;^DD(.11,1.3,21,5,0)
 ;;=this condition evaluates to true.
 ;;^DD(.11,1.3,"DT")
 ;;=2960116
 ;;^DD(.11,1.4,0)
 ;;=SET CONDITION CODE^K^^1.4;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 ;;^DD(.11,1.4,3)
 ;;=This is Standard MUMPS code. Answer '??' for more help.
 ;;^DD(.11,1.4,9)
 ;;=@
 ;;^DD(.11,1.4,21,0)
 ;;=^^15^15^2990430^
 ;;^DD(.11,1.4,21,1,0)
 ;;=This is MUMPS code that sets the variable X. The SET LOGIC is executed
 ;;^DD(.11,1.4,21,2,0)
 ;;=only if the SET CONDTION, if present, sets X to Boolean true (according to
 ;;^DD(.11,1.4,21,3,0)
 ;;=M rules for Boolean interpretation).
 ;;^DD(.11,1.4,21,4,0)
 ;;= 
 ;;^DD(.11,1.4,21,5,0)
 ;;=Assume the DA array describes the record to be cross-referenced, and that
 ;;^DD(.11,1.4,21,6,0)
 ;;=the X(order#) array contains values after the transform for storage is
 ;;^DD(.11,1.4,21,7,0)
 ;;=applied, but before the truncation to the maximum length.  The variable X
 ;;^DD(.11,1.4,21,8,0)
 ;;=also equals X(order#) of the lowest order number.
 ;;^DD(.11,1.4,21,9,0)
 ;;= 
 ;;^DD(.11,1.4,21,10,0)
 ;;=When fields that make up a cross-reference are edited and the kill and set
 ;;^DD(.11,1.4,21,11,0)
 ;;=conditions are executed, the X1(order#) array contains the old field
 ;;^DD(.11,1.4,21,12,0)
 ;;=values, and the X2(order#) array contains the new field values. If a
 ;;^DD(.11,1.4,21,13,0)
 ;;=record is being added, and there is an X1(order#) array element that
 ;;^DD(.11,1.4,21,14,0)
 ;;=corresponds to the .01 field, it is set to null. When a record is deleted,
 ;;^DD(.11,1.4,21,15,0)
 ;;=all X2(order#) array elements are null.
 ;;^DD(.11,1.4,"DT")
 ;;=2970117
 ;;^DD(.11,2.1,0)
 ;;=KILL LOGIC^RK^^2;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 ;;^DD(.11,2.1,3)
 ;;=Answer must be Standard M code. Answer '??' for more help.
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDINIT2A1   7174     printed  Sep 23, 2025@20:27:31                                                                                                                                                                                                    Page 2
DINIT2A1  ;SFISC/MKO-KEY AND INDEX FILES ;8:42 AM  4 Jun 1999
 +1       ;;22.2;VA FileMan;;Jan 05, 2016;Build 42
 +2       ;;Per VA Directive 6402, this routine should not be modified.
 +3       ;;Submitted to OSEHRA 5 January 2015 by the VISTA Expertise Network.
 +4       ;;Based on Medsphere Systems Corporation's MSC FileMan 1051.
 +5       ;;Licensed under the terms of the Apache License, Version 2.0.
 +6       ;
 +7        FOR I=1:2
               SET X=$TEXT(Q+I)
               if X=""
                   QUIT 
               SET Y=$EXTRACT($TEXT(Q+I+1),4,999)
               SET X=$EXTRACT(X,4,999)
               if $ASCII(Y)=126
                   SET I=I+1
                   SET Y=$EXTRACT(Y,2,999)_$EXTRACT($TEXT(Q+I+1),5,99)
               if $ASCII(Y)=61
                   SET Y=$EXTRACT(Y,2,999)
               SET @X=Y
 +8        GOTO ^DINIT2A2
Q          QUIT 
 +1       ;;^DD(.11,.42,21,5,0)
 +2       ;;=the FileMan Sort and Print (EN1^DIP).
 +3       ;;^DD(.11,.42,21,6,0)
 +4       ;;= 
 +5       ;;^DD(.11,.42,21,7,0)
 +6       ;;=SORTING ONLY - The index name starts with "A". Calls to Classic FileMan
 +7       ;;^DD(.11,.42,21,8,0)
 +8       ;;=lookup (^DIC) or the Finder (FIND^DIC or $$FIND1^DIC) will not use this
 +9       ;;^DD(.11,.42,21,9,0)
 +10      ;;=index unless it is specified in the input parameters. The index will be
 +11      ;;^DD(.11,.42,21,10,0)
 +12      ;;=available for use by the FileMan Sort and Print (EN1^DIP).
 +13      ;;^DD(.11,.42,21,11,0)
 +14      ;;= 
 +15      ;;^DD(.11,.42,21,12,0)
 +16      ;;=ACTION - The index name starts with "A". This is used for M code that
 +17      ;;^DD(.11,.42,21,13,0)
 +18      ;;=performs some actions and does NOT build an index. Therefore, it is not
 +19      ;;^DD(.11,.42,21,14,0)
 +20      ;;=available for use by either the Classic FileMan lookup (^DIC), the Finder
 +21      ;;^DD(.11,.42,21,15,0)
 +22      ;;=(FIND^DIC or $$FIND1^DIC) or the Sort and Print (EN1^DIP).
 +23      ;;^DD(.11,.42,"DT")
 +24      ;;=2980416
 +25      ;;^DD(.11,.5,0)
 +26      ;;=ROOT TYPE^S^I:INDEX FILE;W:WHOLE FILE;^0;8^Q
 +27      ;;^DD(.11,.5,3)
 +28      ;;=Answer '??' for more help.
 +29      ;;^DD(.11,.5,21,0)
 +30      ;;=^^6^6^2980911^
 +31      ;;^DD(.11,.5,21,1,0)
 +32      ;;=Answer 'I' if the fields that make up the file are defined at the same
 +33      ;;^DD(.11,.5,21,2,0)
 +34      ;;=level at which the index is located.
 +35      ;;^DD(.11,.5,21,3,0)
 +36      ;;= 
 +37      ;;^DD(.11,.5,21,4,0)
 +38      ;;=Answer 'W' if this is a whole file cross-reference in which the fields
 +39      ;;^DD(.11,.5,21,5,0)
 +40      ;;=that make up the index are defined in a subfile, but the index is
 +41      ;;^DD(.11,.5,21,6,0)
 +42      ;;=physically located at a parent file level.
 +43      ;;^DD(.11,.5,"DT")
 +44      ;;=2980908
 +45      ;;^DD(.11,.51,0)
 +46      ;;=ROOT FILE^RNJ20,7^^0;9^K:+X'=X!(X>999999999999)!(X<0)!(X?.E1"."8N.N) X
 +47      ;;^DD(.11,.51,1,0)
 +48      ;;=^.1
 +49      ;;^DD(.11,.51,1,1,0)
 +50      ;;=.11^AC
 +51      ;;^DD(.11,.51,1,1,1)
 +52      ;;=S ^DD("IX","AC",$E(X,1,30),DA)=""
 +53      ;;^DD(.11,.51,1,1,2)
 +54      ;;=K ^DD("IX","AC",$E(X,1,30),DA)
 +55      ;;^DD(.11,.51,1,1,3)
 +56      ;;=Lets FileMan find indexes defined on fields from a particular file
 +57      ;;^DD(.11,.51,1,1,"DT")
 +58      ;;=2980929
 +59      ;;^DD(.11,.51,3)
 +60      ;;=Type a Number between 0 and 999999999999, 7 Decimal Digits. Answer '??' for more help.
 +61      ;;^DD(.11,.51,21,0)
 +62      ;;=^^3^3^2980910^
 +63      ;;^DD(.11,.51,21,1,0)
 +64      ;;=Answer with the number of the file or subfile where this index is defined.
 +65      ;;^DD(.11,.51,21,2,0)
 +66      ;;=For whole file indexes, answer with the subfile number, not the number of
 +67      ;;^DD(.11,.51,21,3,0)
 +68      ;;=the file where the index physically resides.
 +69      ;;^DD(.11,.51,"DT")
 +70      ;;=2980929
 +71      ;;^DD(.11,1.1,0)
 +72      ;;=SET LOGIC^RK^^1;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 +73      ;;^DD(.11,1.1,3)
 +74      ;;=Answer must be Standard M code. Answer '??' for more help.
 +75      ;;^DD(.11,1.1,9)
 +76      ;;=@
 +77      ;;^DD(.11,1.1,21,0)
 +78      ;;=^^16^16^2990430^^
 +79      ;;^DD(.11,1.1,21,1,0)
 +80      ;;=Answer with the M code that FileMan should execute when the values of
 +81      ;;^DD(.11,1.1,21,2,0)
 +82      ;;=fields that make up the cross-reference are set or changed. When field
 +83      ;;^DD(.11,1.1,21,3,0)
 +84      ;;=values are changed, FileMan executes first the KILL LOGIC, then the SET
 +85      ;;^DD(.11,1.1,21,4,0)
 +86      ;;=LOGIC.
 +87      ;;^DD(.11,1.1,21,5,0)
 +88      ;;= 
 +89      ;;^DD(.11,1.1,21,6,0)
 +90      ;;=Assume the DA array describes the record to be cross-referenced, and that
 +91      ;;^DD(.11,1.1,21,7,0)
 +92      ;;=the X(order#) array contains values after the transform for storage is
 +93      ;;^DD(.11,1.1,21,8,0)
 +94      ;;=applied, but before the truncation to the maximum length.  The variable X
 +95      ;;^DD(.11,1.1,21,9,0)
 +96      ;;=also equals X(order#) of the lowest order number.
 +97      ;;^DD(.11,1.1,21,10,0)
 +98      ;;= 
 +99      ;;^DD(.11,1.1,21,11,0)
 +100     ;;=When fields that make up a cross-reference are edited and the kill and set
 +101     ;;^DD(.11,1.1,21,12,0)
 +102     ;;=logic are executed, the X1(order#) array contains the old field values,
 +103     ;;^DD(.11,1.1,21,13,0)
 +104     ;;=and the X2(order#) array contains the new field values. If a record is
 +105     ;;^DD(.11,1.1,21,14,0)
 +106     ;;=being added, and there is an X1(order#) array element that corresponds to
 +107     ;;^DD(.11,1.1,21,15,0)
 +108     ;;=the .01 field, it is set to null. When a record is deleted, all X2(order#)
 +109     ;;^DD(.11,1.1,21,16,0)
 +110     ;;=array elements are null.
 +111     ;;^DD(.11,1.1,"DT")
 +112     ;;=2960116
 +113     ;;^DD(.11,1.2,0)
 +114     ;;=OVERFLOW SET LOGIC^.111^^1.2;0
 +115     ;;^DD(.11,1.2,"DT")
 +116     ;;=2960124
 +117     ;;^DD(.11,1.3,0)
 +118     ;;=SET CONDITION^F^^1.3;E1,245^K:$L(X)>245!($L(X)<1) X
 +119     ;;^DD(.11,1.3,3)
 +120     ;;=Answer must be a valid FileMan computed expression. Answer '??' for more help.
 +121     ;;^DD(.11,1.3,21,0)
 +122     ;;=^^5^5^2960124^
 +123     ;;^DD(.11,1.3,21,1,0)
 +124     ;;=Answer with a FileMan computed expression that will evaluate to Boolean
 +125     ;;^DD(.11,1.3,21,2,0)
 +126     ;;=true (according to the M rules for Boolean interpretation). FileMan will
 +127     ;;^DD(.11,1.3,21,3,0)
 +128     ;;=evaluate this expression whenever it would normally execute the
 +129     ;;^DD(.11,1.3,21,4,0)
 +130     ;;=cross-reference's Set Logic, and will not execute the Set Logic unless
 +131     ;;^DD(.11,1.3,21,5,0)
 +132     ;;=this condition evaluates to true.
 +133     ;;^DD(.11,1.3,"DT")
 +134     ;;=2960116
 +135     ;;^DD(.11,1.4,0)
 +136     ;;=SET CONDITION CODE^K^^1.4;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 +137     ;;^DD(.11,1.4,3)
 +138     ;;=This is Standard MUMPS code. Answer '??' for more help.
 +139     ;;^DD(.11,1.4,9)
 +140     ;;=@
 +141     ;;^DD(.11,1.4,21,0)
 +142     ;;=^^15^15^2990430^
 +143     ;;^DD(.11,1.4,21,1,0)
 +144     ;;=This is MUMPS code that sets the variable X. The SET LOGIC is executed
 +145     ;;^DD(.11,1.4,21,2,0)
 +146     ;;=only if the SET CONDTION, if present, sets X to Boolean true (according to
 +147     ;;^DD(.11,1.4,21,3,0)
 +148     ;;=M rules for Boolean interpretation).
 +149     ;;^DD(.11,1.4,21,4,0)
 +150     ;;= 
 +151     ;;^DD(.11,1.4,21,5,0)
 +152     ;;=Assume the DA array describes the record to be cross-referenced, and that
 +153     ;;^DD(.11,1.4,21,6,0)
 +154     ;;=the X(order#) array contains values after the transform for storage is
 +155     ;;^DD(.11,1.4,21,7,0)
 +156     ;;=applied, but before the truncation to the maximum length.  The variable X
 +157     ;;^DD(.11,1.4,21,8,0)
 +158     ;;=also equals X(order#) of the lowest order number.
 +159     ;;^DD(.11,1.4,21,9,0)
 +160     ;;= 
 +161     ;;^DD(.11,1.4,21,10,0)
 +162     ;;=When fields that make up a cross-reference are edited and the kill and set
 +163     ;;^DD(.11,1.4,21,11,0)
 +164     ;;=conditions are executed, the X1(order#) array contains the old field
 +165     ;;^DD(.11,1.4,21,12,0)
 +166     ;;=values, and the X2(order#) array contains the new field values. If a
 +167     ;;^DD(.11,1.4,21,13,0)
 +168     ;;=record is being added, and there is an X1(order#) array element that
 +169     ;;^DD(.11,1.4,21,14,0)
 +170     ;;=corresponds to the .01 field, it is set to null. When a record is deleted,
 +171     ;;^DD(.11,1.4,21,15,0)
 +172     ;;=all X2(order#) array elements are null.
 +173     ;;^DD(.11,1.4,"DT")
 +174     ;;=2970117
 +175     ;;^DD(.11,2.1,0)
 +176     ;;=KILL LOGIC^RK^^2;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
 +177     ;;^DD(.11,2.1,3)
 +178     ;;=Answer must be Standard M code. Answer '??' for more help.