home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / sortd211.zip / SORTADDR.TXT < prev   
Text File  |  1993-10-12  |  8KB  |  199 lines

  1.  
  2.  SortAddr V2 - An address book sort utility for OzCIS V2
  3.  
  4.  1) History (and Excuses):
  5.   The problem with sorting OzCIS address books is that the name field is
  6.   free-form (the user can enter whatever he likes). This means that, for
  7.   example:
  8.  
  9.           Acme Widgets Corp.
  10.           A.N.Other [TeamOZ],
  11.           Loudon Wainwright III,
  12.           Mark Lathwell, and
  13.           Michael A. Atherton
  14.  
  15.   are all acceptable input. This is fine as far as allowing users
  16.   flexibility and freedom of expression goes, but it makes writing a
  17.   useful sort routine difficult. For instance, in the above cases if the
  18.   the "normal" approach of sorting on the last word of the field was used
  19.   only Atherton and Lathwell would end up in a logical place (would you
  20.   look for Acme Widgets to be "filed" under C, or Wainwright under III?).
  21.   Anyhow, because of this when I wrote the first version of this utility
  22.   I had it sort on the whole string (the examples above would end up in
  23.   the order shown above). There was a work-around - the user had to edit
  24.   the entries in the address book manually (to, for example, Other, A.N.
  25.   [TeamOz] and Wainwright III, Loudon) but the problem then was that
  26.   they appeared this way on the To: line of the message header.
  27.  
  28.   I got plenty of feedback from IBMCOM Sec. 12  (all of it positive,
  29.   encouraging and very welcome) but most of it vaguely unhappy about
  30.   this compromise. I also got a great idea (from Todd Fiske of TeamOZ)
  31.   for overcoming this difficulty. This version incorporates his idea.
  32.  
  33.  2) Todd's Idea:
  34.   ... was to use the third comment line of the address book record to
  35.   pass the sort key. To sort on a particular part, say the third word, of
  36.   the name, the number 3 is passed as the last word in the last comment
  37.   line. For instance if you want Acme Widgets Corp. in the A's you would
  38.   add 1 after whatever comment (if any) was in the last comment line, if
  39.   however you want them under W (for Widgets) put the number 2 in the
  40.   last comment line.  i.e. the sort is completely customisable - the choice
  41.   is yours.
  42.  
  43.   My guess is that most name entries are "standard format", i.e. in a form
  44.   such that sorting them on the last word of the name gives logical results,
  45.   so I have made this the "normal" method - if the last comment field is
  46.   empty or contains comments but no number) the utility sorts on the last
  47.   field. This means that you only need to edit the comment field of a record
  48.   if you feel that the normal method puts the entry in the wrong place for
  49.   you, in most cases you probably won't need to do this. This should
  50.   minimise set-up work editing the 3rd Comment line.
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.   Though appearing in the address book as "comments", these lines are entered
  67.   in the Edit Address Book as "Notes", the number of the word to be sorted on
  68.   is therefore added as shown below:
  69.  
  70.      +-[ ]-------------Edit Address Book------------------+
  71.      |    Name    [                                     ] |
  72.      |                                                    |
  73.      |    Address [                                     ] |
  74.      |                                                    |
  75.      |   +-Notes ---------------------------------------+ |
  76.      |   |                                              | |
  77.      |   |                                              | |
  78.      |   |<No. OF WORD TO SORT ON APPEARS HERE>         | |
  79.      |   +----------------------------------------------+ |
  80.      |                                                    |
  81.      |   [F10-OK]           [F1-HELP]          [CANCEL]   |
  82.      +----------------------------------------------------+
  83.  
  84.   If there is already text on comment line 3, the number goes at the end
  85.   of that text, separated from it by a space, if there is no text the
  86.   number can go at the start of the line. The other two lines may be empty
  87.   -it makes no difference.
  88.   The only essential is that the sort number is the LAST WORD OF THE LAST
  89.   LINE in that Notes box.
  90.  
  91.   As an example of how this would works in practice, the following:
  92.  
  93.     NAME FIELD                           3RD COMMENT FIELD
  94.     ----------                           -----------------
  95.     Acme Widgets Corp.                   <the comments, if any> 1
  96.     A.N.Other [TeamOz]                   <the comments, if any> 2
  97.     Loudon Wainwright III                <the comments, if any> 2
  98.     Mark Lathwell                        <comment only, if any>
  99.     Michael A. Atherton                  <comment only, if any>
  100.  
  101.  
  102.   would produce a sort into what I consider the sensible order, ie:
  103.  
  104.     Acme Widgets Corp.
  105.     Michael A. Atherton
  106.     Mark Lathwell
  107.     A.N.Other [TeamOz]
  108.     Loudon Wainwright III
  109.  
  110.   BUT (again) the order is completely customisable - if you think it
  111.   sensible to have Acme Widgets under W (for Widgets) - because maybe you
  112.   entries for several widget makers and want them all sorted together -
  113.   or you are on first name terms with Loudon and want to look him up under L
  114.   you only have to edit the 3rd comment line accordingly.
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.   What actually happens when you force a custom sort like this is that (for
  133.   the purposes of the sort only) a temporary string is created by "pasting"
  134.   the chosen word to the front of the whole name field, so that e.g.if you
  135.   choose to sort its entry on word 2 'Acme Widgets Corp.'  would be sorted
  136.   as if it were 'Widgets Acme Widgets'!  Therefore the  records are sorted
  137.   with the word you select as a primary field and then,  within that sort
  138.   on the whole name. If you elected to sort these on  the word 'Widgets':
  139.  
  140.   Acme Widgets Corp.
  141.   British Amalgamated Widgets
  142.   Wally's Widgets Warehouse
  143.   Widgets 'R' Us
  144.  
  145.   That would be the order they end up in but they would all be 'filed'
  146.   under W (for widgets).
  147.  
  148.  3) Parameters:
  149.   A single parameter gives the name (and/or path) of the address-book to be
  150.   sorted. It is optional, if absent the OzCIS default address book,
  151.   (addrbook.adr in the OzCis root directory) is assumed. If you keep your
  152.   address book in another directory (because maybe you have a different
  153.   address book in each of several host's directories) or you call it
  154.   something else a parameter giving the name AND PATH of the address
  155.   book file must be passed.
  156.  
  157.  4) How:
  158.   The easiest way to use this is from the OzCIS externals menu, install
  159.   it with "2nd Cmd processor?", and "Pause after execution?" checked. If
  160.   you need parameters and its the same one every time it can be put on
  161.   the command line with the program name
  162.  
  163.   eg.   SORTADDR  c:\ozcis2\host1
  164.  
  165.   otherwise, for multiple address books, and therefore different parameters
  166.   the "Prompt for params?" should also be checked.
  167.  
  168.  5) Paranoia Department:
  169.   I have tested the program fully and it works OK on my system, also the
  170.   underlying version has been d/loaded (and presumably used) by many
  171.   IBMCOM Sec 12 inmates without any reported problems BUT ...
  172.  
  173.   ... Obviously I can't foresee every configuration of equipment (or
  174.   complexity of address book formats) on which this utility will be used
  175.   so I cannot guarantee its infallibility (well, would you?).
  176.   Therefore, JIC, the old, unsorted, address book is backed-up by the
  177.   utility to a file with the same filename (but with the extension .BAK)
  178.   so that, if something unexpected happens during sorting or file-saving
  179.   all your lovingly entered address data will be retrievable.
  180.  
  181.  6) Thanks
  182.   This little utility has developed from helpful and constructive
  183.   comment from the IBMCOM Sec 12 gang for which I am grateful. Feedback
  184.   via the forum is always welcome. Acknowledgement for the customisation
  185.   idea leading to this update is due to Todd Fiske of TeamOz.
  186.   I guess we ALL owe thanks to Steve Sneed for the excellent OzCIS and
  187.   to TeamOz for their patience in gently guiding us all though it.
  188.  
  189. SortAddr is free to anyone who wants it. Hope you find it useful.
  190.  
  191. Richard Linter [70624,414] Somerset UK August 1993
  192.  
  193. Modifications:
  194.  This small mod is to account for the fact that some address-book records 
  195.  turn out to be delimited by ; (character #59) instead of │ (character #179)
  196.  which is normally as a delimitor. Now both are recognised as deleimitors.
  197.  
  198.  
  199.