home *** CD-ROM | disk | FTP | other *** search
/ Hall of Fame / HallofFameCDROM.cdr / dos / qsort313.lzh / QSORT.PRN < prev   
Encoding:
Text File  |  1988-01-23  |  51.3 KB  |  1,318 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 3.12
  29.                                        
  30.                            Text File Sorting Utility
  31.                                        
  32.                                        
  33.                                        
  34.                                        
  35.                                        
  36.                                        
  37.                                        
  38.                                        
  39.                                        
  40.                                        
  41.  
  42.  
  43.                     Copyright 1985, 86, 87, 88 - Ben Baker
  44.                                        
  45.                               All rights reserved
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.                                Table of Contents
  74.  
  75.  
  76.  
  77.        
  78.  
  79.        Introduction                                                    1
  80.           Notation                                                     1
  81.  
  82.        The QSORT Command and Options                                   2
  83.           The /<key_spec> Parameter                                    3
  84.           The /F<len> Parameter                                        4
  85.           The /T[<tag>] Parameter                                      4
  86.           The /D[<fields>][<delim>[<term>]] Parameter                  5
  87.           The /R Parameter                                             6
  88.           The /S Parameter                                             6
  89.           The /? Parameter                                             7
  90.  
  91.        Lexical Sorting                                                 8
  92.  
  93.        Examples                                                       10
  94.  
  95.        Implementation Notes                                           12
  96.           General Information                                         12
  97.           Performance and DOS Configuration                           13
  98.           Performance and Input Record Type                           15
  99.           Performance and Sort Keys                                   16
  100.           Performance and File Size                                   17
  101.  
  102.        About Shareware                                                18
  103.  
  104.        
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.                                         i
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.                                        
  140.  
  141.  
  142.  
  143.  
  144.                                  Introduction                                 Introduction
  145.  
  146.  
  147.        QSORT was first designed to be a replacement for, and to overcome
  148.        the limitations  of DOS  SORT, but  has been enhanced a number of
  149.        times and moved to new compilers twice.  The current version will
  150.        sort files  whose size  is limited  only by available disk space.
  151.        File name(s)  may be  given explicitly  or QSORT  will sort  from
  152.        standard input  to standard  output, and so, may be used in pipes
  153.        or with  redirection.   Multiple keys  may be  specified.  Binary
  154.        files with fixed-length records may be sorted, provided only that
  155.        keys are ASCII character strings.
  156.  
  157.        QSORT tries  to be very protective of your data.  If QSORT has an
  158.        error of  any kind,  it will  terminate with the input file still
  159.        intact, and  will return  to DOS with ERRORLEVEL = 1.  When QSORT
  160.        successfully completes  a sort, it terminates with ERRORLEVEL set
  161.        to 0.
  162.  
  163.        The command line syntax is a super-set of SORT's, so QSORT may be
  164.        used without other changes in batch files using SORT, but in most
  165.        cases you will probably want to make use of QSORT's greater capa-
  166.        bilities.
  167.  
  168.        Notation       Notation
  169.  
  170.        In defining  the command  line and  its various  parameters,  the
  171.        following notation is used:
  172.  
  173.        [optional] items are enclosed in square brackets.       [optional]                                       
  174.  
  175.        <variable> items  appear in  lower case  and are enclosed in       <variable>                                                  
  176.             angle brackets.   They are replaced by actual data such
  177.             as a file name.  The angle brackets are NOT typed.
  178.  
  179.        THIS |  THAT   Choices are  separated  by  a  vertical  bar.       THIS |  THAT                                                
  180.             Select one or the other but not both.
  181.  
  182.        [THIS |  THAT]   When the  choices are  enclosed  in  square       [THIS |  THAT]                                              
  183.             brackets, you may also select neither.
  184.  
  185.        REPEAT. . .  The ellipsis (. . .) means the item to its left       REPEAT. . .                                                 
  186.             may be repeated as many times as necessary.
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.        QSORT Text Sorting Utility                                 Page 2       QSORT Text Sorting Utility                                 Page 2
  200.  
  201.  
  202.        UPPER CASE  items and  all special  characters  not  defined       UPPER CASE                                                  
  203.             above represent  themselves.   They are entered exactly
  204.             as they appear.
  205.  
  206.  
  207.  
  208.                          The QSORT Command and Options                         The QSORT Command and Options
  209.  
  210.  
  211.        QSORT is invoked with the following command:
  212.  
  213.             QSORT [<in_file> [<out_file>]] [/<key_spec>. . .]            QSORT [<in_file> [<out_file>]] [/<key_spec>. . .]
  214.                  [/F<len> | /T[<tag> | /D[[<fields>][<delim>[<term>]]]                 [/F<len> | /T[<tag> | /D[[<fields>][<delim>[<term>]]]
  215.                  [/R] [/S] [/?]                 [/R] [/S] [/?]
  216.  
  217.        Note that  all parameters  on the command line are optional.  The
  218.        <in_file> and  <out_file> parameters  are "ASCII-Z"  file  speci-
  219.        fiers.   They may  contain disk and path information in the stan-
  220.        dard DOS format, but must not contain "wild-card" characters.  If
  221.        <in_file> is missing, QSORT sorts from standard input to standard
  222.        output.   These are  files defined and opened by DOS before QSORT
  223.        is loaded.   (See  your DOS manual concerning the use of redirec-
  224.        tion and pipes.)
  225.  
  226.        If <in_file>  is given but <out_file> is missing, QSORT creates a
  227.        temporary file in the directory containing <in_file> and sorts to
  228.        the temporary  file.   On  successful  completion  of  the  sort,
  229.        <in_file> is  deleted and  the temporary is renamed to <in_file>.
  230.        The effect is an apparent "sort-in-place."
  231.  
  232.        If both  file names  are given,  <in_file> is  unchanged and  the
  233.        sorted output  is written to <out_file>.  Note that the following
  234.        two commands are exactly equivalent:
  235.  
  236.             QSORT  FILE.TXT  FILE.SRT            QSORT  FILE.TXT  FILE.SRT
  237.  
  238.             QSORT <FILE.TXT >FILE.SRT            QSORT <FILE.TXT >FILE.SRT
  239.  
  240.        In the  first, QSORT opens the files.  In the second, redirection
  241.        is specified  and DOS  opens the  files.  The result is the same.
  242.        It is  an error  QSORT can't  detect if  you mix  these.  For in-
  243.        stance:
  244.  
  245.             QSORT  FILE.TXT >FILE.SRT            QSORT  FILE.TXT >FILE.SRT
  246.  
  247.        will result  in a  sort-in-place.   QSORT will  open FILE.TXT but
  248.        won't know DOS has opened FILE.SRT for it, and will ignore it.
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.        QSORT Text Sorting Utility                                 Page 3       QSORT Text Sorting Utility                                 Page 3
  266.  
  267.  
  268.        The /<key_spec> Parameter       The /<key_spec> Parameter
  269.  
  270.        Up to  30 /<key_spec> parameters may be used to specify sort keys
  271.        and are  ordered  major  to  minor  from  left  to  right.    The
  272.        /<key_spec> argument has the form:
  273.  
  274.             /[L][+|-][<field>.][<col>][:<length>]            /[L][+|-][<field>.][<col>][:<length>]
  275.  
  276.        Note that  all elements  of this  argument are "optional," but at
  277.        least one element must be present following the slant-bar (/).
  278.  
  279.        The 'L',  if present,  specifies "lexical" sequence for this key.
  280.        Lexical sequence  is ordered  first by  spelling, then, when keys
  281.        have identical spelling, by capitalization.
  282.  
  283.        The minus (-) sign reverses the sorting order for this key, while
  284.        the plus (+) sign (or no sign) specifies normal sort order.
  285.  
  286.        There are three numbers associated with every sort key; the field
  287.        number, the  starting column  within the field, and the length of
  288.        the key  in characters.   Any,  or all  of them may be given in a
  289.        /<key_spec> parameter.   QSORT  uses punctuation to identify each
  290.        number.   A number followed by a period (.) is a field number.  A
  291.        number preceded by a colon (:) is a length number.  A column num-
  292.        ber has  no punctuation associated with it.  It follows the field
  293.        number, if any, and precedes the length number, if any.
  294.  
  295.        The  [<field.>]   element  is  used  only  for  "delimited-field"
  296.        records, and  locates this  key within  a particular  field.  The
  297.        value of  <field.> must  be less  than or  equal to the number of
  298.        fields defined  with the /D parameter (see below).  If [<field>.]
  299.        is omitted  when sorting delimited-field records, the first field
  300.        is assumed.   For  consistency, all  records are  assumed to have
  301.        "fields."   In all cases except delimited-field records, there is
  302.        precisely one field, and it spans the entire record.
  303.  
  304.        If present,  [<col>] defines the beginning column of the key.  If
  305.        omitted, column  1 is  assumed.   In the  case of delimited-field
  306.        records, column 1 is the first character of the identified field.
  307.        In all  other cases,  column 1  is the  first  character  of  the
  308.        record.
  309.  
  310.        If present,  [:<length>] defines  the key  length in  columns (or
  311.        characters).   If [:<length>] is omitted, the rest of the record,
  312.        or field in delimited-field records, is assumed to be part of the
  313.        key.
  314.  
  315.        If no  key parameters are given, the entire record, or the entire
  316.        first field is the key.
  317.  
  318.        When sorting variable-length records, any key which begins beyond
  319.        the end  of its field in a particular record is treated as a null
  320.        (zero length)  key for that record, and will sort low relative to
  321.        all records  with non-null  values for  that key.   When  sorting
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.        QSORT Text Sorting Utility                                 Page 4       QSORT Text Sorting Utility                                 Page 4
  332.  
  333.  
  334.        fixed-length records,  all defined  keys must fall within the de-
  335.        fined record  length.  <key_spec> parameters must appear in order
  336.        of importance, primary key first.
  337.  
  338.        The /F<len> Parameter       The /F<len> Parameter
  339.  
  340.        The /F<len>  parameter denotes  the record  length for  a file of
  341.        fixed-length records.   All records in the input file MUST be ex-
  342.        actly <len> bytes long.  The records need not (but may) be termi-
  343.        nated with a CR/LF sequence.  They may contain any data, even bi-
  344.        nary data,  but the  keys must  be ASCII strings.  Strings may be
  345.        terminated with  a null (binary zero) character, or may be padded
  346.        with trailing spaces to the full length of the key.
  347.  
  348.        Note that QSORT does not attempt to support Pascal style strings.
  349.        These are strings which begin with a character whose binary value
  350.        is a  character count.  This is followed by <count> characters of
  351.        ASCII data,  which in  turn is followed by random data out to the
  352.        maximum length of the string.  These strings may be used as keys,
  353.        but the  programmer must insure that either the last real charac-
  354.        ter is  a null character, or the key is padded to its full length
  355.        with spaces.   QSORT must be told that the key begins in the sec-
  356.        ond character position (the first character of real data).
  357.  
  358.        The /T[<tag>] Parameter       The /T[<tag>] Parameter
  359.  
  360.        The /T[<tag>] parameter, if present, indicates that the "records"
  361.        to be sorted may be more than a single line long.
  362.  
  363.        If <tag>  is also  present, it  defines a character to be used to
  364.        tag the  "end-of-record."   If <tag>  is not  present, the  first
  365.        empty line  terminates the  record.   For this  purpose,  "empty"
  366.        means "no  characters." A  line containing  but a single space is
  367.        NOT empty!  A line may be "tagged" by placing the <tag> character
  368.        anywhere on  the last line of a logical record.  The entire line,
  369.        including the  tag character  will appear as the last line of the
  370.        record.
  371.  
  372.        Some characters  cannot be  used to represent themselves in a DOS
  373.        command line.   For  that reason,  QSORT uses  codes to represent
  374.        them.   These codes are actually a pair of characters.  The first
  375.        is always  a back-slash (\).  The second character identifies the
  376.        special character  it represents.   The  following is  a table of
  377.        characters recognized by QSORT:
  378.  
  379.                \B - Space character     20 Hex     32 Decimal
  380.                \F - Form feed character 0C         12
  381.                \L - Line feed character 0A         10
  382.                \N - Newline sequence
  383.                \R - Carriage return     0D         13
  384.                \T - Tab character       09          9
  385.                \\ - Back-slash character itself
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.        QSORT Text Sorting Utility                                 Page 5       QSORT Text Sorting Utility                                 Page 5
  398.  
  399.  
  400.        Thus an invisible tab character might be used to end a multi-line
  401.        logical record.   The  other characters  in this  code list don't
  402.        make much  sense in  this context,  but will  be useful in the /D
  403.        parameter (see below).
  404.  
  405.        Note that  the /F<len> and /T[<tag>] parameters are incompatible,
  406.        and may not both be specified.
  407.  
  408.        The /D[<fields>][<delim>[<term>]] Parameter       The /D[<fields>][<delim>[<term>]] Parameter
  409.  
  410.        The /D[<fields>][<delim>[<term>]]  parameter, if  present, states
  411.        that this file contains delimited-field records.  In other words,
  412.        a record is made up of distinct, variable length fields separated
  413.        from one  another by  a  particular  character,  or  "delimiter."
  414.        Records are separated, or "delimited" by the "newline sequence."
  415.  
  416.        The <fields> element defines the number of variable length fields
  417.        contained in each record.  All fields must be present in each and
  418.        every record.   A "null" field will be represented by two succes-
  419.        sive delimiter characters.  There must always be exactly <fields>
  420.        minus 1 delimiter characters in a record.
  421.  
  422.        If a  <delim> character  is present, QSORT uses it as a field de-
  423.        limiter character.   Otherwise  a comma  (,) is assumed to be the
  424.        delimiter.
  425.  
  426.        If a  <term> character is also present, QSORT uses it as a record
  427.        delimiter  character.    In  fact,  it  literally  redefines  the
  428.        "newline sequence" to QSORT.  More on this in a moment.
  429.  
  430.        The same  character codes  listed under  the /T  parameter may be
  431.        used to  represent these  characters.   Note that  "\N" means the
  432.        "newline sequence."   If <term> is not present, this is the CR-LF
  433.        character pair.   If  <term> is present, it represents the <term>
  434.        character.  Thus:
  435.  
  436.             /D3\N\T            /D3\N\T
  437.  
  438.        says that  the records  are separated by tab characters, and that
  439.        the three  fields within  each record  are also  separated by tab
  440.        characters.  On the other hand:
  441.  
  442.             /D3\N            /D3\N
  443.  
  444.        says that  each group  of three  lines  constitutes  one  logical
  445.        record, and each line is a field within that record.
  446.  
  447.        The /D  parameter is  always incompatible  with the /F parameter,
  448.        and usually  incompatible with  the /T parameter, but there is an
  449.        exception when <fields> is missing, or is equal to 1.
  450.  
  451.        If <fields>  equals 1  (or is missing) it says that there is only
  452.        one field spanning the entire record.  But that is what QSORT as-
  453.        sumes if the whole /D parameter is missing!  So why bother?
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.        QSORT Text Sorting Utility                                 Page 6       QSORT Text Sorting Utility                                 Page 6
  464.  
  465.  
  466.        In most  ASCII files a "line" ends with a carriage return charac-
  467.        ter (CR)  followed by a line feed character (LF).  QSORT searches
  468.        for this  character pair  when it  is looking  for a "newline se-
  469.        quence."
  470.  
  471.        But not  all files use CR-LF as a line terminator.  For instance,
  472.        files imported  from UNIX or XENIX usually terminate lines with a
  473.        naked line  feed character!  And some editors produce files whose
  474.        lines end in a naked carriage return character!  So:
  475.  
  476.             /D,\L            /D,\L
  477.  
  478.        says "for  this file,  the newline sequence is a single line feed
  479.        character."   In this  case, the  comma is a place holder.  There
  480.        really is  no "delimiter  character," but  one must be present in
  481.        the parameter in order to define the <term> character.
  482.  
  483.        The /R Parameter       The /R Parameter
  484.  
  485.        The /R  parameter is included for compatibility with DOS SORT and
  486.        is redundant.   It  reverses the  sense of sort direction for all
  487.        sort keys.
  488.  
  489.        The /S Parameter       The /S Parameter
  490.  
  491.        The /S  parameter tells  QSORT to make a statistics report to the
  492.        screen at  the end  of a  run.   The report  is  written  to  the
  493.        "standard error"  device, the console, and may not be redirected.
  494.        The following  is an  actual statistics  report  "cut"  from  the
  495.        screen after QSORT had sorted a 1.3+ megabyte file:
  496.  
  497.        -----------------------------------------------------------------
  498.        QSORT - Text Sort - Version 3.10
  499.        Copyright (c) 1985, 1986, 1987  - Ben Baker - All rights reserved
  500.        
  501.             12115 records sorted
  502.               150 bytes in longest record
  503.        
  504.            127131 sort phase comparisons
  505.             73232 merge phase comparisons
  506.        
  507.            200363 total comparisons
  508.              16.5 comparisons per input record
  509.        
  510.                27 temporary merge files created
  511.                 2 merge passes
  512.               2.4 average passes over data
  513.        
  514.              2:51 elapsed time
  515.        -----------------------------------------------------------------
  516.  
  517.        The first two numbers are self-explanatory.  The next two are the
  518.        number of  times two  records were compared during the sort phase
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.        QSORT Text Sorting Utility                                 Page 7       QSORT Text Sorting Utility                                 Page 7
  530.  
  531.  
  532.        and the  merge phase  respectively, followed by the total compar-
  533.        isons.
  534.  
  535.        The next  number is  total comparisons  divided by  the number of
  536.        records in the input file.  If there is no merge phase, this num-
  537.        ber is  typically 10  to 12.   If the file is large enough to re-
  538.        quire merging,  it is 12 to 20, on average.  If it is much larger
  539.        than 20,  it usually  means that there is something unusual about
  540.        your input file.  It may already be sorted, or there may be large
  541.        blocks of  records which  compare equal.   This can happen if you
  542.        sort on, say column 50 and the input file contains a large number
  543.        of records  shorter than 50 bytes. In this case, a minor sort key
  544.        at column 1 may significantly speed sorting.
  545.  
  546.        The next  two items  are self-explanatory.   "Average passes over
  547.        data" reflects the number of times each record was read and writ-
  548.        ten.   For short  files not  requiring a  merge pass, this number
  549.        will be  1.0.  When merging is needed, the last merge pass is the
  550.        one which writes the output file and it must read and write every
  551.        record exactly  once.   Thus when  only one  merge pass  is made,
  552.        there will  be exactly  2.0 "average  passes over  data." In  the
  553.        above case  the first  merge pass  processed  about  40%  of  the
  554.        records, hence the value of 2.4.
  555.  
  556.        The above sort was performed on an Zenith 248, an eight megahertz
  557.        AT clone  with two  hard drives (C and D).  The input file was on
  558.        C; the  temporary merge  files were  placed on  D; and the output
  559.        file was  written to C.  The sort of a 1.3 megabyte file took un-
  560.        der three  minutes.   The same  sort on  an XT  should take about
  561.        seven minutes.
  562.  
  563.        The /? Parameter       The /? Parameter
  564.  
  565.        The /?  parameter requests  help or  parameter evaluation.   When
  566.        QSORT is  executed with  the /? parameter alone, it lists a short
  567.        description of  the QSORT parameters.  If /? is entered as one of
  568.        several parameters,  QSORT will  produce a  short report  on  the
  569.        screen describing the sort it would perform based on those param-
  570.        eters without actually doing a sort.
  571.  
  572.        For example:
  573.  
  574.             QSORT /? /L5:12 /-3:2 /22 /T /R <INFILE.TXT >OUTFILE.TXT            QSORT /? /L5:12 /-3:2 /22 /T /R <INFILE.TXT >OUTFILE.TXT
  575.  
  576.        requests a  sort on  a file  of tagged records.  It defines three
  577.        sort keys,  one of  them inverted (-).  The /R parameter reverses
  578.        the sense  of all  three keys.   Since  redirection is specified,
  579.        QSORT does  not see  or know about the names of the files it will
  580.        sort.   The /?  parameter requests  a report, rather than a sort,
  581.        and QSORT obligingly produces on the screen, the following:
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.        QSORT Text Sorting Utility                                 Page 8       QSORT Text Sorting Utility                                 Page 8
  596.  
  597.  
  598.        -----------------------------------------------------------------
  599.        QSORT - Text Sort - Version 3.10
  600.        Copyright (c) 1985, 1986, 1987  - Ben Baker - All rights reserved
  601.        
  602.        With the present arguments, QSORT would sort from STDIN to STDOUT
  603.        Records are multiple lines ending with an empty line
  604.        
  605.        Key fields in descending order of importance are:
  606.          Field  Pos   Len Type
  607.        
  608.              1    5    12 Lexical Descending
  609.              1    3     2 ASCII
  610.              1   22 65535 ASCII   Descending
  611.        -----------------------------------------------------------------
  612.  
  613.        The third  key has  an unspecified  length.   The  value  "65535"
  614.        merely means that this key extends to the end of each record.
  615.  
  616.        The /M<len>  supported in  earlier versions of QSORT is no longer
  617.        required, but  will be accepted (and ignored) by QSORT.  There is
  618.        no "hard-coded"  maximum record  length in  QSORT, but there is a
  619.        practical limit.  At some time during every sort, the two longest
  620.        records in  the input  file must be compared.  Therefore, the two
  621.        longest records  must be able to fit together in the sort buffer.
  622.        The sum  of their lengths cannot exceed about 50K -- not an alto-
  623.        gether unreasonable  limitation.   QSORT can  be shoe-horned into
  624.        tighter memory  and will  run if it can find 4K for a sort buffer
  625.        and 4K  for an  output buffer,  but the  two longest records must
  626.        still fit in the sort buffer together.
  627.  
  628.        Arguments may appear in any order on the command line except that
  629.        <in_file> must  appear before  <out_file>, and  /<key_spec> argu-
  630.        ments must appear in descending order of importance.
  631.  
  632.  
  633.  
  634.                                 Lexical Sorting                                Lexical Sorting
  635.  
  636.  
  637.        The lexical  sorting capability  was borne  out of my own need to
  638.        sort word  lists with  mixed capitalization.  ASCII sequence pro-
  639.        duced some  bizarre results  when words beginning with 'Z' sorted
  640.        before those  beginning with 'a.' Case-insensitive sorting wasn't
  641.        much better because upper and lower case got mixed randomly.
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.        QSORT Text Sorting Utility                                 Page 9       QSORT Text Sorting Utility                                 Page 9
  662.  
  663.  
  664.        The following table will illustrate what I mean:
  665.  
  666.             INPUT         ASCII          CASE           LEXICAL
  667.                                       INSENSITIVE
  668.  
  669.             DeLaPort      Baker          Baker          Baker
  670.             Smith         Brown          brown          Brown
  671.             brown         DeAngelo       bRown          bRown
  672.             deLaPorte     DeLaPort       Brown          brown
  673.             Deangelo      Deangelo       Deangelo       DeAngelo
  674.             deAngelo      Deangelo       deangelo       Deangelo
  675.             Brown         DelaPort       Deangelo       Deangelo
  676.             smith         DelaPorte      deAngelo       deAngelo
  677.             delaPorte     Harry          DeAngelo       deangelo
  678.             DelaPort      Smith          delaPort       DeLaPort
  679.             DeAngelo      bRown          DelaPort       DelaPort
  680.             DelaPorte     brown          delaPort       delaPort
  681.             deangelo      deAngelo       DeLaPort       delaPort
  682.             Harry         deLaPorte      DelaPorte      DelaPorte
  683.             delaPort      deLaPorte      deLaPorte      deLaPorte
  684.             Baker         deangelo       delaPorte      deLaPorte
  685.             deLaPorte     delaPort       deLaPorte      delaPorte
  686.             Deangelo      delaPort       Harry          Harry
  687.             bRown         delaPorte      smith          Smith
  688.             delaPort      smith          Smith          smith
  689.  
  690.        The first column is a list of names in arbitrary order.  The sec-
  691.        ond is  an ASCII  sort of  that list.  Third we have one possible
  692.        case-insensitive sort  of the  list.  The fourth column is what I
  693.        really wanted.   It is sorted the way these words would be sorted
  694.        in a  dictionary (or lexicon).  The third and fourth columns both
  695.        collect words  of identical  spellings together, but in the third
  696.        column, upper  and lower  case spellings  are in arbitrary order,
  697.        while the  fourth column  places upper  case spellings  ahead  of
  698.        lower case spellings.
  699.  
  700.        For example, the two occurrences of Smith are widely separated in
  701.        column 2 because one is capitalized and the other is not.  Column
  702.        3 brings  the two  together, but  in the wrong order.  They might
  703.        have been  in the  right order,  but the  order is strictly arbi-
  704.        trary.   In column 4, Smith comes before smith, and lexical sort-
  705.        ing will always put them in this order.
  706.  
  707.        Lexical sorting  is achieved  by making  case-insensitive compar-
  708.        isons of  entire keys.   If the keys compare equal, an ASCII com-
  709.        parison is  made  to  arbitrate  ties.    In  other  words,  when
  710.        "lexical" keys in two records have different spellings, the case-
  711.        insensitive comparison determines the order of the records.  When
  712.        "lexical" keys  are spelled the same, the case-sensitive compari-
  713.        son determines the order of the records.
  714.  
  715.        Lexical keys are defined, as indicated above, by placing the let-
  716.        ter 'L'  immediately following  the slant-bar  (/) in  <key_spec>
  717.        definitions.
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.        QSORT Text Sorting Utility                                Page 10       QSORT Text Sorting Utility                                Page 10
  728.  
  729.  
  730.        Lexical sorting can be very useful when needed, but be aware that
  731.        unnecessarily specifying lexical ordering may degrade performance
  732.        of QSORT.
  733.  
  734.  
  735.  
  736.                                    Examples                                   Examples
  737.  
  738.  
  739.        Produce a  sorted directory listing and display it on the console
  740.        a screen's worth at a time:
  741.  
  742.             A>DIR | QSORT | MORE            A>DIR | QSORT | MORE
  743.  
  744.        This demonstrates the use of QSORT as a "filter" in a "pipe."
  745.  
  746.        
  747.  
  748.        Produce a directory listing sorted by creation date and time, and
  749.        display it on the console a screen's worth at a time:
  750.  
  751.             A>DIR | QSORT /30:2 /24:5 /39 /34:5 | MORE            A>DIR | QSORT /30:2 /24:5 /39 /34:5 | MORE
  752.  
  753.        The output  of the  DIR command  is piped to QSORT.  The keys de-
  754.        fined are,  from left to right (major to minor), year (2 digits),
  755.        month and  day, AM/PM flag and time.  The output of QSORT is then
  756.        piped to MORE for display.
  757.  
  758.        
  759.  
  760.        Next, replace  the unsorted FILE.TXT with the same data sorted in
  761.        reverse order.  Use columns 10 to 16 as the sort key:
  762.  
  763.             >QSORT FILE.TXT /-10:7            >QSORT FILE.TXT /-10:7
  764.  
  765.                  or                 or
  766.  
  767.             A>QSORT FILE.TXT /10:7 /R            A>QSORT FILE.TXT /10:7 /R
  768.  
  769.                  or (SORT compatible)                 or (SORT compatible)
  770.  
  771.             A>QSORT FILE.TXT /R /+10            A>QSORT FILE.TXT /R /+10
  772.  
  773.        Next, perform a simple sort on a file with up to 240-byte records
  774.  
  775.             A>QSORT LARGE.REC /M240            A>QSORT LARGE.REC /M240
  776.  
  777.                  or                 or
  778.  
  779.             A>QSORT LARGE.REC            A>QSORT LARGE.REC
  780.  
  781.        Note that  the "/M240"  parameter is  no  longer needed, but will
  782.        not hurt.
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.        QSORT Text Sorting Utility                                Page 11       QSORT Text Sorting Utility                                Page 11
  794.  
  795.  
  796.        
  797.  
  798.        GLOSS.TXT is  an unsorted  glossary of terms.  The term being de-
  799.        fined by  each entry  appears first, followed by several lines of
  800.        definition.   The entries  are separated by empty lines.  Produce
  801.        GLOSS.SRT, a sorted version of the glossary:
  802.  
  803.             A>QSORT /T  <GLOSS.TXT >GLOSS.SRT      (with redirection)            A>QSORT /T  <GLOSS.TXT >GLOSS.SRT      (with redirection)
  804.  
  805.                  or                 or
  806.  
  807.             A>QSORT /T   GLOSS.TXT  GLOSS.SRT      (without redirection)            A>QSORT /T   GLOSS.TXT  GLOSS.SRT      (without redirection)
  808.  
  809.        
  810.  
  811.        A lawyer  keeps a  running log  of  his  billable  activities  in
  812.        TIME.LOG.   The first  line of  each entry is "mm/dd/yy hh:mm ac-
  813.        count#." He  always places  a tilde  (~) in the last line of each
  814.        entry.   He wishes  to sort the log by account number, and by as-
  815.        cending date and time within each account:
  816.  
  817.             A>QSORT  /16:7 /7:2 /1:5 /10:5 /T~  TIME.LOG            A>QSORT  /16:7 /7:2 /1:5 /10:5 /T~  TIME.LOG
  818.  
  819.        
  820.  
  821.        The directory  of users  for a bulletin board system is kept in a
  822.        binary file  of fixed-length  records 180  bytes long.   The user
  823.        name is  a 26-character field beginning in the first position and
  824.        the city/state  field is  a 16-character  field beginning  in the
  825.        fortieth position.  Sort the file by city/state and name.
  826.  
  827.             C>QSORT /F180 /40:16 /1:26 USER.BBS            C>QSORT /F180 /40:16 /1:26 USER.BBS
  828.  
  829.        
  830.  
  831.        DB.TXT is  a delimited  field output  file from  dBASE III,  Each
  832.        record contains  7 fields, delimited by commas.  Sort the file to
  833.        the screen using field 3 as a sort key.
  834.  
  835.             C>QSORT /D7 /3. <DB.TXT            C>QSORT /D7 /3. <DB.TXT
  836.  
  837.        Here, "standard input" has been redirected to the file.  Since no
  838.        redirection is  given for  "standard output,"   DOS assigns it to
  839.        the console by default.  This is NOT a sort-in-place!"
  840.  
  841.        
  842.  
  843.        You have  received a member list from the Society of End-users of
  844.        XENIX (SEX.LST).   Sort  the list by special interest (10 columns
  845.        beginning at 70) and name (30 columns beginning at 1).  Note that
  846.        the file contains no carriage return characters.
  847.  
  848.             C>QSORT  SEX.LST /70:10 /1:30 /D,\L            C>QSORT  SEX.LST /70:10 /1:30 /D,\L
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.        QSORT Text Sorting Utility                                Page 12       QSORT Text Sorting Utility                                Page 12
  860.  
  861.  
  862.        The /D  parameter is  used to  redefine the newline sequence as a
  863.        naked line feed character.
  864.  
  865.        
  866.  
  867.        The file  LABEL.TXT contains mailing label images.  Each label is
  868.        6 lines  (1 inch)  high.  Line six is always empty and line three
  869.        is frequently  empty.  An extended Zip code always begins in col-
  870.        umn 20  of line  5, and extends to the end of the line.  In order
  871.        to take  advantage of  bulk mailing  rates, the  labels  must  be
  872.        sorted into carrier route (CRT) order.
  873.  
  874.             QSORT LABEL.TXT /5.20 /D6\N            QSORT LABEL.TXT /5.20 /D6\N
  875.  
  876.        We must  use a "delimited field" sort rather than a "tagged line"
  877.        sort for  two reasons:   1)  Line six is empty, not tagged with a
  878.        special character.   When  line three is also empty a label would
  879.        be broken  into two  pieces and separated by the sorting process.
  880.        2) Our  sort key is not at any known offset from the beginning of
  881.        the label.  Its position is fixed only relative to line five.
  882.  
  883.  
  884.  
  885.                              Implementation Notes                             Implementation Notes
  886.  
  887.  
  888.        General Information       General Information
  889.  
  890.        QSORT is intended as an enhanced replacement for DOS SORT.  It is
  891.        nearly fully  upward compatible,  but provides  much more  flexi-
  892.        bility.   Multiple sort  keys may be specified, a pseudo in-place
  893.        sort may be performed and files and/or records of any size may be
  894.        sorted provided only that there is sufficient disk space for work
  895.        files and  the output  file.   QSORT uses  the "quick sort" algo-
  896.        rithm, which cannot guarantee the order of records whose keys are
  897.        all equal.   This  is the  one "incompatibility"  with DOS  SORT,
  898.        which retains  the original  order of  records when  its only key
  899.        compares equal.  This is important to SORT because it must be in-
  900.        voked multiple  times to effect a multiple key sort.  With QSORT,
  901.        you only sort once and there are usually enough keys available to
  902.        insure you get the order you want the first time.
  903.  
  904.        QSORT uses  a sort  buffer of  about 50K  bytes and will fill the
  905.        buffer as  full as  possible, and then sort its contents.  If the
  906.        end of  the input  file has  been reached  and no  temporary work
  907.        files have  been generated, the sorted contents of the buffer are
  908.        written to the output file, completing the sort operation.
  909.  
  910.        If the  input file  is too  large to fit into the sort buffer, as
  911.        much of  the input  file as  possible is  read into  the  buffer,
  912.        sorted, then  written to  a temporary work file.  This process is
  913.        repeated as  many times  as necessary to process the entire input
  914.        file, each time creating a new work file for the sorted output.
  915.  
  916.  
  917.  
  918.  
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.        QSORT Text Sorting Utility                                Page 13       QSORT Text Sorting Utility                                Page 13
  926.  
  927.  
  928.        Upon completion  of the  "sort  phase,"  QSORT  begins  a  "merge
  929.        phase."   Each work  file is  a sorted sub-set of the input file.
  930.        Thus, work files may be read sequentially and combined to produce
  931.        a sorted  output.  QSORT will open as many work files as DOS per-
  932.        mits (more  on this  later).  If all the remaining work files can
  933.        be opened,  the sorted  result is  written to  the  output  file.
  934.        Otherwise, a new work file is created and another merge pass will
  935.        be required.  On each merge pass, the number of work files is re-
  936.        duced and  eventually all remaining work files will be opened and
  937.        the sorted  output file will be written completing the sort oper-
  938.        ation.
  939.  
  940.        Performance and DOS Configuration       Performance and DOS Configuration
  941.  
  942.        QSORT is smart enough to never have just one work file remaining,
  943.        which would  require an  unnecessary copy  operation.   In  fact,
  944.        QSORT is  smarter than  just that  in its  handling of  the merge
  945.        phase.   If more  than one  merge pass  is required, all the data
  946.        merged during  the first  pass will  have to  be merged again, so
  947.        QSORT attempts to minimize the first pass.  For example, if QSORT
  948.        discovers it  may only  open 15 files at a time, and there are 16
  949.        temporary files,  it will only merge two files on the first pass,
  950.        creating a  17th file  as it  does.   Then in the second pass, it
  951.        will merge  all 15  remaining files to the output file.  The less
  952.        data it processes twice, the faster it performs the sort!
  953.  
  954.        With nothing  else to  guide it, QSORT places its temporary files
  955.        in the  default directory.  Either of two "environment variables"
  956.        can override this.  (See your DOS manual for information on envi-
  957.        ronment variables and the SET command.) The DOS command:
  958.  
  959.             SET QSTMP=<path>        or            SET QSTMP=<path>        or
  960.  
  961.             SET TMP=<path>          or            SET TMP=<path>          or
  962.  
  963.             SET TEMP=<path>            SET TEMP=<path>
  964.  
  965.        will define  a path  for QSORT to use for its temporaries.  QSORT
  966.        first looks  for the  environment variable QSTMP.  If it does not
  967.        exist, QSORT  next looks  for TMP or TEMP in that order.  TMP and
  968.        TEMP are  de facto  standards used by many programs, and are usu-
  969.        ally defined in your AUTOEXEC.BAT batch file.  You might have TMP
  970.        specifying a  64K RAM  disk to  speed up  your compiler.  In this
  971.        case, an  attempt to  sort a  100K file  is  doomed  to  failure.
  972.        Rather than  redefine TMP, you may define QSTMP to force QSORT to
  973.        use some directory on your hard disk.  In fact:
  974.  
  975.             SET QSTMP=\            SET QSTMP=\
  976.  
  977.        tells QSORT  to always  use the  root directory  of  the  default
  978.        drive!
  979.  
  980.        QSORT, to work properly, needs enough space on the output disk to
  981.        hold the  output file.   Even  if the input file is to be deleted
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.        QSORT Text Sorting Utility                                Page 14       QSORT Text Sorting Utility                                Page 14
  992.  
  993.  
  994.        and resides  in the  same directory, that is not done until after
  995.        the output file has been successfully written.  If one merge pass
  996.        is required,  the disk space QSORT uses for temporary merge files
  997.        will be  about 10%  larger than  the size  of the input file.  If
  998.        more than  one merge pass will be required, allow about twice the
  999.        size of the input file as temporary merge file space.
  1000.  
  1001.        One of  the advantages of controlling where QSORT places its tem-
  1002.        porary files  is to  insure adequate space for them.  A second is
  1003.        speed.   If the  temporary files can be placed on a separate disk
  1004.        from the  input and  output files,  disk seeking is minimized and
  1005.        performance improved.
  1006.  
  1007.        Each time  QSORT must create a new temporary merge file, the data
  1008.        put into  it will  be processed again.  Obviously, the more files
  1009.        QSORT can  open during  the merge  phase, the fewer times it will
  1010.        have to  handle each  record and  the faster  it can  sort  large
  1011.        files.   If DOS is properly pre-conditioned, QSORT can have up to
  1012.        15 temporary  merge files  open at once, and very large files can
  1013.        be sorted  with just  one sort pass and one merge pass.  Unfortu-
  1014.        nately, that capability is not automatic.
  1015.  
  1016.        DOS has  a fixed number of file "handles" that it associates with
  1017.        open files.   The  default number is eight, but DOS opens five of
  1018.        them for  standard input,  standard output, standard error, stan-
  1019.        dard printer  and standard  auxiliary device.   That leaves three
  1020.        for merging.   A  250K input  file would  produce five  temporary
  1021.        merge files  and that  would take  three merge  passes; merge two
  1022.        into one, leaving four; merge two into one leaving three; and fi-
  1023.        nally merge  three into  the output  file.  In the process, QSORT
  1024.        must read  and write about 80% of the file twice during the merge
  1025.        phase.
  1026.  
  1027.        Worse yet,  since you need at least three handles for merging, if
  1028.        you have  resident programs that have open files, you can't merge
  1029.        at all!
  1030.  
  1031.        DOS can  be told  to set aside more space for file handles.  Each
  1032.        handle is  only 39  bytes and  it's memory  very well spent.  One
  1033.        process can  have a  maximum of  20 handles open at one time, but
  1034.        since resident  processes may be using handles, I recommend 25 to
  1035.        35.  To do this, the root directory of the DISK OR DISKS YOU BOOT
  1036.        FROM must  contain a file named CONFIG.SYS.  If your boot disk(s)
  1037.        already contains  a CONFIG.SYS,  edit it, or if not, create it to
  1038.        contain the following line:
  1039.  
  1040.             FILES=25        (or more)            FILES=25        (or more)
  1041.  
  1042.        While we're  at it,  let's add one more thing to CONFIG.SYS which
  1043.        will improve  the performance of QSORT and many other programs as
  1044.        well.  DOS provides, by default, two disk buffers.  These are the
  1045.        buffers it  uses to  do its  disk reads  and writes.   During the
  1046.        merge phase  QSORT may have many files open at once, reading from
  1047.        them in more or less random order.  DOS may have to read the same
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053.  
  1054.  
  1055.  
  1056.  
  1057.        QSORT Text Sorting Utility                                Page 15       QSORT Text Sorting Utility                                Page 15
  1058.  
  1059.  
  1060.        physical sector  several times  to get all its data.  But DOS can
  1061.        remember what's  in each  buffer and where it came from, and will
  1062.        not re-read  a sector  it already has in a buffer.  DOS needs 528
  1063.        bytes for each buffer.  I recommend 20 buffers to make QSORT per-
  1064.        form well  under the  most adverse conditions.  This will require
  1065.        an additional  9504 bytes  or slightly more than 9K, again memory
  1066.        well spent, so we add to CONFIG.SYS the following line:
  1067.  
  1068.             BUFFERS=20            BUFFERS=20
  1069.  
  1070.        See your DOS manual for more information on CONFIG.SYS.
  1071.  
  1072.        Performance and Input Record Type       Performance and Input Record Type
  1073.  
  1074.        QSORT must  read and  parse logical  records before sorting them,
  1075.        then reassemble  them before  final output.   The type of records
  1076.        contained in  the file being sorted determines how much work this
  1077.        requires, and therefore has an impact on performance.
  1078.  
  1079.        The present version of QSORT can handle four record types: simple
  1080.        ASCII, tagged  ASCII, delimited field ASCII and fixed length, de-
  1081.        termined by  the presence  or absence of a /T, /D or /F parameter
  1082.        on the command line.
  1083.  
  1084.        Fixed length  records are very structured and require no parsing.
  1085.        Other things  equal, files  of fixed length records will sort the
  1086.        fastest.
  1087.  
  1088.        When parsing  simple ASCII  records, QSORT must find and mark the
  1089.        newline sequence,  then restore it for final output.  In general,
  1090.        this is relatively fast, but is affected by line length.  In par-
  1091.        ticular, lines  containing "over-strikes"  (naked  CR  characters
  1092.        followed by more data) can significantly slow down the parsing.
  1093.  
  1094.        Tagged ASCII  records are  parsed in  a fashion similar to simple
  1095.        ASCII records,  if a  tag character  is defined.   First  the tag
  1096.        character is  found, then  the next newline sequence is found and
  1097.        marked.   The time  required is  of course dependant on the total
  1098.        length of  the logical  record, but  is fairly  fast.   If no tag
  1099.        character is  defined, two  successive newline  sequences must be
  1100.        found.   This depends not only on total length, but the number of
  1101.        lines contained in a logical record.
  1102.  
  1103.        To parse  a delimited field record with n fields, n minus one de-
  1104.        limiters must be found and marked, then the newline sequence must
  1105.        be found and marked.  It is similar to tagged records with no de-
  1106.        fined tag character, but because records of this type are usually
  1107.        shorter than  tagged records, parsing delimited field records may
  1108.        be a  little faster.   It is certainly slower than parsing simple
  1109.        ASCII records.
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122.  
  1123.        QSORT Text Sorting Utility                                Page 16       QSORT Text Sorting Utility                                Page 16
  1124.  
  1125.  
  1126.        Performance and Sort Keys       Performance and Sort Keys
  1127.  
  1128.        The sort  keys defined  on the command line have a lot to do with
  1129.        QSORT's performance.  There isn't much you can do in the way of a
  1130.        strategy you  can use when you need a particular file sorted in a
  1131.        particular way, but you should at least be aware.
  1132.  
  1133.        Several decisions  must be  made in comparing two records.  Which
  1134.        field contains the current key?  Is the field long enough to con-
  1135.        tain the  key in one, both or neither record?  Are the keys lexi-
  1136.        cal or  ASCII?   If the  answers to  any of  these questions will
  1137.        remain constant  over the  course of  a sort  run, they should be
  1138.        answered once, not several thousand times!
  1139.  
  1140.        QSORT has  ten record  comparison routines  varying in  degree of
  1141.        complexity.   At the  beginning of  each sort  run it selects the
  1142.        simplest one  possible, based on the parameters given, to be used
  1143.        throughout the run.
  1144.  
  1145.        If no sort key parameters are given, the entire record is used as
  1146.        a key.   The  compare routine has no decisions it must make -- it
  1147.        simply compares  the two  strings handed it.  This is the "simple
  1148.        sort," and is the fastest possible case.
  1149.  
  1150.        A sort  key that  does not  begin at  the beginning of a variable
  1151.        length record,  may not  be contained  in a  particular record at
  1152.        all, while  a fixed  length record  is known to contain all keys.
  1153.        Other things equal, files of fixed length records will sort some-
  1154.        what faster because the compare routine does not have to test for
  1155.        "key containment."
  1156.  
  1157.        Lexical keys  are first  compared with a "case insensitive" tech-
  1158.        nique.   Each character is tested to see if it is alphabetic.  If
  1159.        it is, it is converted to upper case.  Then a converted character
  1160.        from each  record is  tested.   This is obviously slower than di-
  1161.        rectly comparing  two characters.  In the event lexical keys com-
  1162.        pare equal,  they are compared again using a direct compare tech-
  1163.        nique!   Files with  lexical keys  sort slower than similar files
  1164.        without them.
  1165.  
  1166.        In the  case of  files with  delimited field records, the compare
  1167.        routine must  find the  correct field  for each key, determine if
  1168.        the keys  are contained  within the  fields, and  finally compare
  1169.        them.   The added  step of searching for fields slows record com-
  1170.        parison.
  1171.  
  1172.        In general, the more complex the data, the more complex the sort-
  1173.        ing task and the longer it will take.  QSORT attempts to optimize
  1174.        its performance  by making as many decisions as it can about your
  1175.        data up  front, then  selecting a compare routine that makes only
  1176.        the necessary decisions on a record-by-record basis.
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.        QSORT Text Sorting Utility                                Page 17       QSORT Text Sorting Utility                                Page 17
  1190.  
  1191.  
  1192.        Performance and File Size       Performance and File Size
  1193.  
  1194.        I received  a letter  from someone which included a graph showing
  1195.        QSORT's performance  in sorting  time vs.  file size.  He said he
  1196.        had expected  an exponential,  or at  least a  logarithmic curve.
  1197.        Instead time  increased linearly with file size.  I admit it puz-
  1198.        zled me  at the time, but Codeview, Microsoft's debugger, made it
  1199.        ease for  me to  measure the  performance of the various parts of
  1200.        the QSORT  program.  It turns out that actual sorting of data ac-
  1201.        counts for  a very  small percentage of QSORT's running time.  It
  1202.        spends most  of it's  time doing  I/O.   For files up to about 50
  1203.        kilobytes, it  will read and write each record once.  From 50K to
  1204.        about 750K  there will  be one merge pass and each record will be
  1205.        read and  written twice.   Since the amount of I/O increases lin-
  1206.        early over this range of file sizes, so will sorting time.
  1207.  
  1208.        Above about  750K a second merge pass will be needed, but in this
  1209.        size range,  only seven  to ten  percent of the data will be pro-
  1210.        cessed in  the first  merge pass,  so the sort time vs size curve
  1211.        will steepen  slightly, but  will not experience a large step (as
  1212.        it did  in versions  1 and  2).   Doubling the  file size  to 1.5
  1213.        megabytes should increase the sort time about three times.
  1214.  
  1215.        Sorting time  will be  approximately proportional  to  file  size
  1216.        times the  "average passes  over data" number from the statistics
  1217.        report.   Since this  number remains a constant "2.0" over a wide
  1218.        range of  file sizes,  sorting time  will be a linear function of
  1219.        file size in that range.
  1220.  
  1221.        
  1222.  
  1223.        I hope  you find  this program useful.  Your comments and sugges-
  1224.        tions are welcome.  My address is in the next section.
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.        QSORT Text Sorting Utility                                Page 18       QSORT Text Sorting Utility                                Page 18
  1256.  
  1257.  
  1258.                                 About Shareware                                About Shareware
  1259.  
  1260.  
  1261.        QSORT is made available under the "shareware" concept.  Shareware
  1262.        products are distributed freely and publicly.  You are invited to
  1263.        "test drive"  them without  cost.  But shareware is NOT FREE!  If
  1264.        you use  a product,  you are  expected to  pay a fee for its use.
  1265.        Because overhead  costs are  minimal, this fee is usually a frac-
  1266.        tion of  the normal commercial price the product might carry, but
  1267.        it is NOT zero!
  1268.  
  1269.        If you find this program useful, you are asked to send its author
  1270.        a license  fee of $20 for each machine on which you use it.  This
  1271.        will encourage the development of other useful, affordable tools.
  1272.  
  1273.        QSORT may  be freely copied and distributed.  provided that 1) it
  1274.        is distributed  under the name "QSORT," and 2) this documentation
  1275.        file always  accompanies it.  Vendors wishing to distribute QSORT
  1276.        commercially, or  with commercial products may contact the author
  1277.        at the address below for terms.
  1278.  
  1279.        Send checks to:
  1280.  
  1281.             Ben Baker
  1282.             Baker's Acre
  1283.             RR #1, Box 637
  1284.             E. Alton, Il 62024
  1285.  
  1286.        Bug reports  or suggestions  may be  sent to the above address or
  1287.        via FidoNet  mail to Fido node # 100/76, Baker's Acre, or by log-
  1288.        ging into Baker's Acre BBS at 618-251-2169.
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.