home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / MT_BBS11.ZIP / QSORT.DOC < prev    next >
Encoding:
Text File  |  1993-08-18  |  86.0 KB  |  1,665 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.                                QSORT -- Version 4.11QSORT -- Version 4.11
  29.  
  30.                              Text File Sorting UtilityText File Sorting Utility
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.                           Copyright 1985-1989 - Ben BakerCopyright 1985-1989 - Ben Baker
  44.  
  45.                                 All rights reservedAll rights reserved
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.                                  Table of ContentsTable of Contents
  53.  
  54.  
  55.  
  56.        Introduction                                                1
  57.           About Shareware                                          1
  58.           Notation                                                 2
  59.  
  60.        The QSORT Command and Options                               3
  61.           The /<key_spec> Parameter                                4
  62.           Records and Record Types                                 5
  63.           The /F<len> Parameter                                    6
  64.           The /N<term>[<term2>] Parameter                          6
  65.           The /T[<tag>] Parameter                                  7
  66.           The /D[<fields>][<delim>] Parameter                      7
  67.           The /R Parameter                                         8
  68.           The /S[V] Parameter                                      8
  69.           The /? Parameter                                         9
  70.           The @<command_file> parameter                           10
  71.           The "2><error_file>" parameter                          12
  72.  
  73.        Lexicographic Sorting                                      14
  74.  
  75.        Examples                                                   16
  76.  
  77.        Error Messages and Return Codes                            19
  78.           Command Line Errors                                     19
  79.           Memory Errors                                           21
  80.           I/O Errors                                              21
  81.           Internal Errors                                         22
  82.           ERRORLEVEL Return Codes                                 22
  83.  
  84.        Implementation Notes                                       23
  85.           General Information                                     23
  86.           Performance and DOS Configuration                       23
  87.           Performance and Sort Keys                               25
  88.           Performance and Memory Size                             26
  89.           Performance and File Size                               26
  90.  
  91.        LIMITED WARRANTY                                           28
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.                                         i
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.                                    List of TablesList of Tables
  115.  
  116.  
  117.  
  118.        Table 1 - Special character notation                        7
  119.  
  120.        Table 2 - Key type sorting examples                        14
  121.  
  122.        Table 3 - ERRORLEVEL return codes                          22
  123.  
  124.  
  125.  
  126.                                   List of FiguresList of Figures
  127.  
  128.  
  129.  
  130.        Figure 1 - Sort statistics report                           8
  131.  
  132.        Figure 2 - Parameter evaluation report                     10
  133.  
  134.        Figure 3 - Sample command file listing                     11
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.                                         ii
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.                                  IntroductionIntroduction
  180.  
  181.  
  182.        QSORT was first designed to be a replacement for, and to overcome
  183.        the limitations of DOS SORT.  The current version will sort files
  184.        whose size is limited only by available disk space.  File name(s)
  185.        may be given explicitly or QSORT will sort from standard input to
  186.        standard  output,   and  so,   may  be  used  in  pipes  or  with
  187.        redirection.   Multiple keys may be specified.  Binary files with
  188.        fixed-length records  may be  sorted, provided only that keys are
  189.        ASCII character strings.
  190.  
  191.        QSORT tries  to be very protective of your data.  If QSORT has an
  192.        error of  any kind,  it will  terminate with the input file still
  193.        intact, and  will return to DOS with a non-zero ERRORLEVEL.  When
  194.        QSORT successfully  completes sorting  a file, it terminates with
  195.        ERRORLEVEL set to zero.
  196.  
  197.        The command  line syntax  is a super-set of DOS SORT's syntax, so
  198.        QSORT may  be used  without other  changes in  batch files  using
  199.        SORT, but  in most  cases you  will want  to make  use of QSORT's
  200.        greater capabilities.
  201.  
  202.  
  203.        About SharewareAbout Shareware
  204.  
  205.        QSORT is  the copyrighted  property of  Ben Baker,  and  is  made
  206.        available under  the "shareware" concept.  Shareware products are
  207.        distributed freely and publicly.  You are invited to "test drive"
  208.        them without  cost.   But shareware  is NOT  FREE!   If you use a
  209.        product, you  are expected  to pay  a fee  for its  use.  Because
  210.        overhead costs  are lower,  this fee is usually a fraction of the
  211.        normal commercial  price the  product might  carry, but it is NOT
  212.        zero!
  213.  
  214.        Version 4  of QSORT will continue to be distributed and supported
  215.        as shareware.  It may be freely copied and distributed,  provided
  216.        that 1) it is distributed under the name "QSORT," and 2) the doc-
  217.        umentation file always accompanies it.
  218.  
  219.        If you  find this program useful and it meets your needs, noncom-
  220.        mercial users  are asked  to pay  a license  fee of  $20 for each
  221.        machine on which it is used.
  222.  
  223.        The license  fee for  commercial use  of QSORT, version 4, is $35
  224.        each for  the first  nine machines  on which it is used.  Liberal
  225.        quantity discounts, and site licensing are available.
  226.  
  227.        Vendors wishing to distribute QSORT, version 4, as a part of com-
  228.        mercial products  may contact the author at the address below for
  229.        terms.
  230.  
  231.  
  232.  
  233.        QSORT Text Sorting Utility                                      2
  234.  
  235.  
  236.        Send checks or correspondence to:
  237.  
  238.                  Baker & Associates     Baker & Associates
  239.                  One Mark Twain Plaza, Ste 325GOne Mark Twain Plaza, Ste 325G
  240.                  Edwardsville, IL 62024Edwardsville, IL 62024
  241.                  Phone: (618) 656-8850Phone: (618) 656-8850
  242.  
  243.        From time  to time,  as necessary,  maintenance updates  will  be
  244.        released to correct deficiencies, but no new features or capabil-
  245.        ities will be added to this shareware product.  All future devel-
  246.        opment will  go into  the commercial  version of  QSORT.  At this
  247.        writing, version  5 is  available as a commercial product.  It is
  248.        significantly faster  than this  version and  has a number of new
  249.        features, not  the least  of which  is the  ability to sort dBASE
  250.        database files.
  251.  
  252.        The complete  commercial package  (version 5 or later), including
  253.        printed documentation and technical support may be purchased from
  254.        System Enhancement Associates at the following address:
  255.  
  256.                  System Enhancement Associates, Inc.     System Enhancement Associates, Inc.
  257.                  925 Clifton Ave.925 Clifton Ave.
  258.                  Clifton, NJ 07013Clifton, NJ 07013
  259.                  Phone: (201) 473-5153Phone: (201) 473-5153
  260.  
  261.  
  262.        NotationNotation
  263.  
  264.        In defining  the command  line and  its various  parameters,  the
  265.        following notation is used:
  266.  
  267.        [[<optional><optional>]] items are enclosed in square brackets.        __________
  268.  
  269.        <variable><variable> items  appear in lower case, underscored, and are       __________                              ___________
  270.             surrounded by  angle brackets  (<>).  They are replaced
  271.             by actual data such as a file name.
  272.  
  273.        THIS |  THATTHIS |  THAT   Choices are  separated  by  a  vertical  bar.
  274.             Select one or the other but not both.
  275.  
  276.        [THIS |  THAT][THIS |  THAT]   When the  choices are  enclosed  in  square
  277.             brackets, they  are optional.    You  need  not  select
  278.             either.
  279.  
  280.        REPEAT. . .REPEAT. . .  The ellipsis (. . .) means the item to its left
  281.             may be repeated as many times as necessary.
  282.  
  283.        UPPER CASEUPPER CASE  items and  all special  characters  not  defined
  284.             above represent  themselves.   They are entered exactly
  285.             as they appear.
  286.  
  287.        EXAMPLESEXAMPLES are shown in boldbold upper case characters.
  288.  
  289.  
  290.  
  291.        QSORT Text Sorting Utility                                      3
  292.  
  293.  
  294.                          The QSORT Command and OptionsThe QSORT Command and Options
  295.  
  296.  
  297.        QSORT is invoked with the following command:
  298.  
  299.             QSORT [QSORT [<in_file><in_file> [ [<out_file><out_file>]] [/]] [/<key_spec><key_spec>]. . .]. . .                   _________  __________     __________
  300.                  [/F[/F<len><len> | /D[ | /D[<fields><fields>][][<delim><delim>] | /T[] | /T[<tag><tag>]]]]                    _____      ________  _______       _____
  301.                  [/N[/N<term><term>[[<term2><term2>]] [/R] [/S[V]] [/?]]] [/R] [/S[V]] [/?]                    ______ _______
  302.                  [@[@<command_file><command_file>] ["2>] ["2><error_file><error_file>"]"]                   ______________      ____________
  303.  
  304.        Note that  all parameters  on the command line are optional.  The
  305.        <in_file> and  <out_file> parameters  are ASCII  file specifiers.       _________      __________
  306.        They may  contain disk  and path  information in the standard DOS
  307.        format,  but   must  not  contain  "wild-card"  characters.    If
  308.        <in_file> is missing, QSORT sorts from standard input to standard       _________
  309.        output.   These are  files defined and opened by DOS before QSORT
  310.        is loaded.   (See  your DOS manual concerning the use of redirec-
  311.        tion and pipes.)
  312.  
  313.        The simplest of all invocations of the QSORT program is just:
  314.  
  315.             QSORTQSORT
  316.  
  317.        DOS assigns input to the key board, and output to the screen.  As
  318.        you type  lines of  input, QSORT  salts them  away  in  its  sort
  319.        buffer.   When all  lines have  been entered, type a CTRL-ZCTRL-Z (hold
  320.        the "Ctrl"  key and  press "Z")  and press "Enter."  This signals
  321.        DOS that you are finished and QSORT sorts its buffer and the out-
  322.        put is displayed on your screen.
  323.  
  324.        If <in_file>  is given but <out_file> is missing, QSORT creates a          _________               __________
  325.        temporary file in the directory containing <in_file> and sorts to                                                  _________
  326.        the temporary  file.   On  successful  completion  of  the  sort,
  327.        <in_file> is  deleted and  the temporary is renamed to <in_file>.       _________                                              _________
  328.        The effect is an apparent "sort-in-place."
  329.  
  330.        If both  file names  are given,  <in_file> is  unchanged and  the                                        _________
  331.        sorted output  is written to <out_file>.  Note that the following                                    __________
  332.        two commands are exactly equivalent:
  333.  
  334.             QSORT  FILE.TXT  FILE.SRTQSORT  FILE.TXT  FILE.SRT
  335.  
  336.             QSORT <FILE.TXT >FILE.SRTQSORT <FILE.TXT >FILE.SRT
  337.  
  338.        In the  first, QSORT opens the files.  In the second, redirection
  339.        is specified  and DOS  opens the  files.  The result is the same.
  340.        It is  an error  QSORT can't  detect if  you mix  these.  For in-       ________________________________________________________
  341.        stance:
  342.  
  343.             QSORT  FILE.TXT >FILE.SRTQSORT  FILE.TXT >FILE.SRT
  344.  
  345.        will result  in a  sort-in-place.   QSORT will  open FILE.TXT but
  346.        won't know DOS has opened FILE.SRT for it, and will ignore it.
  347.  
  348.  
  349.  
  350.        QSORT Text Sorting Utility                                      4
  351.  
  352.  
  353.        The /The /<key_spec><key_spec> Parameter Parameter            __________
  354.  
  355.        Up to  30 / /<key_spec> parameters may be used to specify sort keys                  __________
  356.        and are  ordered  major  to  minor  from  left  to  right.    The
  357.        //<key_spec> argument has the form:        __________
  358.  
  359.             /[+|-][/[+|-][<field><field>.][.][<col><col>][:][:<length><length>][][<type><type>]]                   _______   _____   ________  ______
  360.  
  361.        Note that  all elements  of this  argument are "optional," but at
  362.        least one element must be present following the slant-bar (/)(/).
  363.  
  364.        The minus (--) sign reverses the sorting order for this key, while
  365.        the plus (++) sign (or no sign) specifies normal sort order.
  366.  
  367.        There are three numbers associated with every sort key: the field
  368.        number, the  starting column  within the field, and the length of
  369.        the key  in characters.   Any,  or all  of them may be given in a
  370.        //<key_spec> parameter.   QSORT  uses punctuation to identify each        __________
  371.        number.   A number followed by a period (..) is a field number.  A
  372.        number preceded by a colon (::) is a length number.  A column num-
  373.        ber has  no punctuation associated with it.  It follows the field
  374.        number, if any, and precedes the length number, if any.
  375.  
  376.        The [[<field>.].]  element is  used only  for  "delimited-field"  or            _______
  377.        "tagged" records,  and locates this key within a particular field
  378.        of a  delimited-field record  or line  of a tagged record.  Under
  379.        certain circumstances limits are placed on the [[<field>.].] element                                                       _______
  380.        (see the  /D  /D parameter  below).   If [[<field>.].]  is omitted,  the                                             _______
  381.        first field or line is assumed.  For consistency, all records are
  382.        assumed to have "fields."  In all cases except delimited-field or
  383.        tagged records,  there is  precisely one  field, and it spans the
  384.        entire record.
  385.  
  386.        If present,  [[<col>]] defines the beginning column of the key.  If                     _____
  387.        omitted, column  1 is  assumed.   In the  case of delimited-field
  388.        records, column 1 is the first character of the identified field.
  389.        In the case of tagged records, column 1 is the first character of
  390.        the identified  line.   In all other cases, column 1 is the first
  391.        character of the record.
  392.  
  393.        If present,  [:[:<length>]] defines  the key  length in  columns (or                      ________
  394.        characters).   If [:[:<length>]] is omitted, the rest of the record,                           ________
  395.        or field  in delimited-field  or tagged records, is assumed to be
  396.        part of the key.
  397.  
  398.        The [[<type>]]  element is  an optional  suffix letter  which tells            ______
  399.        QSORT how  to compare these keys.  At present, there are only two
  400.        key types  recognized by QSORT, but others are planned for future
  401.        versions.
  402.  
  403.        If no [[<type>]] is given, or if [[<type>]] is "A" these keys will be              ______                   ______
  404.        ordered according  to the  ASCII character  sequence.    This  is
  405.        QSORT's default behavior.
  406.  
  407.  
  408.  
  409.        QSORT Text Sorting Utility                                      5
  410.  
  411.  
  412.        If [[<type>]] is "L" QSORT uses a "lexicographic" sequence for this           ______
  413.        key.   Lexicographic sequence is ordered first by spelling, then,
  414.        when keys  have identical spelling, by capitalization.   (See the
  415.        section on Lexicographic Sorting later in this manual.)
  416.  
  417.        To avoid  confusion, [[<type>]]  must not  be the  only  <key_spec>                             ______                           __________
  418.        element given.   In  other words,  if you  wish to use the entire
  419.        record as  the sort key, but sort records in lexicographic order,
  420.        use /+L/+L,  not /L/L.   The  "+" in  the first  form serves  only  to                 ___
  421.        identify this as a <key_spec> parameter.                          __________
  422.  
  423.        If no  key parameters are given, the entire record, or the entire
  424.        first field is a standard ASCII key.
  425.  
  426.        When sorting variable-length records, any key which begins beyond
  427.        the end  of its field in a particular record is treated as a null
  428.        (zero length)  key for that record, and will sort low relative to
  429.        all records  with non-null  values for  that key.   When  sorting
  430.        fixed-length records,  all defined  keys must fall within the de-                                                ____
  431.        fined record  length.  <key_spec> parameters must appear in order                              __________
  432.        of importance, primary key first.
  433.  
  434.  
  435.        Records and Record TypesRecords and Record Types
  436.  
  437.        The QSORT  program sorts  logical units  called records.    In  a                                                       _______
  438.        majority of  cases, a  record is simply a variable length line of
  439.        text in  a standard  ASCII text  file,  but  QSORT  does  provide
  440.        support for  fixed length  records, and several variations on the
  441.        variable length record theme.
  442.  
  443.        Fixed length  records are  just what  the name  implies  --  each
  444.        record consists  of a  defined number  of bytes.   Record parsing
  445.        consists of merely counting.
  446.  
  447.        A variable  length record is one or more variable length lines of                                                                _____
  448.        ASCII text.   A  line is  a possibly  empty string  of characters
  449.        ending with a newline sequence.                     ________________
  450.  
  451.        The QSORT program supports three kinds of variable length record:
  452.  
  453.        The default:  Standard lines  of text,  as mentioned  above,
  454.             with keys  located at  fixed positions within each line
  455.             (by default, the entire line).
  456.  
  457.        Delimited records:   These  are lines which are divided into
  458.             variable length fields separated by a special character                            ______
  459.             called a  delimiter.   A sort key may be located within
  460.             any particular field.
  461.  
  462.        Tagged records:   These  are logical  records consisting  of                                    _______
  463.             many lines of text.  QSORT finds the end of each record
  464.             by searching  for  either  an  empty  line  or  a  line
  465.             containing a  particular tag  character.  Sort keys are                                     ___
  466.  
  467.  
  468.  
  469.        QSORT Text Sorting Utility                                      6
  470.  
  471.  
  472.             usually located  on the  first line  of the record, but
  473.             may be defined to be on any particular line.
  474.  
  475.  
  476.        The /FThe /F<len><len> Parameter Parameter             _____
  477.  
  478.        The /F /F<len>  parameter denotes  the record  length for  a file of             _____
  479.        fixed-length records.   All records in the input file must be ex-                                                             ____
  480.        actly <len> bytes long.  The records need not (but may) be termi-             _____
  481.        nated with a CR/LF sequence.  They may contain any data, even bi-
  482.        nary data,  but the  keys must  be ASCII strings.  Strings may be
  483.        terminated with  a null (binary zero) character, or may be padded
  484.        with trailing  spaces to the full length of the key, but if these
  485.        conventions are mixed, it will affect sorting order.
  486.  
  487.        Note that QSORT does not attempt to support Pascal style strings.
  488.        These are strings which begin with a character whose binary value
  489.        is a  character count.  This is followed by <count> characters of                                                   _______
  490.        ASCII data,  which in  turn is followed by random data out to the
  491.        maximum length of the string.  These strings may be used as keys,
  492.        but the  programmer must insure that either the last real charac-
  493.        ter is  a null character, or the key is padded to its full length
  494.        with spaces.   QSORT must be told that the key begins in the sec-
  495.        ond character position (the first character of real data).
  496.  
  497.  
  498.        The /NThe /N<term><term>[[<term2><term2>] Parameter] Parameter             ______ _______
  499.  
  500.        When sorting variable length records, the QSORT program finds the
  501.        end of  each line  by searching  for the  newline sequence.  Most                                                 _______ ________
  502.        files are  well behaved  in this respect.  Their lines end with a
  503.        carriage-return character (CRCR), followed by a line-feed character       _______________                               _________
  504.        (LFLF).  The /N<term><term>[term2>term2>] is provided to handle the exceptions.                    ______ ______
  505.        It allows  you to redefine the newline sequence to be any one- or
  506.        two-character sequence,  and thus  match  the  most  pathological
  507.        convention a file might observe!
  508.  
  509.        For example,  a file  might contain  lines ending with a naked LFLF
  510.        character.  This is a standard convention for files imported from                             ________
  511.        a UNIX  environment.   Without redefining  the newline  sequence,
  512.        QSORT could  not sort these files.  (Another situation where this
  513.        is useful will be described under the /D/D parameter, below.)
  514.  
  515.        <term> and  the optional <term2> define the one- or two-character       ______                   _______
  516.        sequence QSORT is to use to find the end of each line of text.
  517.  
  518.        Some characters  cannot be  used to represent themselves in a DOS
  519.        command line.   For  that reason,  QSORT uses  codes to represent
  520.        them.   These codes are actually a pair of characters.  The first
  521.        is always  a back-slash (\).  The second character identifies the
  522.        special character  it represents.   Table  1  lists  the  special
  523.        characters recognized by QSORT.
  524.  
  525.  
  526.  
  527.        QSORT Text Sorting Utility                                      7
  528.  
  529.  
  530.        To perform  a simple  sort   +-----------------------------------+
  531.        on   a   UNIX   file,   as     \B   Space character                                    |    |                              |
  532.        mentioned above, you would     \F   Form feed character                                    |    |                              |
  533.        use the command:               \L   Line feed character                                    |    |                              |
  534.                                       \N   Newline sequence                                    |    |                              |
  535.             QSORT UNIXFILE /N\LQSORT UNIXFILE /N\L       \R   Carriage return                                    |    |                              |
  536.                                       \T   Tab character                                    |    |                              |
  537.        Note that the \N\N character     \/   The slant bar character                                    |    |                              |
  538.        listed in  table 1  has no     \\   Back-slash character itself                                    |    |                              |
  539.        meaning in  this  context.   +-----------------------------------+
  540.        It   means   the   newline                    _____________
  541.        sequence  and   cannot  be       ________                     Table 1 - Special character notation
  542.        used to define itself.               ______
  543.  
  544.  
  545.        The /T[The /T[<tag><tag>] Parameter] Parameter              _____
  546.  
  547.        The /T[ /T[<tag>]]  parameter, if  present, indicates that the records              _____                                              _______
  548.        to be sorted may be more than a single line long.
  549.  
  550.        If <tag>  is also  present, it  defines a character to be used to          _____
  551.        tag the  "end-of-record."   If <tag>  is not  present, the  first                                      _____
  552.        empty line  terminates the  record.   For this  purpose,  "empty"
  553.        means "no  characters." A  line containing  but a single space is
  554.        not empty!  A line may be "tagged" by placing the <tag> character       ___                                               _____
  555.        anywhere on  the last line of a logical record.  The entire line,
  556.        including the  tag character  will appear as the last line of the
  557.        record.
  558.  
  559.        The special  characters  defined  in  table  1  may  be  used  to
  560.        represent <tag>.   Thus  an invisible tab character might be used                 _____
  561.        to end  a multi-line  logical record.   Notice that the slant bar
  562.        (//), when  used  as  a  delimiter  character  in  the  /T  /T  or  /D  /D
  563.        parameters, must be prefixed by the back-slant to prevent it from
  564.        being interpreted as the beginning of a new parameter.
  565.  
  566.  
  567.        The /D[The /D[<fields><fields>][][<delim><delim>] Parameter] Parameter              ________  _______
  568.  
  569.        The /D[ /D[<fields>][][<delim>]] parameter, if present, states that this              ________  _______
  570.        file contains  delimited-field records.  In other words, a record                      _______________
  571.        is made up of distinct, variable length fields separated from one
  572.        another by  a particular  character, or  delimiter.   Records are                                                _________
  573.        separated, or delimited by the newline sequence.                                      ________________
  574.  
  575.        If a  <delim> character  is present, QSORT uses it as a field de-             _______
  576.        limiter character.   Otherwise  a comma  (,) is assumed to be the
  577.        delimiter.   The same  character codes  listed in  table 1 may be
  578.        used to  represent these  characters.   Note that  "\N""\N" means the
  579.        newline  sequence,   either  CRLFCRLF  or  as  redefined  by  the  /N/N       _________________
  580.        parameter.
  581.  
  582.        The <fields> element defines the number of variable length fields           ________
  583.        contained in  each record.    In  most  cases,  this  element  is
  584.  
  585.  
  586.  
  587.        QSORT Text Sorting Utility                                      8
  588.  
  589.  
  590.        +----------------------------------------------------------------+
  591.             437248 bytes of buffer space available       |                                                                |
  592.        |                                                                |
  593.              61344 records sorted       |                                                                |
  594.                126 bytes in longest record       |                                                                |
  595.        |                                                                |
  596.             885731 sort phase comparisons       |                                                                |
  597.              99510 merge phase comparisons       |                                                                |
  598.        |                                                                |
  599.             985241 total comparisons       |                                                                |
  600.               16.0 comparisons per input record       |                                                                |
  601.        |                                                                |
  602.                 11 temporary merge files created       |                                                                |
  603.                  1 merge passes       |                                                                |
  604.                2.0 average passes over data       |                                                                |
  605.        |                                                                |
  606.               4:29 elapsed time       |                                                                |
  607.        +----------------------------------------------------------------+
  608.  
  609.                        Figure 1 - Sort statistics report
  610.  
  611.        unnecessary.  The QSORT program accommodates a variable number of
  612.        delimited fields.   If  a sort  key is  defined for a field which
  613.        does not  exist in  the current record, it is treated as NULL and
  614.        sorts low  when compared  with a  record which contains the field
  615.        and its key.
  616.  
  617.        There is  a  special  case  in  which  the  <fields>  element  is                                                   ________
  618.        required, and  there must  be exactly <fields> fields in each and       ________                              ________
  619.        every record.   When  <delim> is \N\N, the QSORT program has no way                             _______
  620.        to find  the end  of each logical record, except to count fields.
  621.        (Why would you want to do this?  See the mailing label example on
  622.        page 18.)
  623.  
  624.             NOTE:   The /F/F,  /T/T and  /D/D parameters define different                                                          _________
  625.             record formats,  and are  therefore incompatible.  Only
  626.             one of  these parameters  may be  used  for  any  given
  627.             execution of the QSORT program.
  628.  
  629.  
  630.        The /R ParameterThe /R Parameter
  631.  
  632.        The /R /R  parameter is included for compatibility with DOS SORT and
  633.        is redundant.   It  reverses the  sense of sort direction for all
  634.        sort keys.
  635.  
  636.  
  637.        The /S[V] ParameterThe /S[V] Parameter
  638.  
  639.        The /S /S  parameter tells  QSORT to make a statistics report to the
  640.        screen at  the end  of a  run.   The report  is  written  to  the
  641.        standard error  device, by  default, the console.  Figure 1 is an       ______________
  642.  
  643.  
  644.  
  645.        QSORT Text Sorting Utility                                      9
  646.  
  647.  
  648.        actual statistics  report produced  after QSORT had sorted a four
  649.        and one half megabyte file.
  650.  
  651.        The first number is the size of the sort buffer the QSORT program
  652.        was able  to obtain from DOS.  It depends on the amount of memory
  653.        available in  your machine  at the  time QSORT  is executed.  The
  654.        more there is, the better QSORT will perform.
  655.  
  656.        The next  two numbers are self-explanatory.  Then come the number
  657.        of times  two records were compared during the sort phase and the
  658.        merge phase respectively, followed by the total comparisons.
  659.  
  660.        The next  number is  total comparisons  divided by  the number of
  661.        records in  the input  file.   This number is typically 10 to 20.
  662.        If it  is much  larger than  20, it  usually means  that there is
  663.        something unusual  about your  input file.   It  may  already  be
  664.        sorted, or  there may  be large  blocks of  records which compare
  665.        equal.   This can  happen if  you sort  on, say column 50 and the
  666.        input file  contains a  large number  of records  shorter than 50
  667.        bytes.  In   this  case,  a  minor  sort  key  at  column  1  may
  668.        significantly speed sorting.
  669.  
  670.        The next  two items  are self-explanatory.   "Average passes over
  671.        data" reflects the number of times each record was read and writ-
  672.        ten.   For short  files not  requiring a  merge pass, this number
  673.        will be  1.0.  When merging is needed, the last merge pass is the
  674.        one which writes the output file and it must read and write every
  675.        record exactly  once.   Thus when  only one  merge pass  is made,
  676.        there will  be exactly  2.0 "average passes over data." Extremely
  677.        large files  may produce more temporary files than QSORT can read
  678.        at one  time, and thus require more than one merge pass.  In that
  679.        event, this number will be higher.
  680.  
  681.        The optional  subparameter, [V][V]  (for verbose),  causes the QSORT
  682.        program to  make running  progress reports  to the  screen.  Each
  683.        pass during  both the sort phase and the merge phase (if any) is-
  684.        sues a  1-line report telling the merge file(s) and the number of
  685.        records being processed during that particular pass.  This is not
  686.        terribly useful  for short  files, but  for the  big ones, it can
  687.        give the  user a warm comfortable feeling that something is actu-
  688.        ally being done.
  689.  
  690.             NOTE: The  sort reported in Figure 1 was performed on a
  691.             Zenith 248,  an eight  megahertz AT clone with two hard
  692.             drives (C  and D).   The  input  file  was  on  C;  the
  693.             temporary merge  files were placed on D; and the output
  694.             file was  written to  C:.   The sort  of a 4.5 megabyte
  695.             file took under four and a half minutes.
  696.  
  697.  
  698.        The /? ParameterThe /? Parameter
  699.  
  700.        The /? /?  parameter requests  help or  parameter evaluation.   When
  701.        QSORT is  executed with  the /? /? parameter alone, it lists a short
  702.  
  703.  
  704.  
  705.        QSORT Text Sorting Utility                                     10
  706.  
  707.  
  708.        +----------------------------------------------------------------+
  709.         With the present arguments, QSORT would sort from STDIN to       |                                                                |
  710.         STDOUT       |                                                                |
  711.         Records are multiple lines ending with an empty line       |                                                                |
  712.        |                                                                |
  713.         Key fields in descending order of importance are:       |                                                                |
  714.           Field  Pos   Len Type       |                                                                |
  715.        |                                                                |
  716.               1    5    12 Lexical Descending       |                                                                |
  717.               1    3     2 ASCII       |                                                                |
  718.               1   22 65535 ASCII   Descending       |                                                                |
  719.        +----------------------------------------------------------------+
  720.  
  721.                     Figure 2 - Parameter evaluation report
  722.  
  723.        description of  the QSORT parameters.  If /? /? is entered as one of
  724.        several parameters,  QSORT will  produce a  short report  on  the
  725.        screen describing the sort it would perform based on those param-
  726.        eters without actually doing a sort.
  727.  
  728.        For example:
  729.  
  730.             QSORT /? /5:12L /-3:2 /22 /T /R <INFILE.TXT >OUTFILE.TXTQSORT /? /5:12L /-3:2 /22 /T /R <INFILE.TXT >OUTFILE.TXT
  731.  
  732.        produces a screen report similar to figure 2.
  733.  
  734.        This display  lists everything  QSORT knows  about  the  proposed
  735.        sort.   It shows the file name(s), if known, or in this case, the
  736.        fact that  QSORT is  being used  as a "filter" and file names are
  737.        unknown.   It lists  file characteristics,  here showing that the
  738.        input file has records "tagged" with an empty line.  And it lists
  739.        characteristics of all defined key fields.  The third key in this
  740.        report has an unspecified length.  The value "65535" merely means
  741.        that this  key extends  to the  end of  the first  line  of  each
  742.        record.
  743.  
  744.  
  745.        The @The @<command_file><command_file> parameter parameter            ______________
  746.  
  747.        Normally you  give QSORT  its parameters on the command line, but
  748.        it is also possible to place a complicated set of parameters in a
  749.        "command file,"  and tell  QSORT to  get its parameters from that
  750.        file.  For example, the command:
  751.  
  752.             DIR | QSORT /30:2 /24:5 /39 /34:5 /1DIR | QSORT /30:2 /24:5 /39 /34:5 /1
  753.  
  754.        would produce  a directory  listing sorted by file date and time,
  755.        oldest file first.  That's fine if you can remember which columns
  756.        DOS uses in its directory listings.  But I can't, can you?
  757.  
  758.        A file  named  DATESORT.DIRDATESORT.DIR  is  supplied  on  your  distribution
  759.        diskette.  Figure 3 is a listing of its contents.
  760.  
  761.  
  762.  
  763.        QSORT Text Sorting Utility                                     11
  764.  
  765.  
  766.        +----------------------------------------------------------------+
  767.           /30:2     ;; year - 2 digits       |                                                                |
  768.           /24:5     ;; month/day - 2 digits/2 digits       |                                                                |
  769.           /39:1     ;; 'a' or 'p' for AM or PM flag       |                                                                |
  770.           /34:5     ;; hour:min - 2 digits:2 digits       |                                                                |
  771.           /1        ;; file name, if date and time are equal       |                                                                |
  772.        +----------------------------------------------------------------+
  773.  
  774.                     Figure 3 - Sample command file listing
  775.  
  776.  
  777.        Using this file, the command:
  778.  
  779.             DIR | QSORT @DATESORT.DIRDIR | QSORT @DATESORT.DIR
  780.  
  781.        will produce the same sorted directory listing, and the file name
  782.        is a  lot easier to remember than the five sort keys!  It is also
  783.        possible to  mix command  line and  command file parameters.  The
  784.        command:
  785.  
  786.             DIR | QSORT @DATESORT.DIR /RDIR | QSORT @DATESORT.DIR /R
  787.  
  788.        produces a sorted list, newest rather than oldest file first.
  789.  
  790.        In DATESORT.DIRDATESORT.DIR,  each key  is placed on a line by itself.  Obvi-
  791.        ously, this works, but it is not necessary.  Parameters in a com-
  792.        mand file  need only  be separated by "white space," spaces, tabs
  793.        or new lines.
  794.  
  795.        A command  file is invoked by placing an "at sign" (@) before its
  796.        name, and  it may  contain any  valid QSORT parameters except the
  797.        "redirection" parameter, below.  It may even contain another com-
  798.        mand file  parameter, but  QSORT cannot  detect loops  in command
  799.        files invoked this way, so be careful.
  800.  
  801.        There is a limit to the depth command files may be nested.  Since
  802.        a command  file is  not closed until it has been completely read,
  803.        you cannot  have more  command files than you have available file
  804.        handles.   And it  is possible QSORT would run out of stack space
  805.        before it  runs out  of handles, and crash pitifully!  QSORT com-
  806.        mand file  nesting has  been tested  to a  depth of two, and it's
  807.        hard to  envision  ever  needing  more  than  that  (famous  last
  808.        words!).
  809.  
  810.        Notice, also  that there is a bunch of commentary in DATESORT.DIR DATESORT.DIR
  811.        which would  hopelessly confuse  QSORT if  it were entered on the
  812.        command line.   If QSORT finds two semi-colons (;;) in a row in a
  813.        command file,  it stops  looking at that line, and goes on to the
  814.        next line.   This  is only necessary if you wish to place commen-
  815.        tary into  a command  file.   The reason that two semi-colons are
  816.        needed to  introduce a  comment is that a command file might con-
  817.        tain a  perfectly legitimate parameter, /D;/D; for example, in which
  818.        a semi-colon is part of the parameter.
  819.  
  820.  
  821.  
  822.        QSORT Text Sorting Utility                                     12
  823.  
  824.  
  825.        There is  only one  situation in  which two  semi-colons might be
  826.        part of  a parameter,  and it  seems so  remote that  it's hardly
  827.        worth mentioning.   If  you wish  to sort  a file so pathological
  828.        that it  uses two  semi-colons as a newline sequence, you can put
  829.        /N;;/N;; on  the command  line, but not in a command file.  You could                                       ___
  830.        use /N;\;/N;\; instead, and accomplish the same thing.
  831.  
  832.        What if you wish to sort a file named @SILLY.FIL@SILLY.FIL?  The best thing
  833.        to do  is rename it and get rid of the at sign.  But if QSORT en-
  834.        counters a parameter which begins with two at signs (@@), it dis-                                              ___
  835.        cards the  first at sign and takes the rest of the parameter as a
  836.        literal file name.  Thus:
  837.  
  838.             QSORT @@SILLY.FIL @@SILLY.OUTQSORT @@SILLY.FIL @@SILLY.OUT
  839.  
  840.        would sort  your silly  file, placing the sorted output in a file
  841.        named @SILLY.OUT@SILLY.OUT.
  842.  
  843.  
  844.        The "2>The "2><error_file><error_file>" parameter" parameter              ____________
  845.  
  846.        The QSORT  program writes  its messages  and help  and statistics
  847.        screens to the DOS standard error device.  DOS allows the user to
  848.        redirect standard  input and  standard output,  as discussed ear-
  849.        lier, but  makes no provision for redirecting standard error.  As
  850.        far as  DOS is concerned, error messages belong on the screen and
  851.        nowhere else!
  852.  
  853.        The  "2>"2><error_file>""   parameter  provides   the  capability  of               ____________
  854.        redirecting QSORT's  messages and  screens to  the file  named in
  855.        <error_file>.   UNIX users  should recognize  the syntax  immedi-       ____________
  856.        ately.   It is borrowed from the Bourne-Shell.  Some replacements
  857.        for DOS'  COMMAND.COM, particularly  those which emulate the UNIX
  858.        environment, also  support this syntax.  The  parameter should be
  859.        enclosed in quote marks as shown to prevent later versions of DOS
  860.        from trying to perform the redirection wrongwrong!                                              _____
  861.  
  862.        Two variations on this parameter are also recognized by the QSORT
  863.        program.   "2>>"2>><error_file>"" tells  QSORT to open <error_file> in                      ____________                       ____________
  864.        append mode  and add  the messages for this run to the end of the
  865.        contents already  in <error_file>.   "2>&-""2>&-" turns off all message                            ____________
  866.        output from QSORT.
  867.  
  868.        To summarize:
  869.  
  870.             QSORT JUNK /S "2>MESSAGES.TXT"QSORT JUNK /S "2>MESSAGES.TXT"
  871.  
  872.        sorts the  file JUNK  in place,  writing the statistics screen to
  873.        the file  MESSAGES.TXT.   If that  file already exists, it is re-
  874.        placed by the output of this QSORT run.
  875.  
  876.             QSORT JUNK /S "2>>MESSAGES.TXT"QSORT JUNK /S "2>>MESSAGES.TXT"
  877.  
  878.  
  879.  
  880.        QSORT Text Sorting Utility                                     13
  881.  
  882.  
  883.        sorts the  file JUNK in place, appending the statistics screen to
  884.        the end of the file MESSAGES.TXT.
  885.  
  886.             QSORT JUNK /S "2>&-"QSORT JUNK /S "2>&-"
  887.  
  888.        sorts the  file JUNK  in place.  The /S/S parameter is meaningless,
  889.        since the  "2>&-""2>&-" parameter  turns off  all message  output  from                                               ___
  890.        QSORT!
  891.  
  892.  
  893.  
  894.        Command line  arguments may  appear in  any order  on the command
  895.        line except  that <in_file>  must appear  before <out_file>,  and                         _________                      __________
  896.        /<key_spec>  arguments   must  appear   in  descending  order  of        __________
  897.        importance.
  898.  
  899.  
  900.  
  901.        QSORT Text Sorting Utility                                     14
  902.  
  903.  
  904.        +----------------------------------------------------------------+
  905.          INPUT           ASCII           CASELESS        LEXICAL       |               |               |               |                |
  906.        |---------------+---------------+---------------+----------------|
  907.          DeLaPort        Baker           Baker           Baker       |               |               |               |                |
  908.          Smith           Brown           brown           Brown       |               |               |               |                |
  909.          brown           DeAngelo        bRown           bRown       |               |               |               |                |
  910.          deLaPorte       DeLaPort        Brown           brown       |               |               |               |                |
  911.          Deangelo        Deangelo        Deangelo        DeAngelo       |               |               |               |                |
  912.          deAngelo        Deangelo        deangelo        Deangelo       |               |               |               |                |
  913.          Brown           DelaPort        Deangelo        Deangelo       |               |               |               |                |
  914.          smith           DelaPorte       deAngelo        deAngelo       |               |               |               |                |
  915.          delaPorte       Harry           DeAngelo        deangelo       |               |               |               |                |
  916.          DelaPort        Smith           delaPort        DeLaPort       |               |               |               |                |
  917.          DeAngelo        bRown           DelaPort        DelaPort       |               |               |               |                |
  918.          DelaPorte       brown           delaPort        delaPort       |               |               |               |                |
  919.          deangelo        deAngelo        DeLaPort        delaPort       |               |               |               |                |
  920.          Harry           deLaPorte       DelaPorte       DelaPorte       |               |               |               |                |
  921.          delaPort        deLaPorte       deLaPorte       deLaPorte       |               |               |               |                |
  922.          Baker           deangelo        delaPorte       deLaPorte       |               |               |               |                |
  923.          deLaPorte       delaPort        deLaPorte       delaPorte       |               |               |               |                |
  924.          Deangelo        delaPort        Harry           Harry       |               |               |               |                |
  925.          bRown           delaPorte       smith           Smith       |               |               |               |                |
  926.          delaPort        smith           Smith           smith       |               |               |               |                |
  927.        +----------------------------------------------------------------+
  928.  
  929.                       Table 2 - Key type sorting examples
  930.  
  931.  
  932.  
  933.  
  934.                              Lexicographic SortingLexicographic Sorting
  935.  
  936.  
  937.        The lexicographic  sorting capability was born out of my own need
  938.        to sort  word lists  with mixed  capitalization.   ASCII sequence
  939.        produced some  bizarre results  when  words  beginning  with  'Z'
  940.        sorted before  those beginning with 'a.' Case-insensitive sorting
  941.        wasn't much  better  because  upper  and  lower  case  got  mixed
  942.        randomly.
  943.  
  944.        Table 2  illustrates the  problem.  The first column is a list of
  945.        names in  arbitrary order.   The  second is an ASCII sort of that
  946.        list.   Third, we have one possible case-insensitive, or caseless
  947.        sort of the list.  The fourth column is what I really wanted.  It
  948.        is sorted the way these words would be sorted in a dictionary (or
  949.        lexicon).   The third  and fourth  columns both  collect words of
  950.        identical spelling  together, but  in the third column, upper and
  951.        lower case  spelling are  in arbitrary  order, while  the  fourth
  952.        column places upper case spelling ahead of lower case spelling.
  953.  
  954.        For example, the two occurrences of Smith are widely separated in                                           _____
  955.        column 2 because one is capitalized and the other is not.  Column
  956.        3 brings  the two  together, but  in the wrong order.  They might
  957.  
  958.  
  959.  
  960.        QSORT Text Sorting Utility                                     15
  961.  
  962.  
  963.        have been  in the  right order,  but the  order is strictly arbi-
  964.        trary.   In column 4, Smith comes before smith, and lexicographic                             _____              _____
  965.        sorting will  always put  them in  this order.  Notice, also that
  966.        the two occurrences of delaPort are not together in column 3, but                              ________
  967.        are brought together in column 4.
  968.  
  969.        Lexicographic sorting  is  achieved  by  making  case-insensitive
  970.        comparisons of  entire keys.  If the keys compare equal, an ASCII
  971.        comparison is  made to  arbitrate the  tie.  In other words, when
  972.        "lexicographic" keys  in two records have different spelling, the
  973.        case-insensitive comparison  determines the order of the records.
  974.        When  "lexicographic"  keys  are  spelled  the  same,  the  case-
  975.        sensitive comparison determines the order of the records.
  976.  
  977.        Lexicographic keys  are defined,  as indicated  above, by placing
  978.        the letter  'L''L' in  the <type>  element at  the end of <key_spec>                              _______                        ___________
  979.        definitions.
  980.  
  981.        Lexicographic sorting  can be  very useful  when needed,  but  be
  982.        aware that  unnecessarily specifying  lexicographic ordering  may
  983.        degrade performance of QSORT.
  984.  
  985.  
  986.  
  987.        QSORT Text Sorting Utility                                     16
  988.  
  989.  
  990.                                    ExamplesExamples
  991.  
  992.  
  993.        Produce a  sorted directory listing and display it on the console
  994.        a screen's worth at a time:
  995.  
  996.             DIR | QSORT | MOREDIR | QSORT | MORE
  997.  
  998.        This demonstrates the use of QSORT as a "filter" in a "pipe."
  999.  
  1000.  
  1001.  
  1002.        Produce a directory listing sorted by creation date and time, and
  1003.        display it on the console a screen's worth at a time:
  1004.  
  1005.             DIR | QSORT /30:2 /24:5 /39 /34:5 /1 | MOREDIR | QSORT /30:2 /24:5 /39 /34:5 /1 | MORE
  1006.  
  1007.        The output  of the  DIR command  is piped to QSORT.  The keys de-
  1008.        fined are,  from left to right (major to minor), year (2 digits),
  1009.        month and day, AM/PM flag, time, and finally file name.  The out-
  1010.        put of QSORT is then piped to MORE for display.
  1011.  
  1012.        Alternatively, the command:
  1013.  
  1014.             DIR | QSORT @DATESORT.DIR | MOREDIR | QSORT @DATESORT.DIR | MORE
  1015.  
  1016.        using command  file DATESORT.DIRDATESORT.DIR supplied on your QSORT distribu-
  1017.        tion diskette, does the same thing.
  1018.  
  1019.  
  1020.  
  1021.        Next, replace  the unsorted FILE.TXT with the same data sorted in
  1022.        descending order.  Use columns 10 to 16 as the sort key:
  1023.  
  1024.             QSORT FILE.TXT /-10:7QSORT FILE.TXT /-10:7
  1025.  
  1026.                  or     or
  1027.  
  1028.             QSORT FILE.TXT /10:7 /RQSORT FILE.TXT /10:7 /R
  1029.  
  1030.                  or     or
  1031.  
  1032.             QSORT FILE.TXT /R /+10QSORT FILE.TXT /R /+10
  1033.  
  1034.  
  1035.  
  1036.        GLOSS.TXT is  an unsorted  glossary of terms.  The term being de-
  1037.        fined by  each entry  appears first, followed by several lines of
  1038.        definition.   The entries  are separated by empty lines.  Produce
  1039.        GLOSS.SRT, a sorted version of the glossary:
  1040.  
  1041.                  with redirection     with redirection
  1042.  
  1043.             QSORT /T  <GLOSS.TXT >GLOSS.SRTQSORT /T  <GLOSS.TXT >GLOSS.SRT
  1044.  
  1045.  
  1046.  
  1047.        QSORT Text Sorting Utility                                     17
  1048.  
  1049.  
  1050.                  or without redirection     or without redirection
  1051.  
  1052.             QSORT /T   GLOSS.TXT  GLOSS.SRTQSORT /T   GLOSS.TXT  GLOSS.SRT
  1053.  
  1054.  
  1055.  
  1056.        A lawyer  keeps a  running log  of  his  billable  activities  in
  1057.        TIME.LOG.   The first  line of  each entry is the account number,
  1058.        and the  second line  is date  and time  in  the  form  "mm/dd/yy
  1059.        hh:mm." He  always places  a tilde  (~) in  the last line of each
  1060.        entry.   He wishes  to sort the log by account number, and by as-
  1061.        cending date and time within each account:
  1062.  
  1063.             QSORT  /1. /2.7:2 /2.1:5 /2.10:5 /T~  TIME.LOGQSORT  /1. /2.7:2 /2.1:5 /2.10:5 /T~  TIME.LOG
  1064.  
  1065.  
  1066.  
  1067.        The directory  of users  for a bulletin board system is kept in a
  1068.        binary file  of fixed-length  records 180  bytes long.   The user
  1069.        name is  a 26-character field beginning in the first position and
  1070.        the city/state  field is  a 16-character  field beginning  in the
  1071.        fortieth position.  Sort the file by city/state and name.
  1072.  
  1073.             QSORT /F180 /40:16 /1:26 USER.BBSQSORT /F180 /40:16 /1:26 USER.BBS
  1074.  
  1075.  
  1076.  
  1077.        DB.TXT is  a delimited  field output  file from  dBASE III.  Each
  1078.        record contains  7 fields, delimited by commas.  Sort the file to
  1079.        the screen using field 3 as a sort key.
  1080.  
  1081.             QSORT /D /3. <DB.TXTQSORT /D /3. <DB.TXT
  1082.  
  1083.        Here, "standard input" has been redirected to the file.  Since no
  1084.        redirection is  given for  "standard output,"   DOS assigns it to
  1085.        the console by default.  This is not a "sort-in-place!"                                        ___
  1086.  
  1087.  
  1088.  
  1089.        You have  received a member list from the Society of End-users of
  1090.        XENIX (SEX.LST).   Sort  the list by special interest (10 columns
  1091.        beginning at 70) and name (30 columns beginning at 1).  Note that
  1092.        the file  contains no  carriage return characters.  Since SEX.LST
  1093.        is a  very large  file, we  wish to obtain running status reports
  1094.        and a final statistics report.
  1095.  
  1096.             QSORT  SEX.LST /70:10 /1:30 /N\L /SVQSORT  SEX.LST /70:10 /1:30 /N\L /SV
  1097.  
  1098.        The /N/N  parameter is  used to  redefine the newline sequence as a
  1099.        naked line feed character.
  1100.  
  1101.  
  1102.  
  1103.        QSORT Text Sorting Utility                                     18
  1104.  
  1105.  
  1106.        The file  LABEL.TXT contains mailing label images.  Each label is
  1107.        6 lines  (1 inch)  high.  Line six is always empty and line three
  1108.        is frequently  empty.  An extended Zip code always begins in col-
  1109.        umn 20  of line  5, and extends to the end of the line.  In order
  1110.        to take  advantage of  bulk mailing  rates, the  labels  must  be
  1111.        sorted into carrier route (CARRT) order.
  1112.  
  1113.             QSORT LABEL.TXT /5.20 /D6\NQSORT LABEL.TXT /5.20 /D6\N
  1114.  
  1115.        We must  use a "delimited field" sort rather than a "tagged line"
  1116.        sort because  line six  is  empty,  not  tagged  with  a  special
  1117.        character.  When line three is also empty a label would be broken
  1118.        into two pieces and separated by the sorting process.  Since each
  1119.        label always  contains six  lines, we  can treat it as six fields
  1120.        delimited by  the newline  sequence, but  we must inform QSORT of                         _________________
  1121.        the total number of fields.
  1122.  
  1123.  
  1124.  
  1125.        QSORT Text Sorting Utility                                     19
  1126.  
  1127.  
  1128.                         Error Messages and Return CodesError Messages and Return Codes
  1129.  
  1130.  
  1131.        The QSORT program can encounter a number of different errors dur-
  1132.        ing execution.   Each will generate a brief error message on your
  1133.        console.   This section will attempt to list the messages you may
  1134.        see, and  give you  a little more detailed information about what
  1135.        might have caused the problem.
  1136.  
  1137.  
  1138.        Command Line ErrorsCommand Line Errors
  1139.  
  1140.        The most  common causes  of error messages are errors in the com-
  1141.        mand line  parameters.  Particularly when using a complicated set
  1142.        of keys,  I recommend  the use of "/?""/?" as the last parameter.  If
  1143.        QSORT discovers an error, it will be reported.  The QSORT program
  1144.        will also  show you exactly what it would have done, had the "/?""/?"
  1145.        parameter not been there, but will not perform a sort.                                          ___
  1146.  
  1147.        You may then hit the "F3""F3" key to recall the command, edit any bad
  1148.        parameters using the left and right cursor keys and the "INS" and
  1149.        "DEL" keys.   When  the command parses without error, and the re-
  1150.        port looks  like the  kind of sort you wish to make, hit the "F3""F3"
  1151.        key once  more, then back space over the "/?""/?" parameter, then hit
  1152.        "Enter" and QSORT will do the rest.
  1153.  
  1154.        One or  more of  the following errors might be encountered in the
  1155.        command line:
  1156.  
  1157.             Three file names specifiedThree file names specified
  1158.  
  1159.        At most,  only two  file names may be given, an input file and an
  1160.        output file.  The most likely cause of this message is forgetting
  1161.        to use  the "/""/" character at the beginning of a key spec or other
  1162.        parameter.
  1163.  
  1164.             Invalid command line parameter "Invalid command line parameter "<parameter><parameter>""                                            ___________
  1165.  
  1166.        This message  is issued if QSORT receives a parameter it does not
  1167.        understand.   It is  usually a typographic error.  You meant "/D""/D"
  1168.        and hit  "/E""/E" by  mistake.    The  message  displays  the  actual
  1169.        <parameter> it did not understand.       ___________
  1170.  
  1171.             /D, /F and /T parameters are incompatible/D, /F and /T parameters are incompatible
  1172.  
  1173.        Each of the above parameters tells QSORT to use a different scan-
  1174.        ning routine  to parse  records.  Since only one such routine can
  1175.        be used, it is an error to use more than one of these parameters.
  1176.        In those  unusual situations where more than one might apply, use
  1177.        the most  efficient one.   (See  the section  on "Performance and
  1178.        Sort Keys" for more information.)
  1179.  
  1180.             Multiple /Multiple /<parameter><parameter> parameters encountered parameters encountered                      ___________
  1181.  
  1182.  
  1183.  
  1184.        QSORT Text Sorting Utility                                     20
  1185.  
  1186.  
  1187.        This message  again applies  to the /D/D, /F/F and /T/T parameters.  In
  1188.        this case, the same parameter appears twice in the command line.
  1189.  
  1190.             /F<length> parameter with invalid <length>/F<length> parameter with invalid <length>
  1191.  
  1192.        No substitution  is made for "<length>""<length>" in this message.  This is
  1193.        the actual  message displayed.  It means that either there was no
  1194.        length specified, or the specified length was zero.
  1195.  
  1196.             Keyfield "Keyfield "<key_spec><key_spec>" begins beyond end of record" begins beyond end of record                      __________
  1197.  
  1198.             Keyfield "Keyfield "<key_spec><key_spec>" extends beyond end of record" extends beyond end of record                      __________
  1199.  
  1200.        These two messages refer to fixed-length records.  A key specifi-
  1201.        cation has  told QSORT  that data exists beyond the bounds of the
  1202.        record.   For instance,  suppose that  /F20/F20 has  been  specified.
  1203.        Then /23/23  would invoke  the first  message because  the record is
  1204.        only 20  characters long.   Similarly /18:5/18:5 begins before the end
  1205.        of the  record but extends beyond it, and would invoke the second
  1206.        message.   Note that  /18/18 is  OK.   QSORT will assume a length of
  1207.        three in this case.
  1208.  
  1209.             Invalid delimited field specification - "Invalid delimited field specification - "<key_spec><key_spec>""                                                     __________
  1210.  
  1211.        This one is similar to the previous messages.  The "field number"
  1212.        portion of  a key specification was greater than the defined num-
  1213.        ber of  fields.   For example  "/D5\N /6.1:3""/D5\N /6.1:3" would provoke QSORT
  1214.        into issuing  this message.   It's  hard to  find field 6 in a 5-
  1215.        field record.  Another possibility is that you may have forgotten
  1216.        to use  a /D/D  or /T/T parameter, altogether.  Since multiple fields
  1217.        are only  valid for  these record  types,  one  must  be  present
  1218.        whenever you  use a  field number  greater than  1.  This message
  1219.        will never  appear for  tagged records,  or for  delimited  field
  1220.        records where  the field  delimiter and  the record delimiter are
  1221.        different.   In those  cases, QSORT  permits a variable number of
  1222.        fields,  and   any  field   number  is   legitimate  in   a   key
  1223.        specification.
  1224.  
  1225.             Multiple STDERR redirectionsMultiple STDERR redirections
  1226.  
  1227.        At most,  the standard  error output  may be  redirected once.  A
  1228.        second attempt to do so will fail with this message.
  1229.  
  1230.             Invalid STDERR redirectionInvalid STDERR redirection
  1231.  
  1232.        Two conditions  cause this  message; use of 2>2> or 2>>2>> as the last
  1233.        parameter, with  no file specified, or use of 2>&2>&<x> where <x> is                                                        ___       ___
  1234.        any text other than an unadorned hyphen.
  1235.  
  1236.             ABORT -- Error(s) in command line parameter(s)ABORT -- Error(s) in command line parameter(s)
  1237.  
  1238.        If any  of the  above messages are issued, QSORT will continue to
  1239.        scan the command line and evaluate the parameters, but will even-
  1240.  
  1241.  
  1242.  
  1243.        QSORT Text Sorting Utility                                     21
  1244.  
  1245.  
  1246.        tually issue this message too.  If there are command line errors,
  1247.        QSORT will not guess about your data.  It will stop!                  ___
  1248.  
  1249.  
  1250.        Memory ErrorsMemory Errors
  1251.  
  1252.             ABORT -- Buffer allocation errorABORT -- Buffer allocation error
  1253.  
  1254.        An error  of unknown origin occurred when QSORT was trying to al-
  1255.        locate memory  for its  buffers.  The most likely cause here is a
  1256.        "memory poor"  condition caused  by a too small partition under a
  1257.        multitasker such  as DoubleDOS,  or perhaps  too many "terminate-
  1258.        and-stay-resident" programs.   As an absolute minimum, QSORT must
  1259.        be able  to obtain  eight kilobytes  of contiguous memory for its
  1260.        sort buffer.
  1261.  
  1262.             ABORT -- Insufficient memoryABORT -- Insufficient memory
  1263.  
  1264.        This one  can occur at any time during the sort.  QSORT must have
  1265.        a sort buffer large enough to hold the two largest records in the
  1266.        file.  Typically, the sort buffer is about fifty kilobytes, which
  1267.        means that  if records  are shorter  than about twenty five kilo-
  1268.        bytes, QSORT can usually handle them.  This is normally a problem
  1269.        only when using the /T/T parameter.
  1270.  
  1271.  
  1272.        I/O ErrorsI/O Errors
  1273.  
  1274.             ABORT -- Unable to open "ABORT -- Unable to open "<file_spec><file_spec>" for input" for input                                     ___________
  1275.  
  1276.        QSORT  was   attempting  to  open  <file_spec>  for  input.    If                                          ___________
  1277.        <file_spec> is your input file, you probably misspelled the name.       ___________
  1278.        If <file_spec>  has the  form "number.SRT" QSORT could not find a          ___________
  1279.        merge file  it thought  it had  created.  If this happens you may
  1280.        have discovered a bug.  Please send me full particulars ASAP!
  1281.  
  1282.             ABORT -- Unable to open "ABORT -- Unable to open "<file_spec><file_spec>" for output" for output                                     ___________
  1283.  
  1284.        QSORT was attempting to open <file_spec> for output, and the open                                    ___________
  1285.        operation failed.   The  most likely cause is that you ran out of
  1286.        disk space,  and DOS was unable to expand a subdirectory.  A root
  1287.        directory cannot  be expanded, and you may have run out of direc-
  1288.        tory space.  DOS will also complain if you attempt to open a file
  1289.        with the same full name as an existing subdirectory.
  1290.  
  1291.             ABORT -- Error reading input or merge fileABORT -- Error reading input or merge file
  1292.  
  1293.        The section  of the  program which  issues this  message does not
  1294.        know the  file name, so cannot help you much there.  This message
  1295.        may mean  that your disk has a sector going bad.  (Well, it can't
  1296.        all be good news!)
  1297.  
  1298.             ABORT -- Error writing to merge or output fileABORT -- Error writing to merge or output file
  1299.  
  1300.  
  1301.  
  1302.        QSORT Text Sorting Utility                                     22
  1303.  
  1304.  
  1305.        +----------------------------------------------------------------+
  1306.         Code    Meaning       |      |                                                         |
  1307.        |------+---------------------------------------------------------|
  1308.            0    Successful completion       |      |                                                         |
  1309.            1    Command line error and/or "/?""/?" parameter specified       |      |                                                         |
  1310.            2    Open-for-read error       |      |                                                         |
  1311.            3    Open-for-write error       |      |                                                         |
  1312.            4    I/O error reading file       |      |                                                         |
  1313.            5    I/O error writing file       |      |                                                         |
  1314.            6    Memory error       |      |                                                         |
  1315.          255    Internal error       |      |                                                         |
  1316.        +----------------------------------------------------------------+
  1317.  
  1318.                        Table 3 - ERRORLEVEL return codes
  1319.  
  1320.  
  1321.        This one  could also  mean a  bad sector,  but a  far more likely
  1322.        cause is that you just ran out of disk space.
  1323.  
  1324.  
  1325.        Internal ErrorsInternal Errors
  1326.  
  1327.             ABORT -- Internal QSORT errorABORT -- Internal QSORT error
  1328.  
  1329.        In theory,  this is  an error  which "can't happen."  If you EVER                                            _______________
  1330.        get this  message, please  notify me  with as many details as you
  1331.        can supply.   Actually I have NEVER seen this message issued by a
  1332.        released version of QSORT.
  1333.  
  1334.  
  1335.        ERRORLEVEL Return CodesERRORLEVEL Return Codes
  1336.  
  1337.        When QSORT  successfully completes a sort, it terminates with DOS
  1338.        ERRORLEVEL set to zero. (See your DOS manual for more information
  1339.        on ERRORLEVEL.)   If  it terminates for ANY other reason, it sets
  1340.        ERRORLEVEL to  a non-zero  value, which  can be tested in a batch
  1341.        file.   Table 3  lists the ERRORLEVEL codes QSORT uses, and their
  1342.        meanings.
  1343.  
  1344.  
  1345.  
  1346.        QSORT Text Sorting Utility                                     23
  1347.  
  1348.  
  1349.                              Implementation NotesImplementation Notes
  1350.  
  1351.  
  1352.  
  1353.        General InformationGeneral Information
  1354.  
  1355.        QSORT is intended as an enhanced replacement for DOS SORT.  It is
  1356.        nearly fully  upward compatible,  but provides  much more  flexi-
  1357.        bility.   Multiple sort  keys may be specified, a pseudo in-place
  1358.        sort may be performed and files and/or records of any size may be
  1359.        sorted provided only that there is sufficient disk space for work
  1360.        files and  the output  file.   QSORT uses  the "quick sort" algo-
  1361.        rithm, which cannot guarantee the order of records whose keys are
  1362.        all equal.   This  is the  one "incompatibility"  with DOS  SORT,
  1363.        which retains  the original  order of  records when  its only key
  1364.        compares equal.  This is important to SORT because it must be in-
  1365.        voked multiple  times to effect a multiple key sort.  With QSORT,
  1366.        you only sort once and there are usually enough keys available to
  1367.        insure you get the order you want the first time.
  1368.  
  1369.        QSORT uses as much memory as it can get as a sort buffer and will
  1370.        fill the  buffer as full as possible, and then sort its contents.
  1371.        If the  end of  the input  file has been reached and no temporary
  1372.        work files have been generated, the sorted contents of the buffer
  1373.        are written to the output file, completing the sort operation.
  1374.  
  1375.        If the  input file  is too  large to fit into the sort buffer, as
  1376.        much of  the input  file as  possible is  read into  the  buffer,
  1377.        sorted, then  written to  a temporary work file.  This process is
  1378.        repeated as  many times  as necessary to process the entire input
  1379.        file, each time creating a new work file for the sorted output.
  1380.  
  1381.        Upon completion  of the  "sort  phase,"  QSORT  begins  a  "merge
  1382.        phase."   Each work  file is  a sorted sub-set of the input file.
  1383.        Thus, work files may be read sequentially and combined to produce
  1384.        a sorted  output.  QSORT will open as many work files as DOS per-
  1385.        mits (more  on this  later).  If all the remaining work files can
  1386.        be opened,  the sorted  result is  written to  the  output  file.
  1387.        Otherwise, a new work file is created and another merge pass will
  1388.        be required.  On each merge pass, the number of work files is re-
  1389.        duced and  eventually all remaining work files will be opened and
  1390.        the sorted  output file will be written completing the sort oper-
  1391.        ation.
  1392.  
  1393.  
  1394.        Performance and DOS ConfigurationPerformance and DOS Configuration
  1395.  
  1396.        When QSORT  must create temporary merge files, it first creates a
  1397.        temporary subdirectory  to hold  them.  The subdirectory is named
  1398.        SRTnnnnn, where  nnnnn is  a random number generated from the DOS
  1399.        clock.   When QSORT  completes, even if it aborts for any reason,
  1400.        it deletes  any temporary files and the temporary subdirectory it
  1401.        has created.
  1402.  
  1403.  
  1404.  
  1405.        QSORT Text Sorting Utility                                     24
  1406.  
  1407.  
  1408.        With nothing  else  to  guide  it,  QSORT  places  its  temporary
  1409.        subdirectory in the default directory.  Any of three "environment
  1410.        variables"  can   override  this.    (See  your  DOS  manual  for
  1411.        information on  environment variables  and the  SET command.) The
  1412.        DOS command:
  1413.  
  1414.             SET QSTMP=SET QSTMP=<path><path>        or        or                      ______
  1415.  
  1416.             SET TMP=SET TMP=<path><path>          or          or                    ______
  1417.  
  1418.             SET TEMP=SET TEMP=<path><path>                     ______
  1419.  
  1420.        will define  a path  for QSORT to use for its temporaries.  QSORT
  1421.        first looks  for the  environment variable QSTMP.  If it does not
  1422.        exist, QSORT  next looks  for TMP or TEMP in that order.  TMP and
  1423.        TEMP are  de facto  standards used by many programs, and are usu-
  1424.        ally defined in your AUTOEXEC.BAT batch file.  You might have TMP
  1425.        specifying a  64K RAM  disk to  speed up  your compiler.  In this
  1426.        case, an  attempt to  sort a  600K file  is  doomed  to  failure.
  1427.        Rather than  redefine TMP, you may define QSTMP to force QSORT to
  1428.        use some directory on your hard disk.  In fact:
  1429.  
  1430.             SET QSTMP=\SET QSTMP=\
  1431.  
  1432.        tells QSORT  to always  use the  root directory  of  the  default
  1433.        drive!
  1434.  
  1435.        QSORT, to work properly, needs enough space on the output disk to
  1436.        hold the  output file.   Even  if the input file is to be deleted
  1437.        and resides  in the  same directory, that is not done until after
  1438.        the output file has been successfully written.  If one merge pass
  1439.        is required,  the disk space QSORT uses for temporary merge files
  1440.        will be  somewhat larger  than the size of the input file because
  1441.        DOS allocates  file space  in clusters  of 2  or 4 kilobytes.  If
  1442.        more than  one merge pass will be required, allow about twice the
  1443.        size of the input file as temporary merge file space.
  1444.  
  1445.        One of  the advantages of controlling where QSORT places its tem-
  1446.        porary files  is to  insure adequate space for them.  A second is
  1447.        speed.   If the  temporary files can be placed on a separate disk
  1448.        from the  input and  output files,  disk seeking  is reduced  and
  1449.        performance improved.
  1450.  
  1451.        Each time  QSORT must create a new temporary merge file, the data
  1452.        put into  it will  be processed again.  Obviously, the more files
  1453.        QSORT can  open during  the merge  phase, the fewer times it will
  1454.        have to  handle each  record and  the faster  it can  sort  large
  1455.        files.   If DOS is properly pre-conditioned, QSORT can have up to
  1456.        15 temporary  merge files  open at once, and very large files can
  1457.        be sorted  with just  one sort pass and one merge pass.  Unfortu-
  1458.        nately, that capability is not automatic.
  1459.  
  1460.        DOS has  a fixed number of file "handles" that it associates with
  1461.        open files.   The  default number is eight, but DOS opens five of
  1462.  
  1463.  
  1464.  
  1465.        QSORT Text Sorting Utility                                     25
  1466.  
  1467.  
  1468.        them for  standard input,  standard output, standard error, stan-
  1469.        dard printer  and standard  auxiliary device.   That leaves three
  1470.        for merging.   Assuming  a 400K  sort buffer,  a 2 megabyte input
  1471.        file would produce five temporary merge files and that would take
  1472.        three merge  passes; merge  two into one, leaving four; merge two
  1473.        into one  leaving three;  and finally merge three into the output
  1474.        file.  In the process, QSORT must read and write about 80% of the
  1475.        file twice during the merge phase.
  1476.  
  1477.        Worse yet,  since you need at least three handles for merging, if
  1478.        you have  resident programs that have open files, you can't merge
  1479.        at all!
  1480.  
  1481.        DOS can  be told  to set aside more space for file handles.  Each
  1482.        handle is  only 39  bytes and  it's memory  very well spent.  One
  1483.        process can  have a  maximum of  20 handles open at one time, but
  1484.        since resident  processes may be using handles, I suggest 25.  To
  1485.        do this,  the root  directory of  the disk or disks you boot from                                             ___________________________
  1486.        must contain  a file  named CONFIG.SYS.   If  your  boot  disk(s)
  1487.        already contains  a CONFIG.SYS,  edit it, or if not, create it to
  1488.        contain the following line:
  1489.  
  1490.             FILES=25FILES=25
  1491.  
  1492.        While we're  at it,  let's add one more thing to CONFIG.SYS which
  1493.        will improve  the performance of QSORT and many other programs as
  1494.        well.  DOS provides, by default, two disk buffers.  These are the
  1495.        buffers it  uses to  do its  disk reads  and writes.   During the
  1496.        merge phase  QSORT may have many files open at once, reading from
  1497.        them in more or less random order.  DOS may have to read the same
  1498.        physical sector  several times  to get all its data.  But DOS can
  1499.        remember what's  in each  buffer and where it came from, and will
  1500.        not re-read  a sector  it already has in a buffer.  DOS needs 528
  1501.        bytes for each buffer.  I recommend 20 buffers to make QSORT per-
  1502.        form well  under the  most adverse conditions.  This will require
  1503.        an additional  9504 bytes  or slightly more than 9K, again memory
  1504.        well spent, so we add to CONFIG.SYS the following line:
  1505.  
  1506.             BUFFERS=20BUFFERS=20
  1507.  
  1508.        See your DOS manual for more information on CONFIG.SYS.
  1509.  
  1510.  
  1511.        Performance and Sort KeysPerformance and Sort Keys
  1512.  
  1513.        The sort  keys defined  on the command line have a lot to do with
  1514.        QSORT's performance.   There  isn't much  you can  do by way of a
  1515.        strategy, when  you need a particular file sorted in a particular
  1516.        way, but you should at least be aware.
  1517.  
  1518.        If no  sort key  parameters and  no record  type  parameters  are
  1519.        given, the  entire simple  ASCII record  is used  as a  key.  The
  1520.        compare routine  has no  decisions it  must  make  --  it  simply
  1521.  
  1522.  
  1523.  
  1524.        QSORT Text Sorting Utility                                     26
  1525.  
  1526.  
  1527.        compares the  two strings  handed it.  This is the "simple sort,"
  1528.        and is the fastest possible case.
  1529.  
  1530.        A sort  key that  does not  begin at  the beginning of a variable
  1531.        length record,  may not  be contained  in a  particular record at
  1532.        all, while  a fixed  length record  is known to contain all keys.
  1533.        Other things equal, files of fixed length records will sort some-
  1534.        what faster because the compare routine does not have to test for
  1535.        "key containment."
  1536.  
  1537.        Lexicographic keys  are first  compared with a "case insensitive"
  1538.        technique.   Each character is tested to see if it is alphabetic.
  1539.        If it  is, it  is converted  to lower  case.   Then the converted
  1540.        character from each record is compared.  This is obviously slower
  1541.        than  directly   comparing  two   characters.     In  the   event
  1542.        lexicographic keys compare equal, they are compared a second time
  1543.        using a  direct compare technique!  Files with lexicographic keys
  1544.        sort slower than similar files without them.
  1545.  
  1546.        In the  case of  files with  delimited field records, the compare
  1547.        routine must  find the  correct field  for each key, determine if
  1548.        the keys  are contained  within the  fields, and  finally compare
  1549.        them.   The added  step of searching for fields slows record com-
  1550.        parison.
  1551.  
  1552.        In general, the more complex the data, the more complex the sort-
  1553.        ing task and the longer it will take.  QSORT attempts to optimize
  1554.        its performance  by making as many decisions as it can about your
  1555.        data up  front, then  making only  the necessary  decisions on  a
  1556.        record-by-record basis.
  1557.  
  1558.  
  1559.        Performance and Memory SizePerformance and Memory Size
  1560.  
  1561.        If you have as little as 50 kilobytes of usable memory, the QSORT
  1562.        program will  perform correctly,  but memory  space this  limited
  1563.        will only  allow a sort buffer of about eight kilobytes.  Sorting
  1564.        files any  larger than this will cause QSORT to create many small
  1565.        temporary merge files, and performance will suffer.
  1566.  
  1567.        QSORT is  capable of  using as much memory as DOS has to give it.
  1568.        So long  as the  file being  sorted is  smaller than QSORT's sort
  1569.        buffer, no  merging will  be required  and optimum performance is
  1570.        achieved.  The more memory you can give QSORT, the better it will                  ______________________________________________________
  1571.        perform!       ________
  1572.  
  1573.        There are, of course, limits.
  1574.  
  1575.  
  1576.        Performance and File SizePerformance and File Size
  1577.  
  1578.        If you have 640 kilobytes of installed memory, and if you are not
  1579.        running a  multi-tasking system  such  as  Windows,  Desqview  or
  1580.        DoubleDOS, and  if you  do not  have a ton of terminate-and-stay-                                                     ___________________
  1581.  
  1582.  
  1583.  
  1584.        QSORT Text Sorting Utility                                     27
  1585.  
  1586.  
  1587.        resident programs  installed in  your system,  the QSORT  program       ________
  1588.        should have  between 400  and 500 kilobytes of memory to use as a
  1589.        sort buffer.   Files  smaller than  this will not require merging
  1590.        and  will   sort  quite  fast,  the  sorting  time  being  nearly
  1591.        proportional to file size times the logarithm of file size.
  1592.  
  1593.        A file  larger than  the available  sort buffer size will require
  1594.        more than  one sort  pass, and  hence, at  least one  merge pass.
  1595.        Merging is  approximately a  linear process,  so sort  time  will
  1596.        increase proportional to file size.
  1597.  
  1598.        For a  file larger than the number of available handles times the
  1599.        size of  the sort  buffer (typically a very large file), a second
  1600.        merge pass  will be needed, but in this size range, only seven to
  1601.        ten percent  of the  data will  be processed  in the  first merge
  1602.        pass, so  the sort  time vs size curve will steepen slightly, but
  1603.        will not  experience a large step.  Doubling the file size should
  1604.        increase the sort time about three times.
  1605.  
  1606.        Sorting time  will be  approximately proportional  to  file  size
  1607.        times the  "average passes  over data" number from the statistics
  1608.        report.   Since this  number remains a constant "2.0" over a wide
  1609.        range of  file sizes,  sorting time  will be a linear function of
  1610.        file size in that range.
  1611.  
  1612.  
  1613.  
  1614.        QSORT Text Sorting Utility                                     28
  1615.  
  1616.  
  1617.                                LIMITED WARRANTYLIMITED WARRANTY
  1618.  
  1619.  
  1620.        IMPORTANT NOTICE:IMPORTANT NOTICE: Any use of this software for any period of time
  1621.        for  any   purpose  whatsoever   constitutes   your   unqualified
  1622.        acceptance of  this LICENSE  and subjects you to all of the terms
  1623.        and conditions set forth below:
  1624.  
  1625.        Baker & Associates ("B&A") warrants to any Licensee that acquires
  1626.        the program  from B&A  or an  authorized B&A  representative ONLY
  1627.        that:
  1628.  
  1629.        1)   All  diskettes  B&A  provides  constitute  an  accurate
  1630.             duplication of  the software  and B&A  will replace any
  1631.             diskette found to be defective within 30 days from date
  1632.             of acquisition.   B&A  will not  honor this warranty if
  1633.             the diskette  has been  subjected to physical abuse, or
  1634.             used in defective or non-compatible equipment.
  1635.  
  1636.        2)   Software distributed  by B&A will perform substantially
  1637.             as  described   in  the   documentation  B&A  regularly
  1638.             supplies with  that software, if operated as prescribed
  1639.             in  such   documentation  including  the  hardware  and
  1640.             software environment specified.
  1641.  
  1642.        3)   If a  significant  defect  in  any  program  is  found,
  1643.             Licensee's only  remedy shall  be to  receive refund of
  1644.             the  actual   fee  Licensee  paid  for  such  defective
  1645.             program.  In no event will such a refund exceed the fee
  1646.             B&A charges for such program.
  1647.  
  1648.        4)   B&A  makes  no  warranty  or  representation  that  the
  1649.             software will  be  error  free  nor  that  its  use  by
  1650.             Licensee will be uninterrupted.
  1651.  
  1652.        Except as  provided above,  B&A disclaims  all other  warranties,
  1653.        either express  or implied,  including but  not  limited  to  any
  1654.        implied warranty of merchantability or fitness for any particular
  1655.        purpose.
  1656.  
  1657.        Licensee agrees  to take full responsibility for the selection of
  1658.        and any use whatsoever made of the software.
  1659.  
  1660.        IN NO  EVENT WILL  B&A  BE  LIABLE  FOR  ANY  DAMAGES  WHATSOEVERIN NO  EVENT WILL  B&A  BE  LIABLE  FOR  ANY  DAMAGES  WHATSOEVER
  1661.        (INCLUDING  WITHOUT  LIMITATION  DAMAGES  FOR  LOSS  OF  BUSINESS(INCLUDING  WITHOUT  LIMITATION  DAMAGES  FOR  LOSS  OF  BUSINESS
  1662.        PROFITS, BUSINESS  INTERRUPTION, LOSS  OF BUSINESS INFORMATION ORPROFITS, BUSINESS  INTERRUPTION, LOSS  OF BUSINESS INFORMATION OR
  1663.        THE LIKE)  ARISING OUT OF THE USE OF, INTERRUPTION IN THE USE OF,THE LIKE)  ARISING OUT OF THE USE OF, INTERRUPTION IN THE USE OF,
  1664.        OR INABILITY  TO USE  THIS SOFTWARE, EVEN IF B&A HAS BEEN ADVISEDOR INABILITY  TO USE  THIS SOFTWARE, EVEN IF B&A HAS BEEN ADVISED
  1665.        OF ANY POSSIBILITY OR LIKELIHOOD OF SUCH DAMAGES.OF ANY POSSIBILITY OR LIKELIHOOD OF SUCH DAMAGES.