DINIT124 ;SFISC/MKO-SORT TEMPLATE FILE ;1:13 PM 13 Nov 1998
;;22.0;VA FileMan;;Mar 30, 1999
;Per VHA Directive 10-93-142, this routine should not be modified.
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 ^DINIT125
Q Q
;;^DD(.4014,9,3)
;;=First ^ piece null, second piece=static part of cross-reference, third piece=global reference, 4th piece=number of variable subscripts to get to (and including) record number.
;;^DD(.4014,9,21,0)
;;=^^8^8^2930115^
;;^DD(.4014,9,21,1,0)
;;= Piece 1 is always null
;;^DD(.4014,9,21,2,0)
;;= Piece 2 is the static part of the cross-reference: ex. DIZ(662001,"B",
;;^DD(.4014,9,21,3,0)
;;= Piece 3 is the global reference: ex. DIZ(662001,
;;^DD(.4014,9,21,4,0)
;;= Piece 4 tells FileMan how many variable subscripts must be sorted
;;^DD(.4014,9,21,5,0)
;;=through to get to the record number, plus 1 for the record number
;;^DD(.4014,9,21,6,0)
;;=itself. ex. for a regular cross-reference, ^DIZ(662001,"B",X,DA),
;;^DD(.4014,9,21,7,0)
;;=the number is 2. One for the value of the X subscript, and one for the
;;^DD(.4014,9,21,8,0)
;;=record number itself (DA).
;;^DD(.4014,9,23,0)
;;=^^6^6^2930115^
;;^DD(.4014,9,23,1,0)
;;=The IX nodes are normally derived by FileMan during the entry of sort
;;^DD(.4014,9,23,2,0)
;;=fields (in routine XR^DIP). However, they can also be passed to the
;;^DD(.4014,9,23,3,0)
;;=print (^DIP) in the BY(0) variable to cause FileMan to either use a MUMPS
;;^DD(.4014,9,23,4,0)
;;=type cross-reference, or a previously sorted list of record numbers.
;;^DD(.4014,9,23,5,0)
;;=Fileman sometimes builds the IX node prior to calling the print, as in
;;^DD(.4014,9,23,6,0)
;;=the INQUIRE option, where the user then goes on to print the records.
;;^DD(.4014,9,"DT")
;;=2930115
;;^DD(.4014,9.5,0)
;;=POINT TO CROSS REFERENCE^F^^PTRIX;E1,245^K:$L(X)>245!($L(X)<1) X
;;^DD(.4014,9.5,3)
;;=Enter global reference for "B" index of .01 field on pointed-to file. Answer must be 1-245 characters in length.
;;^DD(.4014,9.5,21,0)
;;=^^7^7^2931221^
;;^DD(.4014,9.5,21,1,0)
;;=This node will exist only if the sort field is a pointer, if the sort
;;^DD(.4014,9.5,21,2,0)
;;=field has a regular cross-reference, if the .01 field on the pointed-to
;;^DD(.4014,9.5,21,3,0)
;;=file has a "B" index, and if the .01 field on the pointed-to file is
;;^DD(.4014,9.5,21,4,0)
;;=either a numeric, date, set-of-codes or free-text field, and does not have
;;^DD(.4014,9.5,21,5,0)
;;=an output transform. If this node exists, it will be set to the static
;;^DD(.4014,9.5,21,6,0)
;;=part of the global reference of the "B" index on the pointed-to file. (ex.
;;^DD(.4014,9.5,21,7,0)
;;=^DIZ(662001,"B",).
;;^DD(.4014,9.5,"DT")
;;=2931221
;;^DD(.4014,10,0)
;;=GET CODE^K^^GET;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
;;^DD(.4014,10,3)
;;=This is Standard MUMPS code used to extract the sort field from a record.
;;^DD(.4014,10,9)
;;=@
;;^DD(.4014,10,21,0)
;;=^^3^3^2930115^
;;^DD(.4014,10,21,1,0)
;;=The GET CODE is MUMPS code that is executed after a record (or sub-record)
;;^DD(.4014,10,21,2,0)
;;=has been selected. The code extracts the SORT field from that record
;;^DD(.4014,10,21,3,0)
;;=into a local variable.
;;^DD(.4014,10,23,0)
;;=^^1^1^2930115^
;;^DD(.4014,10,23,1,0)
;;=GET CODE can be generated by a call to FileMan routine GET^DIOU.
;;^DD(.4014,10,"DT")
;;=2930115
;;^DD(.4014,11,0)
;;=QUERY CONDITION^K^^QCON;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
;;^DD(.4014,11,3)
;;=This is Standard MUMPS code used to test the field to see whether it meets the query condition (ex., whether it's within the from/to range specified by the user).
;;^DD(.4014,11,9)
;;=@
;;^DD(.4014,11,21,0)
;;=^^5^5^2930115^
;;^DD(.4014,11,21,1,0)
;;=The QUERY CONDITION is MUMPS code that takes a field in a local variable,
;;^DD(.4014,11,21,2,0)
;;=and executes some query condition. The results of executing the code
;;^DD(.4014,11,21,3,0)
;;=will return a truth value of TRUE if the field met the condition, or
;;^DD(.4014,11,21,4,0)
;;=FALSE if not. It is used, for example, to see whether a SORT FIELD falls
;;^DD(.4014,11,21,5,0)
;;=within the FROM/TO range requested by the user.
;;^DD(.4014,11,23,0)
;;=^^2^2^2930115^
;;^DD(.4014,11,23,1,0)
;;=The QUERY CONDITION code is generated by various calls to FileMan
;;^DD(.4014,11,23,2,0)
;;=routines DIOC*.
;;^DD(.4014,11,"DT")
;;=2930115
;;^DD(.4014,12,0)
;;=DESCRIPTION OF SORT^F^^TXT;E1,200^K:$L(X)>200!($L(X)<1) X
;;^DD(.4014,12,3)
;;=Answer must be 1-200 characters in length. Text explaining the query condition (field name and what conditions must be met in order for the record to be selected).
;;^DD(.4014,12,21,0)
;;=^^4^4^2930115^
;;^DD(.4014,12,21,1,0)
;;=This field contains a brief textual description of the SORT FIELD and
;;^DD(.4014,12,21,2,0)
;;=the SORT CRITERIA used on it (i.e., the from/to values). This
;;^DD(.4014,12,21,3,0)
;;=description can be printed in the heading of a report, at the users
;;^DD(.4014,12,21,4,0)
;;=request.
;;^DD(.4014,12,23,0)
;;=^^2^2^2930115^
;;^DD(.4014,12,23,1,0)
;;=This text is build as the developer answers the FROM/TO questions
;;^DD(.4014,12,23,2,0)
;;=during the SORT sequence.
;;^DD(.4014,12,"DT")
;;=2930115
;;^DD(.4014,13,0)
;;=SEARCH EFFICIENCY RATING^NJ9,4^^SER;1^K:+X'=X!(X>9999.9999)!(X<0)!(X?.E1"."5N.N) X
;;^DD(.4014,13,3)
;;=Type a Number between 0 and 9999.9999, 4 Decimal Digits. Search efficiency number returned by Query Optimizer Routine.
;;^DD(.4014,13,21,0)
;;=^^7^7^2930125^
;;^DD(.4014,13,21,1,0)
;;=Fields are assigned a search efficiency rating based on the number of
;;^DD(.4014,13,21,2,0)
;;=hits found for the query (or sort) condition. The fewer the hits, the
;;^DD(.4014,13,21,3,0)
;;=higher the rating. A high rating indicates the criteria will more quickly
;;^DD(.4014,13,21,4,0)
;;=cut down the number of records to be processed. The rating will be
;;^DD(.4014,13,21,5,0)
;;=higher if the field has a cross-reference. The field with the highest
;;^DD(.4014,13,21,6,0)
;;=rating is used to do the initial loop through the file during the sort
;;^DD(.4014,13,21,7,0)
;;=phase.
;;^DD(.4014,13,23,0)
;;=^^1^1^2930125^
;;^DD(.4014,13,23,1,0)
;;=Calculated in the Query Optimizer routine ^DIOQ.
;;^DD(.4014,13,"DT")
;;=2930125
;;^DD(.4014,14,0)
;;=PROBABILITY RATING^NJ9,4^^SER;2^K:+X'=X!(X>9999.9999)!(X<0)!(X?.E1"."5N.N) X
;;^DD(.4014,14,3)
;;=Type a Number between 0 and 9999.9999, 4 Decimal Digits. Probability of field meeting the sort criteria--returned by Query Optimizer routine.
;;^DD(.4014,14,21,0)
;;=^^6^6^2930125^^
DINIT124 ;SFISC/MKO-SORT TEMPLATE FILE ;1:13 PM 13 Nov 1998
+1 ;;22.0;VA FileMan;;Mar 30, 1999
+2 ;Per VHA Directive 10-93-142, this routine should not be modified.
+3 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
+4 GOTO ^DINIT125
Q QUIT
+1 ;;^DD(.4014,9,3)
+2 ;;=First ^ piece null, second piece=static part of cross-reference, third piece=global reference, 4th piece=number of variable subscripts to get to (and including) record number.
+3 ;;^DD(.4014,9,21,0)
+4 ;;=^^8^8^2930115^
+5 ;;^DD(.4014,9,21,1,0)
+6 ;;= Piece 1 is always null
+7 ;;^DD(.4014,9,21,2,0)
+8 ;;= Piece 2 is the static part of the cross-reference: ex. DIZ(662001,"B",
+9 ;;^DD(.4014,9,21,3,0)
+10 ;;= Piece 3 is the global reference: ex. DIZ(662001,
+11 ;;^DD(.4014,9,21,4,0)
+12 ;;= Piece 4 tells FileMan how many variable subscripts must be sorted
+13 ;;^DD(.4014,9,21,5,0)
+14 ;;=through to get to the record number, plus 1 for the record number
+15 ;;^DD(.4014,9,21,6,0)
+16 ;;=itself. ex. for a regular cross-reference, ^DIZ(662001,"B",X,DA),
+17 ;;^DD(.4014,9,21,7,0)
+18 ;;=the number is 2. One for the value of the X subscript, and one for the
+19 ;;^DD(.4014,9,21,8,0)
+20 ;;=record number itself (DA).
+21 ;;^DD(.4014,9,23,0)
+22 ;;=^^6^6^2930115^
+23 ;;^DD(.4014,9,23,1,0)
+24 ;;=The IX nodes are normally derived by FileMan during the entry of sort
+25 ;;^DD(.4014,9,23,2,0)
+26 ;;=fields (in routine XR^DIP). However, they can also be passed to the
+27 ;;^DD(.4014,9,23,3,0)
+28 ;;=print (^DIP) in the BY(0) variable to cause FileMan to either use a MUMPS
+29 ;;^DD(.4014,9,23,4,0)
+30 ;;=type cross-reference, or a previously sorted list of record numbers.
+31 ;;^DD(.4014,9,23,5,0)
+32 ;;=Fileman sometimes builds the IX node prior to calling the print, as in
+33 ;;^DD(.4014,9,23,6,0)
+34 ;;=the INQUIRE option, where the user then goes on to print the records.
+35 ;;^DD(.4014,9,"DT")
+36 ;;=2930115
+37 ;;^DD(.4014,9.5,0)
+38 ;;=POINT TO CROSS REFERENCE^F^^PTRIX;E1,245^K:$L(X)>245!($L(X)<1) X
+39 ;;^DD(.4014,9.5,3)
+40 ;;=Enter global reference for "B" index of .01 field on pointed-to file. Answer must be 1-245 characters in length.
+41 ;;^DD(.4014,9.5,21,0)
+42 ;;=^^7^7^2931221^
+43 ;;^DD(.4014,9.5,21,1,0)
+44 ;;=This node will exist only if the sort field is a pointer, if the sort
+45 ;;^DD(.4014,9.5,21,2,0)
+46 ;;=field has a regular cross-reference, if the .01 field on the pointed-to
+47 ;;^DD(.4014,9.5,21,3,0)
+48 ;;=file has a "B" index, and if the .01 field on the pointed-to file is
+49 ;;^DD(.4014,9.5,21,4,0)
+50 ;;=either a numeric, date, set-of-codes or free-text field, and does not have
+51 ;;^DD(.4014,9.5,21,5,0)
+52 ;;=an output transform. If this node exists, it will be set to the static
+53 ;;^DD(.4014,9.5,21,6,0)
+54 ;;=part of the global reference of the "B" index on the pointed-to file. (ex.
+55 ;;^DD(.4014,9.5,21,7,0)
+56 ;;=^DIZ(662001,"B",).
+57 ;;^DD(.4014,9.5,"DT")
+58 ;;=2931221
+59 ;;^DD(.4014,10,0)
+60 ;;=GET CODE^K^^GET;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
+61 ;;^DD(.4014,10,3)
+62 ;;=This is Standard MUMPS code used to extract the sort field from a record.
+63 ;;^DD(.4014,10,9)
+64 ;;=@
+65 ;;^DD(.4014,10,21,0)
+66 ;;=^^3^3^2930115^
+67 ;;^DD(.4014,10,21,1,0)
+68 ;;=The GET CODE is MUMPS code that is executed after a record (or sub-record)
+69 ;;^DD(.4014,10,21,2,0)
+70 ;;=has been selected. The code extracts the SORT field from that record
+71 ;;^DD(.4014,10,21,3,0)
+72 ;;=into a local variable.
+73 ;;^DD(.4014,10,23,0)
+74 ;;=^^1^1^2930115^
+75 ;;^DD(.4014,10,23,1,0)
+76 ;;=GET CODE can be generated by a call to FileMan routine GET^DIOU.
+77 ;;^DD(.4014,10,"DT")
+78 ;;=2930115
+79 ;;^DD(.4014,11,0)
+80 ;;=QUERY CONDITION^K^^QCON;E1,245^K:$L(X)>245 X D:$D(X) ^DIM
+81 ;;^DD(.4014,11,3)
+82 ;;=This is Standard MUMPS code used to test the field to see whether it meets the query condition (ex., whether it's within the from/to range specified by the user).
+83 ;;^DD(.4014,11,9)
+84 ;;=@
+85 ;;^DD(.4014,11,21,0)
+86 ;;=^^5^5^2930115^
+87 ;;^DD(.4014,11,21,1,0)
+88 ;;=The QUERY CONDITION is MUMPS code that takes a field in a local variable,
+89 ;;^DD(.4014,11,21,2,0)
+90 ;;=and executes some query condition. The results of executing the code
+91 ;;^DD(.4014,11,21,3,0)
+92 ;;=will return a truth value of TRUE if the field met the condition, or
+93 ;;^DD(.4014,11,21,4,0)
+94 ;;=FALSE if not. It is used, for example, to see whether a SORT FIELD falls
+95 ;;^DD(.4014,11,21,5,0)
+96 ;;=within the FROM/TO range requested by the user.
+97 ;;^DD(.4014,11,23,0)
+98 ;;=^^2^2^2930115^
+99 ;;^DD(.4014,11,23,1,0)
+100 ;;=The QUERY CONDITION code is generated by various calls to FileMan
+101 ;;^DD(.4014,11,23,2,0)
+102 ;;=routines DIOC*.
+103 ;;^DD(.4014,11,"DT")
+104 ;;=2930115
+105 ;;^DD(.4014,12,0)
+106 ;;=DESCRIPTION OF SORT^F^^TXT;E1,200^K:$L(X)>200!($L(X)<1) X
+107 ;;^DD(.4014,12,3)
+108 ;;=Answer must be 1-200 characters in length. Text explaining the query condition (field name and what conditions must be met in order for the record to be selected).
+109 ;;^DD(.4014,12,21,0)
+110 ;;=^^4^4^2930115^
+111 ;;^DD(.4014,12,21,1,0)
+112 ;;=This field contains a brief textual description of the SORT FIELD and
+113 ;;^DD(.4014,12,21,2,0)
+114 ;;=the SORT CRITERIA used on it (i.e., the from/to values). This
+115 ;;^DD(.4014,12,21,3,0)
+116 ;;=description can be printed in the heading of a report, at the users
+117 ;;^DD(.4014,12,21,4,0)
+118 ;;=request.
+119 ;;^DD(.4014,12,23,0)
+120 ;;=^^2^2^2930115^
+121 ;;^DD(.4014,12,23,1,0)
+122 ;;=This text is build as the developer answers the FROM/TO questions
+123 ;;^DD(.4014,12,23,2,0)
+124 ;;=during the SORT sequence.
+125 ;;^DD(.4014,12,"DT")
+126 ;;=2930115
+127 ;;^DD(.4014,13,0)
+128 ;;=SEARCH EFFICIENCY RATING^NJ9,4^^SER;1^K:+X'=X!(X>9999.9999)!(X<0)!(X?.E1"."5N.N) X
+129 ;;^DD(.4014,13,3)
+130 ;;=Type a Number between 0 and 9999.9999, 4 Decimal Digits. Search efficiency number returned by Query Optimizer Routine.
+131 ;;^DD(.4014,13,21,0)
+132 ;;=^^7^7^2930125^
+133 ;;^DD(.4014,13,21,1,0)
+134 ;;=Fields are assigned a search efficiency rating based on the number of
+135 ;;^DD(.4014,13,21,2,0)
+136 ;;=hits found for the query (or sort) condition. The fewer the hits, the
+137 ;;^DD(.4014,13,21,3,0)
+138 ;;=higher the rating. A high rating indicates the criteria will more quickly
+139 ;;^DD(.4014,13,21,4,0)
+140 ;;=cut down the number of records to be processed. The rating will be
+141 ;;^DD(.4014,13,21,5,0)
+142 ;;=higher if the field has a cross-reference. The field with the highest
+143 ;;^DD(.4014,13,21,6,0)
+144 ;;=rating is used to do the initial loop through the file during the sort
+145 ;;^DD(.4014,13,21,7,0)
+146 ;;=phase.
+147 ;;^DD(.4014,13,23,0)
+148 ;;=^^1^1^2930125^
+149 ;;^DD(.4014,13,23,1,0)
+150 ;;=Calculated in the Query Optimizer routine ^DIOQ.
+151 ;;^DD(.4014,13,"DT")
+152 ;;=2930125
+153 ;;^DD(.4014,14,0)
+154 ;;=PROBABILITY RATING^NJ9,4^^SER;2^K:+X'=X!(X>9999.9999)!(X<0)!(X?.E1"."5N.N) X
+155 ;;^DD(.4014,14,3)
+156 ;;=Type a Number between 0 and 9999.9999, 4 Decimal Digits. Probability of field meeting the sort criteria--returned by Query Optimizer routine.
+157 ;;^DD(.4014,14,21,0)
+158 ;;=^^6^6^2930125^^