First line formal lists fixes. Change file below:

NO.: 14617                              VERSION: 22.2
  TAG: DDD                              ROUTINE NAME OR GLOBAL REF: DICOMP0
  DATE CHANGED: JAN 24,2013             PROGRAMMER: SAM HABIEL
  CHANGE: Changed comment. No op.       DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>

NO.: 14618                              VERSION: 22.2
  TAG: EN                               ROUTINE NAME OR GLOBAL REF: DICOMPU
  DATE CHANGED: JAN 24,2013             PROGRAMMER: SAM HABIEL
  CHANGE: Formal list moved from first line to EN tag
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 Not used in Fileman. No testing necessary.

NO.: 14619                              VERSION: 22.2
  TAG: EN                               ROUTINE NAME OR GLOBAL REF: DILL
  DATE CHANGED: JAN 24,2013             PROGRAMMER: SAM HABIEL
  CHANGE: Changed 1st line formal list to EN
  RELATED CHANGE NUMBERS: 14620-2       DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 See next two changes.

NO.: 14620                              VERSION: 22.2
  TAG: +5-6,Z                           ROUTINE NAME OR GLOBAL REF: DIL0
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Change of ^DILL(...) to EN^DILL(...)
  RELATED CHANGE NUMBERS: 14619         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 This code gets invoked when compiling a print template using ^DIPZ. Make
 sure it doesn't crash.

NO.: 14621                              VERSION: 22.2
  TAG: NUMB+4,E+1-2,LOOP+1              ROUTINE NAME OR GLOBAL REF: DIL1
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Change of ^DILL(...) to EN^DILL(...)
  RELATED CHANGE NUMBERS: 14619         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 Code invoked when subtotaling from print using !field. Try this, and make
 sure there are no crashes.

NO.: 14622                              VERSION: 22.2
  TAG: DILL                             ROUTINE NAME OR GLOBAL REF: DIO0
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Change of ^DILL(...) to EN^DILL(...)
  RELATED CHANGE NUMBERS: 14619         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 I couldn't figure out how to test this.

NO.: 14623                              VERSION: 22.2
  TAG: EN,E+4                           ROUTINE NAME OR GLOBAL REF: DITCP
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Formal list moved from first line to EN tag
  DOCUMENTATION NEEDED: NO              NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 See 14624.

NO.: 14624                              VERSION: 22.2
  TAG: DD+1,FILES+1,ENTRIES+7           ROUTINE NAME OR GLOBAL REF: DITCP0
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Changed ^DITCP(...) to EN^DITCP(...)
  RELATED CHANGE NUMBERS: 14623         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 Run namespace compare option under transfer file entries. Make sure you
 can do a comparison successfully.

NO.: 14625                              VERSION: 22.2
  TAG: EN                               ROUTINE NAME OR GLOBAL REF: DITCPL
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Formal list moved from first line to EN tag
  DOCUMENTATION NEEDED: NO              NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 See 14626.

NO.: 14626                              VERSION: 22.2
  TAG: DITCPL                           ROUTINE NAME OR GLOBAL REF: DITCP
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Change of ^DITCPL(...) to EN^DITCPL(...)
  RELATED CHANGE NUMBERS: 14625         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 Run the Namespace compare option under Transfer file entries. Expected:
 No Crashes.

NO.: 14627                              VERSION: 22.2
  TAG: EN                               ROUTINE NAME OR GLOBAL REF: DDSRP
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Formal list moved from first line to EN tag
  DOCUMENTATION NEEDED: NO              NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 See 14628.

NO.: 14628                              VERSION: 22.2
  TAG: PRNT+1                           ROUTINE NAME OR GLOBAL REF: DDS01
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Changed from ^DDSRP(..) to EN^DDSRP(...)
  RELATED CHANGE NUMBERS: 14627         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 In a screenman form, run F1-P.

 Expected: No crashes.

NO.: 14629                              VERSION: 22.2
  TAG: EN                               ROUTINE NAME OR GLOBAL REF: DIVR
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Change first line formal list to EN
  DOCUMENTATION NEEDED: NO              NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 See next changes for testing instructions.

NO.: 14630                              VERSION: 22.2
  TAG: DIVR+13                          ROUTINE NAME OR GLOBAL REF: DIUTL
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Change of ^DIVR(...) to EN^DIVR(...)
  RELATED CHANGE NUMBERS: 14629         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 Modify File Attributes on existing files. When asked to verify fields,
 say yes.

 No crashes.

NO.: 14631                              VERSION: 22.2
  TAG: DIC+8,ALLFLDS+4,ENQUEUE+6-8      ROUTINE NAME OR GLOBAL REF: DIV
  REPORTER: XINDEX                      DATE CHANGED: JAN 24,2013
  PROGRAMMER: SAM HABIEL
  CHANGE: Change of ^DIVR(...) to EN^DIVR(...)
  RELATED CHANGE NUMBERS: 14629         DOCUMENTATION NEEDED: NO
  NEW VERSION: <22.2>
 DETAILED TESTING INSTRUCTIONS:
 Run verify fields in various combinations. The code is triggered
 here:
 - Regular invocation, one field
 - Regular invocation, ALL fields
 - Invocation and then queuing the output.

 Success: No crashes.
Fixes for bug JIRA [FILEMAN-2]: Fix bug with compound indexes, backward collation, and partial matches. Four Fileman changes: 14605, 14632, 14636, and 14637:

NO.: 14605                              VERSION: 22.2T1
  TAG: LOOKUP+17:18, passim             ROUTINE NAME OR GLOBAL REF: DICF
  REPORTER: ZACH GONZALES               DATE CHANGED: JAN 24,2013
  PROGRAMMER: RICK MARSHALL             PREVIOUS CHECKSUM: B33474300
  SUPPORTING DOCUMENT NUMBERS: JIRA [FILEMAN-2]
  CHANGE: Fix bug with compound indexes, backward collation, and partial matches
  UPDATED UCIS: DEV
  RELATED CHANGE NUMBERS: 14632,14636,14637
  DOCUMENTATION NEEDED: YES
  DOCUMENTATION NOTES: Backward collation includes backward listings in response
 to ? and also backward lists of partial matches. Note effect of different colla
tion of different subscripts in a compound index.
  NEW VERSION: <22.2T1>
 LONG DESCRIPTION:
 In a new-style, compound index with multiple value subscripts, in which
 the second one is defined to have backward collation, it collates
 correctly when responding to help (listing the index entries), but not
 when offering matches if the first subscript value is entered at the
 lookup prompt but not the second one. It collates forward instead of
 backward.

 This issue originally came up with in connection with a new index on
 Lloyd Milligan's ADT Filer package, and it took us a while to figure out
 that it had nothing to do with partial numeric matches, contrary to what
 we initially thought.

 This involved three problems.

 First, COMMON1^DICUIX2 (a subroutine shared by all the lookup-related
 APIs, whose job is to build the definition of the current index's data
 subscripts into the DINDEX array) was suppressing the ability to reverse
 directions during Finder calls. Although this may be fine when the Finder
 is called directly by applications, the Finder is also used as a helper
 for the classic Lookup calls (^DIC, IX^DIC, and MIX^DIC1), and in this
 context it is often building lists for immediate display to the end user,
 so they need to honor the directionality of index subscripts. We changed
 the directionality code in C1 to override the Finder's override (that is,
 to not suppress the directionality calculation) when the Finder is called
 by the classic Lookup.

 Second, it's not enough just to change directions; the lookup values,
 which are used as starting values for the $order loops that traverse the
 index, also need to be revised. When we are doing partial matches while
 traversing forward, the From value equals the user-entered lookup value,
 because $order in the forward direction naturally encounters the longer
 values that are potential partial matches. Unfortunately, when doing
 partial matches while traversing backward, the From value needs to be
 changed to place it after all the possible partial matches, so that the
 first reverse $order finds the last of the partial matches instead of
 none of them. Because the Finder, unlike the Lister, was never designed
 to traverse backward, it had no logic for building these changed From
 values, leading the Finder after the first change described above to
 report no matches. The Lister, of course, already had code to do this,
 but where the Lister is always working with a single lookup value on a
 single index, the Finder is often working with multiple lookup values,
 usually on multiple indexes. The Finder, in CHKONE^DICF3, prior to
 calling its walker code (in DICFIX - the Lister has a similar one of its
 own in DICLIX) loads the list of lookup values from the DIVALUE array
 (which remembers what we're looking for) into the DINDEX array (which
 knows about the current index we're traversing).

 To fix this Finder logic to support backward collation (i.e., reverse
 traversal), we had to preload the DIVALUE array with a second set of
 values to be used when traversing backward (since different subscripts in
 different indexes can have different collation, the same Finder call
 needs to be ready to go both directions), and we had to change the code
 in CHKONE^DICF3 so it would load the right part of DIVALUE depending on
 the direction we're about to traverse. The second part was easily done,
 using the now-corrected directionality flag from step one. For the first
 part, we added a new subroutine BACKFROM in DICF1 (the routine that does
 most of the work building the DIVALUE array) to add the reverse-direction
 From values, based on the forward-direction From values already loaded in
 the DIVALUE array. We then added a line to LOOKUP^DICF, right after it
 calls XFORM^DICF1 to build the needed From values, to call our new
 BACKFROM^DICF1 procedure to calculate and add the reverse From values.
 This gave CHKONE^DICF3 both sets of lookup values in DIVALUE, so it can
 merge into DINDEX the right group for the direction it's going in the
 current index's current subscript.

 Although this handles the immediate situations we face, Sam Habiel looked
 ahead and let us know about a third problem we should solve while we're
 in here.

 The reverse From value calculation, which until now was only used by the
 Lister, is late in COMMON1^DICUIX2, where it appends "{{{{{{{{{{" to the
 end of the partial match value to create the From value. In the ASCII and
 M character sets, this does move the From value after all likely partial
 matches, but in other character sets this won't work. Ideally, this
 calculation should be specific to the character set in use, which can
 vary. We agreed that Sam will come up with a framework for adding these
 calculations. For now, I moved the calculation into a function,
 $$BACKFROM^DICUIX2, which Sam can later turn into an extensible
 framework; for now it just does the existing calculation there. We then
 changed procedure BACKFROM^DICF1 to use $$BACKFROM^DICUIX2 in its
 calculations.

 Here are the two new lines:

         I DIFLAGS'["X" D  ; unless we are doing exact matches, also load FROM
         . D BACKFROM^DICF1(.DIVALUE,.DINDEX) ; values for backward traversal

 While in DICF, I also did a very light refactoring of header lines and
 last lines throughout the routine and removed do-dot block quits, since
 they're no-ops.

 I took this opportunity to overhaul Tami's Fileman Routine file entry for
 DICF to match the refactored code with my mod in it. I did not do
 likewise for the other routines that make up this change, in the
 interests of time, since we're nearing the end of alpha testing. For 22.3
 we should plan to overhaul the Fileman Routine file to bring it up to
 date with our changes since Fileman 22 was released.
  EXPLANATION FOR TEST SITES: [FILEMAN-2] COMPOUND INDEXES: FAILURE TO COLLATE B
ACKWARD WITH PARTIAL MATCH
 DETAILED TESTING INSTRUCTIONS:
 Create a simple file with two free-text fields (film name (.01) and
 director (.02). Create a new-style compound index ("AB") on both of those
 fields (with the director as value subscript 1 and film name as value
 subscript 2), with both set to collate backward.

 Enter seven films by Ridley Scott and three by Tony Scott. Do a
 direct-mode call to IX^DIC to force the use of that index. At the prompt,
 enter ? to confirm that the entries are properly listed backward. Then
 enter RIDLEY SCOTT. Suddenly, his films are listed in alphabetical order,
 as opposed to the proper reverse order they were just shown as in response
 to the help request.

 Here's an example of the correct behavior (backward collation) when
 requesting help:

  LIVE,FORUM>S DIC=42001.2,DIC(0)="AEQ",D="AB" D IX^DIC

   Select DMUT FILM DIRECTOR: ?
   Answer with DMUT FILM DIRECTOR & NAME
   Choose from:
   TONY SCOTT UNSTOPPABLE
   TONY SCOTT TOP GUN
   TONY SCOTT MAN ON FIRE
   RIDLEY SCOTT PROMETHEUS
   RIDLEY SCOTT KINGDOM OF HEAVEN
   RIDLEY SCOTT GLADIATOR
   RIDLEY SCOTT BLADERUNNER
   RIDLEY SCOTT BLACK HAWK DOWN
   RIDLEY SCOTT AMERICAN GANGSTER
   RIDLEY SCOTT ALIEN

 And here's the incorrect behavior (forward collation) when entering the
 first subscript value but not the second:

   Select DMUT FILM DIRECTOR: RIDLEY SCOTT
   NAME:

   1 RIDLEY SCOTT ALIEN ALIEN
   2 RIDLEY SCOTT AMERICAN GANGSTER AMERICAN GANGSTER
   3 RIDLEY SCOTT BLACK HAWK DOWN BLACK HAWK DOWN
   4 RIDLEY SCOTT BLADERUNNER BLADERUNNER
   5 RIDLEY SCOTT GLADIATOR GLADIATOR
   Press <Enter> to see more, '^' to exit this list, OR
   CHOOSE 1-5:
   6 RIDLEY SCOTT KINGDOM OF HEAVEN KINGDOM OF HEAVEN
   7 RIDLEY SCOTT PROMETHEUS PROMETHEUS
   CHOOSE 1-7:

NO.: 14632                              VERSION: 22.2T1
  TAG: BACKFROM, passim                 ROUTINE NAME OR GLOBAL REF: DICF1
  REPORTER: ZACH GONZALES               DATE CHANGED: JAN 24,2013
  PROGRAMMER: RICK MARSHALL             PREVIOUS CHECKSUM: B22351550
  SUPPORTING DOCUMENT NUMBERS: JIRA [FILEMAN-2]
  CHANGE: Fix bug with compound indexes, backward collation, and partial matches
  UPDATED UCIS: DEV
  RELATED CHANGE NUMBERS: 14605,14636,14637
  DOCUMENTATION NEEDED: YES
  DOCUMENTATION NOTES: See Fileman Change #14605 for details.
  NEW VERSION: <22.2T1>
 LONG DESCRIPTION:
 See Fileman Change #14605 for details.

 In routine DICF1 I added new subroutine BACKFROM to create From values
 for backward collation. Here's the new code:

 BACKFROM(DIVALUE,DINDEX)        ; create From values for backward collation
         ;;private;procedure;clean;silent;SAC compliant
         ; input:
         ;   .DINDEX("#") = # of lookup values supplied
         ;   .DIVALUE(subscript #) = default lookup value
         ;   .DIVALUE(subscript #,value #) = each additional lookup value
         ; output:
         ;   .DIVALUE("BACK",DISUB,...) = From values for backwards
         ; called only by:
         ;   LOOKUP^DICF
         ; calls:
         ;   $$BACKFROM^DICUIX2 to compute each From value for backwards
         ;
         N DISUB F DISUB=1:1:DINDEX("#") D  ; traverse lookup values
         . ;
         . M DIVALUE("BACK",DISUB)=DIVALUE(DISUB) ; initialize From values
         . ;
         . I DIVALUE(DISUB)'="" D  ; if default exists
         . . N B S B=$$BACKFROM^DICUIX2(DIVALUE(DISUB))
         . . S DIVALUE("BACK",DISUB)=B ; add default back-from value
         . ;
         . N DIVAL S DIVAL=0
         . F  D  Q:'DIVAL  ; traverse alternate values
         . . S DIVAL=$O(DIVALUE(DISUB,DIVAL)) ; each alternate
         . . Q:'DIVAL
         . . I $G(DIVALUE(DISUB,DIVAL))'="" D  ; if alternate exists
         . . . N B S B=$$BACKFROM^DICUIX2(DIVALUE(DISUB,DIVAL))
         . . . S DIVALUE("BACK",DISUB,DIVAL)=B ; add alternate back-from val
         ;
         QUIT  ; end of BACKFROM

 While in this routine, I also lightly refactored it, fixing headers and
 quits throughout and removing dot-dot block quits (no-ops)
  EXPLANATION FOR TEST SITES: [FILEMAN-2] COMPOUND INDEXES: FAILURE TO COLLATE B
ACKWARD WITH PARTIAL MATCH
 DETAILED TESTING INSTRUCTIONS:
 See Fileman Change #14605 for details.

 In addition, unit tests could be written that call BACKFROM^DICF1 with
 various combinations of parameters, to ensure that it always adds the
 right alternate lookup values.

NO.: 14636                              VERSION: 22.2T1
  TAG: C2+6:10, passim                  ROUTINE NAME OR GLOBAL REF: DICF3
  REPORTER: ZACH GONZALES               DATE CHANGED: JAN 24,2013
  PROGRAMMER: RICK MARSHALL             PREVIOUS CHECKSUM: B5692609
  SUPPORTING DOCUMENT NUMBERS: JIRA [FILEMAN-2]
  CHANGE: Fix bug with compound indexes, backward collation, and partial matches
  UPDATED UCIS: DEV
  RELATED CHANGE NUMBERS: 14605,14632,14637
  DOCUMENTATION NEEDED: YES
  DOCUMENTATION NOTES: See Fileman Change #14605 for details.
  NEW VERSION: <22.2T1>
 LONG DESCRIPTION:
 See Fileman Change #14605 for details.

 In routine DICF3, I replaced this line in C2:

         . I DISUB>1!("VP"'[DINDEX(1,"TYPE")) M DINDEX(DISUB)=DIVALUE(DISUB)

 which sets up the from values for the index subscript we're preparing to
 traverse, with these replacement lines:

         . I DISUB>1!("VP"'[DINDEX(1,"TYPE")) D
         . . I DINDEX(DISUB,"WAY")=1 D  ; forward traversal, traverse from
         . . . M DINDEX(DISUB)=DIVALUE(DISUB) ; start of partial matches
         . . I DINDEX(DISUB,"WAY")=-1 D  ; backward traversal, traverse from
         . . . M DINDEX(DISUB)=DIVALUE("BACK",DISUB) ; end of partial matches

 which properly set up the from values for both forward and backward
 traversal.

 While in this routine, I also lightly refactored it, fixing headers and
 quits throughout and removing dot-dot block quits (no-ops).
  EXPLANATION FOR TEST SITES: [FILEMAN-2] COMPOUND INDEXES: FAILURE TO COLLATE B
ACKWARD WITH PARTIAL MATCH
 DETAILED TESTING INSTRUCTIONS:
 See Fileman Change #14605 for details.

NO.: 14637                              VERSION: 22.2T1
  TAG: C1+2:3,C6+18,$$BACKFROM, passim  ROUTINE NAME OR GLOBAL REF: DICUIX2
  REPORTER: ZACH GONZALES               DATE CHANGED: JAN 24,2013
  PROGRAMMER: RICK MARSHALL             PREVIOUS CHECKSUM: B23539644
  SUPPORTING DOCUMENT NUMBERS: JIRA [FILEMAN-2]
  CHANGE: Fix bug with compound indexes, backward collation, and partial matches
  UPDATED UCIS: DEV
  RELATED CHANGE NUMBERS: 14605, 14632, 14636
  DOCUMENTATION NEEDED: YES
  DOCUMENTATION NOTES: See Fileman Change #14605 for details.
  NEW VERSION: <22.2T1>
 LONG DESCRIPTION:
 See Fileman Change #14605 for details.

 In routine DICUIX2 I made three main changes:

 In C1 I replaced this line:

         S DINDEX(DISUB,"WAY")=$S(DIFLAGS[4:1,DIWAY=DINDEX("WAY"):1,1:-1)

 with these two lines:

         S DINDEX(DISUB,"WAY")=DIWAY*DINDEX("WAY") ; calculate direction
         I DIFLAGS[4,DIFLAGS'["l" S DINDEX(DISUB,"WAY")=1 ; override?

 to not suppress the Finder reversing directions if it's being called to
 support the Classic Lookup from routine DIC4.

 In C6 I replaced this line:

         . S DIFR=DIPRT_"{{{{{{{{{{"

 with this line:

         . S DIFR=$$BACKFROM(DIPRT) ; start from end of partial matches

 to begin the move from hard-coded backward from values (which are too
 tied to ASCII specifically) to the use of a function, which can later be
 converted to an extensible framework to support alternative character
 sets. This was based on Sam's experience adapting VISTA for Arabic
 characters in Jordan.

 I also added this function:

 BACKFROM(DIPART)        ; Return From Value for Backward Collation
         ;
         ;;private;function;clean;silent;SAC compliant
         ; input: DIPART = the partial-match value
         ; output = From value for backward collation
         ; called by:
         ;   COMMON1, at C6+18
         ;   BACKFROM^DICF1
         ; calls: none
         ;
         N DIFROM S DIFROM=DIPART_"{{{{{{{{{{"
         ;
         QUIT DIFROM ; return From value ; end of $$BACKFROM

 While in this routine, I also lightly refactored it, fixing headers and
 quits throughout and removing dot-dot block quits (no-ops).
  EXPLANATION FOR TEST SITES: [FILEMAN-2] COMPOUND INDEXES: FAILURE TO COLLATE B
ACKWARD WITH PARTIAL MATCH
 DETAILED TESTING INSTRUCTIONS:
 See Fileman Change #14605 for details.

 Although new function $$BACKFROM^DICUIX2 was added and could in theory be
 unit tested, in practice it always returns the same value for now. When
 in a future version we convert it to an extensible framework, then unit
 tests should be written around it, but not for now.