home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 14 / CDACTUAL.iso / cdactual / demobin / share / program / asm / RPSRT102.ZIP / RPSORT.DOC < prev    next >
Encoding:
Text File  |  1992-12-15  |  85.0 KB  |  1,953 lines

  1.  
  2.  
  3.   October 10, 1991             RPSORT Reference                      Page   i
  4.  
  5.  
  6.                                Table of Contents
  7.                                -----------------
  8.  
  9.   Introduction                                                              1
  10.  
  11.   How to Display RPSORT Built-in Syntax Screens                             1
  12.  
  13.   Syntax Conventions                                                        1
  14.  
  15.   How To Exit Quickly From RPSORT                                           2
  16.   Quick Exit From RPSORT When Output Goes To The Standard Output            2
  17.  
  18.   General Description of How RPSORT Does A Sort                             3
  19.  
  20.   Summary Of RPSORT Syntax                                                  4
  21.  
  22.   Details Of RPSORT Syntax                                                  5
  23.  
  24.     Options For Specifying Input And Output Files                           5
  25.       Using RPSORT As A Filter                                              5
  26.       Specifying Input And Output Files Directly                            5
  27.  
  28.     Specifying Lines Or Fixed Length Records                                6
  29.       Lines Are The Default                                                 6
  30.       /Fnnnn - Specifying Fixed Length Records                              6
  31.  
  32.     Detailed Description Of Sort Key Types Supported By RPSORT              7
  33.       Sort Keys That Are Character Strings                                  7
  34.         Default Case Insensitive Character Strings                          7
  35.         ASCII (Case Sensitive) Character Strings                            7
  36.         C Language Style Character Strings                                  7
  37.         Turbo Pascal Style Character Strings                                8
  38.       Sort Keys That Are Binary Numbers                                     8
  39.         Signed Binary Integers                                              8
  40.         Unsigned Binary Integers                                            9
  41.         BASICA And GWBASIC Floating Point Numbers                           9
  42.         Turbo Pascal Real Numbers                                           9
  43.         Math Co-Processor Floating Point Numbers                           10
  44.  
  45.     Defining The Desired Sort Sequence To RPSORT                           11
  46.       Standard Defaults For Sort Keys                                      11
  47.       Switches Which Set Defaults For Sort Keys                            11
  48.         /A - Sort all Text Keys in ASCII (Case Sensitive) Sequence         11
  49.         /C - Make All Text Keys Be C Language Strings                      11
  50.         /P - Make All Text Keys Be Turbo Pascal Strings                    11
  51.         /R - Sort All Keys In Reverse (Descending Order)                   11
  52.  
  53.  
  54.  
  55.   October 10, 1991             RPSORT Reference                      Page  ii
  56.  
  57.  
  58.                          Table of Contents (continued)
  59.                          -----------------------------
  60.  
  61.       Defining Sort Keys                                                   12
  62.         Sort Key Definition Syntax                                         12
  63.         Col - The Start Column For A Key                                   12
  64.         Len - The Length Of A Key                                          12
  65.         R   - Sorting The Key In Reverse (Descending) Order                12
  66.         A   - Sorting The Key In ASCII (case insensitive) Order            12
  67.         C   - Specifying A C Language Type String                          12
  68.         P   - Specifying A Turbo Pascal Type String                        12
  69.         I   - Specifying A Signed Binary Integer                           13
  70.         U   - Specifying An Unsigned Binary Integer                        13
  71.         F   - Specifying A Math Co-processor Type Floating Point Number    13
  72.         M   - Specifying A BASIC Interpretor Type Floating Point Number    13
  73.         T   - Specifying A Turbo Pascal Type Real Number                   13
  74.         List Of Various Compiler And Interpreter Numeric Data Types        14
  75.  
  76.     Miscellaneous Switches                                                 15
  77.       /Q - Suppressing Copyright And Completion Messages                   15
  78.       /Eerrfile - Directing Error Messages To A File                       15
  79.       /B - Ignoring Control Breaks Entered From The Keyboard               15
  80.       /D - Delete Records Whose Sortkeys Duplicate Previous Record         15
  81.       /N - Delete Null Lines                                               16
  82.       /Td - Designate Drive To Be Used For Temporary Files.                16
  83.       /Z - Ignore Ctrl-Z In Text File.  Use Entire Physical File.          16
  84.  
  85.   Efficiency Considerations                                                17
  86.     Do ASCII Sort If Text Keys Are All Upper Case Or All Lower Case        17
  87.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space      18
  88.       Using CHKDSK Or MEM To Determine Free Memory                         18
  89.       Sorts Requiring No Merge Phase And No Temporary Files                19
  90.       Sorts Requiring One Merge Phase And One Temporary File               20
  91.       Sorts Requiring Two Or More Merge Phases And Two Temporary Files     21
  92.     Deciding What Drives To Put Temporary And Output Files On              21
  93.     Buffers Command In Your Config.Sys                                     22
  94.     Using Disk Cache Programs                                              22
  95.  
  96.   Special Situations                                                       23
  97.     Sorting Files That Contain Tabs                                        23
  98.     Writing The Output To The File That Contained The Input                24
  99.  
  100.   Two Incompatibilities With The DOS SORT                                  24
  101.  
  102.   Error Messages                                                           25
  103.     Error Numbers And Return Codes                                         25
  104.     Syntax Error Messages                                               26-30
  105.     DOS Version Before 2.0 Message                                         31
  106.     Insufficient Memory Messages                                           31
  107.     Line Or String Too Long Messages                                       31
  108.     Input/Output Error Messages                                         32-33
  109.     Never Should Happen Error Messages                                     33
  110.  
  111.  
  112.  
  113.   October 10, 1991             RPSORT Reference                      Page   1
  114.  
  115.  
  116.   Introduction
  117.  
  118.     RPSORT is a sort utility that greatly improves upon the features and the
  119.     performance of the sort utility distributed with Microsoft DOS.  First,
  120.     RPSORT does everything that the DOS SORT does.  Virtually any command
  121.     that works with DOS SORT works with RPSORT and produces the same result.
  122.  
  123.     But RPSORT does much more.  It can sort very large files and supports
  124.     multiple sort keys.  It is extremely fast.  I do not know of another sort
  125.     utility that can outspeed it.
  126.  
  127.     RPSORT sorts text files.  These consist of lines each ended by CRLF (i.e.
  128.     a carriage return and line feed).  RPSORT also sort files of fixed length
  129.     records such as those produced by many BASIC, Pascal and C programs.
  130.  
  131.     RPSORT supports numerous sort key types including regular text keys, C
  132.     language strings, Turbo Pascal strings, signed and unsigned binary
  133.     integers of any length and several types of binary floating point numbers.
  134.  
  135.     RPSORT can delete null lines (consisting only of a CRLF).  It can also
  136.     delete records/lines whose sort keys duplicate those in a previous
  137.     record/line.
  138.  
  139.     A summary of RPSORT syntax appears on page 4 of this document.
  140.     A comprehensive list of RPSORT examples can be found in the file
  141.     EXAMPLES.DOC.
  142.  
  143.  
  144.   How to Display RPSORT Built-in Syntax Screens
  145.  
  146.     Enter the RPSORT command with no parameters, to see RPSORT's built-in
  147.     syntax screens.  Use the Page Down and Page Up keys to negotiate the
  148.     screens.  Press the Esc key when you are finished viewing the syntax
  149.     screens.
  150.  
  151.  
  152.   Syntax Conventions
  153.  
  154.   . Items in square brackets ([]) are optional.  Type the information inside
  155.     the brackets but not the brackets themselves.
  156.  
  157.   . An item followed by an ellipsis (...) may be repeated several times.
  158.  
  159.   . Capital letters (A thru Z) and special characters (/ and ? and +) should
  160.     be entered as they appear in the syntax except that you may enter lower
  161.     case letters in place of the capital letters.
  162.  
  163.   . Words spelled out in lower case letters describe an item you are to enter.
  164.     For example, where you see the word "inputfile" in the syntax, enter the
  165.     path (if necessary) and the name of an input file.  File names and other
  166.     and other parameters may be entered in lower or upper case as you choose.
  167.  
  168.  
  169.  
  170.   October 10, 1991             RPSORT Reference                      Page   2
  171.  
  172.  
  173.   How To Exit Quickly From RPSORT
  174.  
  175.     RPSORT is very fast and can sort files containing hundreds of kilobytes
  176.     and thousands of records in just a few seconds (I am assuming a 286 CPU
  177.     and a hard disk).  However, if you are sorting a really large file (say
  178.     20 megabytes) then the execution time could be a some number of minutes.
  179.     If you start such a sort and then realize that you specified the wrong
  180.     sort key(s), you can terminate the sort immediately as follows:
  181.  
  182.     . Enter a Ctrl-Break (i.e. hold down the Ctrl key press the Break key).
  183.  
  184.     . Within a very few seconds, RPSORT will respond with the message:
  185.  
  186.         Do you wish to quit RPSORT?  Press Esc to quit, any other key to
  187.         continue.
  188.  
  189.     . If you do indeed wish to terminate the sort press the Esc key.  RPSORT
  190.       will clean up properly by deleting any temporary files as well as any
  191.       partial output file and then it will terminate.
  192.  
  193.     . If you decide you don't want to terminate the sort after all, press any
  194.       key but the Esc key and the sort will continue.
  195.  
  196.     After terminating the sort, as above, you can then re-enter the RPSORT
  197.     command with the correct parameters.
  198.  
  199.     There might be other reasons to terminate the sort.  Perhaps you need the
  200.     computer for some other purpose and can't wait for the sort to finish.
  201.     In such cases, be aware that any work done by RPSORT will be lost.  If
  202.     you do the sort later on you will have to start it from the beginning.
  203.  
  204.     If you want RPSORT to ignore any control break, use the /B switch.  See
  205.     "Miscellaneous Switches" on page 15.
  206.  
  207.  
  208.   Quick Exit From RPSORT When Output Goes To The Standard Output
  209.  
  210.     If RPSORT is writing its output to the standard output, as in:
  211.  
  212.       RPSORT    <inputfile  >outputfile
  213.  
  214.     then the termination proceeds a little differently:
  215.  
  216.     . As above you enter Ctrl-Break.
  217.  
  218.     . RPSORT simply terminates the sort within a few seconds without giving
  219.       you a chance to change your mind.  As above it deletes any temporary
  220.       files but it does not delete the output file.  It can't delete the
  221.       latter because it doesn't know the name of a redirected output file.
  222.  
  223.  
  224.  
  225.   October 10, 1991             RPSORT Reference                      Page   3
  226.  
  227.  
  228.   General Description of How RPSORT Does A Sort
  229.  
  230.     When you execute RPSORT you specify in the command line:
  231.  
  232.     . The source of the input data (one or more files) and the destination
  233.       for the sorted output (either a file or the screen).
  234.  
  235.     . Whether the input is lines terminated by CRLF or fixed length records.
  236.  
  237.     . Optionally, you define one or more sort key.  These indicate:
  238.  
  239.       . The location of the key in the line or record.
  240.       . The length of the key.
  241.       . The type of key. Any of several string or numeric types.
  242.  
  243.       If there are no sort key definitions, RPSORT assumes a default
  244.       character string key consisting of the entire line or record.
  245.  
  246.     The sort process involves the following:
  247.  
  248.     . RPSORT compares two records/lines, at a time, to determine which comes
  249.       first and swaps them, if necessary, to put them in the right sequence.
  250.       The comparisons continue until the entire input has been sequenced.
  251.  
  252.     . RPSORT uses the quicksort algorithm (invented by C. A. R. Hoare in
  253.       1962) to determine which records/lines to compare.  This algorithm is
  254.       very good at doing the sort with the minimum number of comparisons.
  255.  
  256.     . In comparing two records/lines, RPSORT compares the sort keys in the
  257.       same sequence as their appearance in the command line until it finds an
  258.       unequal compare or runs out of sort keys.
  259.  
  260.     . If all the sort keys are equal for two records, RPSORT breaks the tie
  261.       by comparing the locations of the two records in the input.  This
  262.       maintains any inherent order in the file (i.e. if two or more records
  263.       have identical sort keys then their order among themselves in the
  264.       sorted output will be the same as it was in the input).
  265.  
  266.     . For files consisting of lines, some of the lines may be:
  267.  
  268.       . Too short to contain any part of a given sort key.  Then, the sort
  269.         key is taken to be a null string and sorts lower than anything else.
  270.  
  271.       . Or too short to contain the whole sort key.  Then, the key comparison
  272.         is done for the length of the shorter key.  If the keys are equal for
  273.         that length, the shorter key sorts low.
  274.  
  275.     . If the input file(s) are small enough to fit in the available memory
  276.       space the sort is done in one pass in memory.
  277.  
  278.     . If the input is too big to fit into memory, it is read in chunks and
  279.       each chunk is sorted and written to a temp file.  Then RPSORT uses one
  280.       or more merge phases to combine the chunks into the sorted output file.
  281.  
  282.     . RPSORT displays the elapsed time for the sort at the end.
  283.  
  284.  
  285.   October 10, 1991             RPSORT Reference                      Page   4
  286.  
  287.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  288.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  289.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  290.  
  291.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  292.   ---------------------------------------------------------------------------
  293.   Summary Of RPSORT Syntax
  294.  
  295.   Input is one or more filespecs (including path if required) separated by
  296.   plus signs.  Output is a single filespec.  Input filespec(s) must precede
  297.   output filespec.  Input file(s) are sorted together into the single output
  298.   file.  Wildcard characters are allowed in input filespecs and all files
  299.   with matching names will be included.  For example:
  300.  
  301.       RPSORT  IPFILE*.DAT+C:\MYDIR\IP??FILE.DAT   OPFILE.DAT
  302.  
  303.   RPSORT can also be used as a filter.  For example:
  304.  
  305.       RPSORT   <IPFILE   >OPFILE
  306.  
  307.   By default, RPSORT assumes a text file with the entire line as a case
  308.   insensitive sort key.  This can be changed by some of the parameters below.
  309.  
  310.   /Q suppresses copyright and success messages.  Must be first parameter.
  311.   /Eerrfile specifies file to which error messages will go instead of the
  312.      screen.  Should precede any parameter except /Q.
  313.   /? or ? displays built-in syntax screens.
  314.   /A does an ASCII sort.  Case sensitive (lower case not equal upper case).
  315.   /B tells RPSORT to ignore any control break entered from the keyboard.
  316.   /C specifies C language style text keys (terminated by a binary zero).
  317.   /D deletes any record whose sortkeys duplicate those in a previous record.
  318.   /Fnnnn says that the input consists of fixed length records of nnnn bytes.
  319.   /N deletes any null lines (those consisting only of a CRLF sequence).
  320.   /P specifies Pascal style text keys (first byte is length of string).
  321.   /R specifies a reverse (descending order) sort.
  322.   /Td designates drive to be used for temp files instead of default drive.
  323.   /Z tells RPSORT to ignore Ctrl-Z in text file and use the entire file.
  324.   The /R switch applies to all sort keys. The /A, /C and /P switches apply to
  325.   all text sort keys.  They can't be over-ridden for an individual sort key.
  326.  
  327.   A sort key definition starts with /+ and may include the following
  328.   attributes.  No spaces are allowed between the attributes:
  329.  
  330.   col   is starting column of this key. Col 1 is the first col in the record.
  331.   :len  is the length of this key.
  332.   A     does an ASCII (case sensitive) sort for the key.
  333.   C     sorts this key as C language text key (terminated by a binary zero).
  334.   F     sorts this key as a 80x87 floating point number.  Len is 4, 8 or 10.
  335.   I     sorts this key as a signed binary integer.  This may be any length.
  336.   M     sorts this key as a BASICA floating point number.  Len is 4 or 8.
  337.   P     sorts this key as Pascal text key (first byte is length of string).
  338.   R     does a reverse (descending) sort for this key.
  339.   T     sorts this key as a Turbo Pascal type "real" number.  Len must be 6.
  340.   U     sorts this key as an unsigned binary integer. This may be any length.
  341.   Attributes F, I, M, P, T and U are only allowed for fixed length records.
  342.  
  343.  
  344.  
  345.   October 10, 1991             RPSORT Reference                      Page   5
  346.  
  347.  
  348.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  349.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  350.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  351.  
  352.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  353.  
  354.   Details Of RPSORT Syntax
  355.  
  356.     There are three types of parameters:
  357.  
  358.     . Those that specify files (i.e inputfile and outputfile).
  359.     . Switches which consist of a slash and a letter plus possibly a file
  360.       name, number or drive letter (e.g /Q, /Eerrfile, /Fnnnn, Td).
  361.     . Sort key definitions each of which defines a single sort key.
  362.  
  363.     The parameters can be entered in any sequence except that:
  364.  
  365.     . The inputfile(s) must always precede the outputfile.
  366.     . The /Q switch (see /Q - Suppressing Copyright And Completion Messages)
  367.       must precede any other parameter.
  368.     . The /Eerrfile switch (see /Eerrfile - Directing Error Messages To A
  369.       File) should precede everything but /Q.
  370.  
  371.     Options For Specifying Input And Output Files
  372.  
  373.       Using RPSORT As A Filter
  374.  
  375.         RPSORT can be used as a filter which reads the standard input and
  376.         writes to the standard output.  For example:
  377.  
  378.               RPSORT   <ipfile   >opfile
  379.  
  380.         The standard output need not be redirected and can go to the screen.
  381.         The standard input must be redirected to a file or piped from the
  382.         output of another program.  RPSORT will not accept an input file
  383.         directly from the keyboard.  If you take the input from the standard
  384.         input then the output MUST go to the standard output.
  385.  
  386.       Specifying Input And Output Files Directly
  387.  
  388.         You can specify the input and output files directly.  Input is one or
  389.         more files separated by plus signs but output must be a single file.
  390.         The filespecs may include a path.  All input files are combined and
  391.         sorted together into the single output file.  Wildcard characters are
  392.         allowed in input filespecs and all files with matching names are
  393.         included.  For example:
  394.  
  395.           RPSORT  IPFILE*.DAT+C:\MYDIR\IP??FILE.DAT   OPFILE.DAT
  396.  
  397.         If the path and filename for the output filespec are the same as that
  398.         for an existing file, the latter will be replaced by the output from
  399.         RPSORT.  If this is what you want, fine but if you don't want to lose
  400.         the existing file then use a different name for the output.
  401.  
  402.  
  403.  
  404.   October 10, 1991             RPSORT Reference                      Page   6
  405.  
  406.  
  407.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  408.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  409.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  410.  
  411.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  412.  
  413.  
  414.     Specifying Lines Or Fixed Length Records
  415.  
  416.       Lines Are The Default
  417.  
  418.         By default, the file is assumed to consist of lines.  A line is a
  419.         sequence of characters terminated by CRLF.  RPSORT also accepts the
  420.         LFCR sequence as a line terminator.  The lines may vary in length
  421.         from null lines up to a maximum length of 32750.  RPSORT will reject
  422.         a file that contains a line longer than this.
  423.  
  424.         If the last record in an input file does not terminate with CRLF or
  425.         LFCR,  RPSORT will append these two characters and display a message
  426.         informing you of its action.
  427.  
  428.         If the input is two or more files, RPSORT will, if necessary, append
  429.         a CRLF to terminate the last line in each of the files.  RPSORT never
  430.         assumes that a line starting in one file continues in the next.
  431.  
  432.         Only character string sort keys are allowed in a file of lines.
  433.         Binary numeric sort keys are not allowed.
  434.  
  435.  
  436.       /Fnnnn - Specifying Fixed Length Records
  437.  
  438.         A file of fixed length records contains records all of the same
  439.         length.  The /Fnnnn switch tells RPSORT that the records are fixed
  440.         length and the value you enter for nnnn specifies the length.  For
  441.         example, /F65 tells RPSORT that the file consists of 65 byte records.
  442.  
  443.         Fixed length records need not end with a CRLF but if they do, those
  444.         two bytes must be included in the length given by the /Fnnnn switch.
  445.  
  446.         The maximum length you may specify is 32750.  RPSORT would reject
  447.         /F32751.
  448.  
  449.         If the last record in the input is shorter than the length given in
  450.         the /Fnnnn switch (i.e. the file length is not an exact multiple of
  451.         nnnn), RPSORT ignores the last record and does not include it in the
  452.         sorted output.  RPSORT displays a message to inform you of its action.
  453.  
  454.         If the input consists of two or more files, RPSORT will skip last
  455.         short records from each of the input files.  RPSORT never assumes
  456.         that a record starting in one file continues in the next.
  457.  
  458.         All key types supported by RPSORT are allowed in a file of fixed
  459.         length records.
  460.  
  461.  
  462.  
  463.   October 10, 1991             RPSORT Reference                      Page   7
  464.  
  465.  
  466.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  467.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  468.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  469.  
  470.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  471.  
  472.  
  473.     Detailed Description Of Sort Key Types Supported By RPSORT
  474.  
  475.       Sort Keys That Are Character Strings
  476.  
  477.         Default Case Insensitive Character Strings
  478.  
  479.           This is the only sequence supported by the DOS SORT.  The digits 0
  480.           through 9 come before the letters.  Lower case letters sort equal
  481.           to upper case letters.  Foreign letters, punctuation and currency
  482.           symbols sort equal to their American English equivalents.
  483.  
  484.         ASCII (Case Sensitive) Character Strings
  485.  
  486.           The sequence is according to the ASCII value assigned to each
  487.           character.  This puts the digits 0 through 9 before any letters and
  488.           puts all of the upper case letters before any of the lower case
  489.           letters.  Foreign letters, punctuation and currency symbols sort
  490.           higher than any of the above.
  491.  
  492.           The ASCII value for each character is the code used internally by
  493.           the computer to represent that character.  An ASCII sort is the
  494.           fastest possible sort because it requires no pre-processing of the
  495.           characters.
  496.  
  497.           You can specify this type of sort key by using either the /A switch
  498.           (see page 11) or the A attribute (see page 12).
  499.  
  500.         C Language Style Character Strings
  501.  
  502.           C language strings are allocated some maximum length in your C
  503.           program.  This should be the length in the sort key definition.
  504.  
  505.           For example, if you define "char mystr[8]" in your C program then
  506.           the compiler allocates 8 bytes and therefore the length specified
  507.           to RPSORT should also be 8.
  508.  
  509.           The actual character string, however, may be shorter.  C language
  510.           strings are terminated by a binary zero if they do not fill the
  511.           allocated space.  Therefore, RPSORT takes the length of a C style
  512.           string to be the lesser of:
  513.  
  514.           . The length attribute (or if absent the default length).
  515.           . The length up to but not including the first binary zero.
  516.  
  517.           You can specify this type of sort key by using either the /C switch
  518.           (see page 11) or the C attribute (see page 12).
  519.  
  520.  
  521.  
  522.   October 10, 1991             RPSORT Reference                      Page   8
  523.  
  524.  
  525.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  526.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  527.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  528.  
  529.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  530.  
  531.  
  532.     Detailed Description Of Sort Key Types Supported By RPSORT (continued)
  533.       Sort Keys That Are Character Strings (continued)
  534.  
  535.         Turbo Pascal Style Character Strings
  536.  
  537.           Turbo Pascal strings are allocated some maximum length in your
  538.           Pascal program.  This should be the length given in the sort key
  539.           definition.
  540.  
  541.           For example, if you define string[8] in your Pascal program then
  542.           the compiler allocates 9 bytes to the string and therefore the
  543.           length specified to RPSORT should also be 9.
  544.  
  545.           The first byte in a Pascal string is a length byte.  This contains
  546.           a binary number which is the actual length of the string.  The
  547.           remaining bytes allow enough room for the longest possible string.
  548.  
  549.           The length must be between 2 and 256 inclusive.  These limits
  550.           correspond to string[1] and string[255] respectively.
  551.  
  552.           If RPSORT finds a length byte value, in the file, that is too large
  553.           (i.e. greater than or equal to the specified length) it aborts.
  554.           This would only occur if the sort key was incorrectly defined.
  555.  
  556.           You can specify this type of sort key by using either the /P switch
  557.           (see page 11) or the P attribute (see page 12).  This type of sort
  558.           key is only allowed for fixed length records.
  559.  
  560.  
  561.       Sort Keys That Are Binary Numbers
  562.  
  563.         Signed Binary Integers
  564.  
  565.           A signed binary integer is a two's complement binary integer that
  566.           is stored low byte first, high byte last.
  567.  
  568.           This is the natural way for an 80X86 CPU to store binary integers.
  569.           As far as I know, all language compilers and interpreters for IBM
  570.           PCs and clones store them this way.
  571.  
  572.           RPSORT allows signed binary integer sort keys to be any length from
  573.           1 up to the length of the record.
  574.  
  575.           You can specify this type of sort key by using the I attribute (see
  576.           page 13).  This type of sort key is only allowed for fixed length
  577.           records.
  578.  
  579.  
  580.  
  581.   October 10, 1991             RPSORT Reference                      Page   9
  582.  
  583.  
  584.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  585.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  586.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  587.  
  588.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  589.  
  590.  
  591.     Detailed Description Of Sort Key Types Supported By RPSORT (continued)
  592.       Sort Keys That Are Binary Numbers (continued)
  593.  
  594.         Unsigned Binary Integers
  595.  
  596.           Unsigned binary integers, just like signed binary integers, are
  597.           stored low byte first, high byte last.
  598.  
  599.           RPSORT allows unsigned binary integer sort keys to be any length
  600.           from 1 up to the length of the record.
  601.  
  602.           You can specify this type of sort key by using the U attribute (see
  603.           page 13).  This type of sort key is only allowed for fixed length
  604.           records.
  605.  
  606.         BASICA And GWBASIC Floating Point Numbers
  607.  
  608.           RPSORT supports binary floating point numbers as defined by the
  609.           BASIC interpreter (prior to MS-DOS v5.0) and older versions of
  610.           Microsoft QuickBASIC (prior to QB v4.0).  The lengths that RPSORT
  611.           will accept for these numbers are:
  612.  
  613.             Length = 4 for single precision numbers.
  614.             Length = 8 for double precision numbers.
  615.  
  616.           You can specify this type of sort key by using the M attribute (see
  617.           page 13) and one of the lengths listed above.  This type of sort
  618.           key is only allowed for fixed length records.
  619.  
  620.         Turbo Pascal Real Numbers
  621.  
  622.           RPSORT supports Turbo Pascal numbers of type "real".  The length
  623.           need not be specified and is always 6.
  624.  
  625.           You can specify this type of sort key by using the T attribute (see
  626.           page 13).  This type of sort key is only allowed for fixed length
  627.           records.
  628.  
  629.           This was the "real" type in the original version of Turbo Pascal
  630.           and is still supported in version 6.0.  To see how to sort the new
  631.           80x87 formats in Turbo Pascal (single, double, extended and comp)
  632.           refer to the table on page 14.  Also see the next section on "Math
  633.           Co-Processor Floating Point Numbers".
  634.  
  635.  
  636.  
  637.   October 10, 1991             RPSORT Reference                      Page  10
  638.  
  639.  
  640.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  641.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  642.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  643.  
  644.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  645.  
  646.  
  647.     Detailed Description Of Sort Key Types Supported By RPSORT (continued)
  648.       Sort Keys That Are Binary Numbers (continued)
  649.  
  650.         Math Co-Processor Floating Point Numbers
  651.  
  652.           RPSORT supports three types of math co-processor (i.e. 80x87)
  653.           floating point numbers.  The table below gives the lengths and
  654.           names assigned to them by Intel and by three popular compilers.
  655.  
  656.            Length    Intel         QuickBasic    Turbo Pascal    Turbo C
  657.            ------    ----------    ----------    ------------    -------
  658.               4      short real    single        single          float
  659.               8      long  real    double        double          double
  660.              10      temp  real    N/A           extended        long double
  661.  
  662.           You can specify this type of sort key by using the F attribute (see
  663.           page 13) and one of the lengths listed above.  This type of sort
  664.           key is only allowed for fixed length records.
  665.  
  666.           RPSORT does not require a math co-processor to sort numbers of this
  667.           type and does not use the 80x87 even if it is present.
  668.  
  669.           Zero values returned by an 80x87 are marked as either a +0 or a -0.
  670.           Some zero values arise from underflow.  This occurs if a result is
  671.           too small (i.e. has too negative an exponent) for the given numeric
  672.           format (short real, long real or temp real).  The 80x87 returns a
  673.           zero result but keeps the sign of the small number.
  674.  
  675.           RPSORT sorts minus zeros as less than plus zeros.  I could call
  676.           this a deliberate feature in that it reflects as best as possible
  677.           the true sequence of very small results but actually it's a natural
  678.           consequence of the way I do the sort.
  679.  
  680.           A result can be too large for the given numeric format.  This is
  681.           called overflow.  Most compilers generate an error and do not store
  682.           store a result but an 80x87 can return special values denoting
  683.           plus and minus infinity.  RPSORT sorts plus infinity higher than
  684.           any other value and minus infinity as lower than any other value.
  685.  
  686.           The 80x87 also generates special values for error conditions (e.g.
  687.           taking the square root of a negative number).  Any compiler would
  688.           generate an error rather than store such values.  Still, RPSORT
  689.           must do something if it finds them.  I sort them the same as plus
  690.           or minus infinity depending on their sign.
  691.  
  692.  
  693.  
  694.   October 10, 1991             RPSORT Reference                      Page  11
  695.  
  696.  
  697.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  698.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  699.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  700.  
  701.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  702.  
  703.  
  704.     Defining The Desired Sort Sequence To RPSORT
  705.  
  706.       Standard Defaults For Sort Keys
  707.  
  708.         The following defaults are used by RPSORT unless you specify other
  709.         defaults (see "Switches Which Set Defaults For Sort Keys") or specify
  710.         different attributes in the sort key definition for a sort key (see
  711.         "Defining Sort Keys").
  712.  
  713.         . The sort key consists of the entire record/line.
  714.  
  715.         . The sort key is a character string to be sorted per the same case
  716.           insensitive sequence used by the DOS SORT.  Digits 0 through 9
  717.           precede the letters.  Lower case letters sort equal to upper case.
  718.           Foreign letters,  punctuation and currency symbols sort equal to
  719.           their American English equivalents.
  720.  
  721.         . The sort will be in ascending (low to high) sequence.
  722.  
  723.  
  724.       Switches Which Set Defaults For Sort Keys
  725.  
  726.         These switches change some of the defaults for sort keys.  They can't
  727.         be over-ridden by individual sort key definitions.  Use them only if
  728.         you want all your sort keys to have the same attributes.  The /C and
  729.         /P switches may be of particular interest to computer programmers.
  730.  
  731.         The /A, /C and /P switches apply to all character string sort keys
  732.         (i.e. they apply to any sort key that is not defined as being a
  733.         binary numeric type).  /C and /P are mutually exclusive but either
  734.         may be used in conjunction with /A.
  735.  
  736.         /A  makes the ASCII (case sensitive) sequence the default.  Digits 0
  737.             through 9 precede the letters and all upper case letters precede
  738.             any lower case letters.  The sequence is per the ASCII code for
  739.             each character.
  740.  
  741.         /C  says that all string keys are C language character strings.  See
  742.             page 7 for a description of C style strings.
  743.  
  744.         /P  says that all string keys are Turbo Pascal type strings.  See
  745.             page 8 for a description of Pascal style strings.  The /P switch
  746.             is only allowed for fixed length records.
  747.  
  748.         /R  specifies a reverse sort.  The sort will be in descending (high
  749.             to low) sequence.  /R applies to all the sort keys you define.
  750.  
  751.  
  752.  
  753.   October 10, 1991             RPSORT Reference                      Page  12
  754.  
  755.  
  756.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  757.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  758.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  759.  
  760.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  761.  
  762.  
  763.       Defining Sort Keys
  764.  
  765.         Sort Key Definition Syntax
  766.  
  767.           If no sort key definitions are given, RPSORT assumes a single
  768.           default sort key (see "Standard Defaults For Sort Keys" and
  769.           "Switches Which Set Defaults For Sort Keys").
  770.  
  771.           You may specify as many sort key definitions as you like provided
  772.           that they fit within the command line (maximum of 127 bytes).  Sort
  773.           key definitions consist of a /+ followed by a list of attributes
  774.           with no spaces between them.  You may, however, use spaces to
  775.           separate one sort key definition from another or from a switch.
  776.  
  777.           All attributes are optional.  A sort key definition may be just /+,
  778.           which gets you the same default sort key as when no sort key
  779.           definitions are specified.  The following describes each of the
  780.           attributes:
  781.  
  782.           col  is the starting column for the key.  This must be at least 1
  783.                but no more than 32750.  For fixed length records, the maximum
  784.                is the largest column such that there is enough room in the
  785.                remainder of the record to hold the minimum legitimate key
  786.                length for the given key type.
  787.  
  788.          :len  is the length for this key (e.g. a seven byte key would be
  789.                indicated by :7).  The legitimate values for len depend on the
  790.                type of the sort key.
  791.  
  792.           R    specifies a reverse sort for this key.  The sequence will be
  793.                in descending (high to low) sequence.
  794.  
  795.           The next three attributes are used for character string keys.  C
  796.           and P are mutually exclusive but either may be used with A.  C and
  797.           P may be of interest to computer programmers.
  798.  
  799.           A    does an ASCII (case sensitive) sort for the key.  The digits 0
  800.                through 9 precede the letters and all upper case letters
  801.                precede any of the lower case letters.
  802.  
  803.           C    says that this key is a C language character string.  See page
  804.                7 for a description of C style strings.
  805.  
  806.           P    says that this key is a Turbo Pascal character string.  See
  807.                page 8 for a description of Pascal style character strings.
  808.                The P attribute is only allowed for fixed length records.
  809.  
  810.  
  811.  
  812.   October 10, 1991             RPSORT Reference                      Page  13
  813.  
  814.  
  815.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  816.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  817.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  818.  
  819.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  820.  
  821.  
  822.       Defining Sort Keys (continued)
  823.         Sort Key Definition Syntax (continued)
  824.  
  825.           The next five attributes define binary numeric type keys which are
  826.           only allowed for fixed length records.  They are mutually exclusive.
  827.           These attributes may be of interest to computer programmers.
  828.  
  829.           The table on page 14 lists some programming language compilers and
  830.           interpreters and indicates the appropriate type and length
  831.           attributes to be used for each of their binary numeric data types.
  832.  
  833.           I    sorts this key as a signed binary integer.  These may be any
  834.                length.  See page 8 for additional details.
  835.  
  836.           U    sorts this key as an unsigned binary integer.  These may be
  837.                any length.  See page 9 for additional details.
  838.  
  839.           F    sorts this key as a binary floating point number of the type
  840.                produced by a math co-processor (i.e. an 80x87).  RPSORT
  841.                supports three precisions for 80x87 floating point numbers.
  842.                The table below gives the lengths for each precision and the
  843.                names assigned to them by Intel and three popular compilers.
  844.  
  845.                 Length   Intel        QuickBasic   Turbo Pascal   Turbo C
  846.                 ------   ----------   ----------   ------------   -------
  847.                    4     short real   single       single         float
  848.                    8     long  real   double       double         double
  849.                   10     temp  real   N/A          extended       long double
  850.  
  851.                RPSORT does not require a math co-processor to sort numbers of
  852.                this type and does not use the 80x87 even if it is present.
  853.  
  854.                See page 10 for additional details concerning math
  855.                co-processor floating point numbers.
  856.  
  857.           M    sorts this key as a binary floating point number as defined by
  858.                the BASIC interpreter (prior to MS-DOS v5.0) and older
  859.                versions of Microsoft QuickBASIC (prior to QB v4.0).  The len
  860.                attribute can be 4 or 8.
  861.  
  862.                Use len = 4 for single precision numbers.
  863.                Use len = 8 for double precision numbers.
  864.  
  865.           T    sorts this key as a Turbo Pascal number of type "real".  The
  866.                len parameter need not be specified and is 6 by default. See
  867.                page 9 for additional details.
  868.  
  869.  
  870.  
  871.   October 10, 1991             RPSORT Reference                      Page  14
  872.  
  873.  
  874.   The following table lists the type and length attributes for the binary
  875.   numeric types available in a few programming language compilers and
  876.   interpreters.
  877.  
  878.   If you are using a compiler that is not in this table, you should review
  879.   the previous pages along with the programmers guide for your compiler to
  880.   see if any of the binary numeric types supported by RPSORT match those
  881.   available with your compiler.
  882.  
  883.   Compiler Or Interpreter       Number Type  Type Attribute  Length Attribute
  884.   -----------------------       -----------  --------------  ----------------
  885.   Microsoft QuickBASIC          Integer             I                2
  886.    v4.0 and later &             Long                I                4
  887.   Microsoft QBASIC              Single              F                4
  888.                                 Double              F                8
  889.  
  890.   Microsoft QuickBASIC          Integer             I                2
  891.    v3.0, 8087                   Single              F                4
  892.                                 Double              F                8
  893.  
  894.   IBM BASICA &                  Integer             I                2
  895.   Microsoft GWBASIC &           Single              M                4
  896.   Microsoft QuickBASIC          Double              M                8
  897.    v1.0, v2.0 and v3.0 non-8087
  898.  
  899.   Turbo Pascal                  Shortint            I                1
  900.    v4.0 and later               Integer             I                2
  901.                                 Longint             I                4
  902.                                 Byte                U                1
  903.                                 Word                U                2
  904.                                 Real                T                6
  905.                                 Single              F                4
  906.                                 Double              F                8
  907.                                 Extended            F               10
  908.                                 Comp                I                8
  909.  
  910.   Turbo Pascal                  Integer             I                2
  911.    v3.0 8087                    Byte                U                1
  912.                                 Real                F                8
  913.  
  914.   Turbo Pascal                  Integer             I                2
  915.    v1.0, v2.0 and v3.0 non-8087 Byte                U                1
  916.                                 Real                T                6
  917.  
  918.   Borland/Turbo C               signed char         I                1
  919.                                 unsigned int        U                2
  920.                                 short int           I                2
  921.                                 int                 I                2
  922.                                 unsigned long       U                4
  923.                                 long                I                4
  924.                                 float               F                4
  925.                                 double              F                8
  926.                                 long double         F               10
  927.  
  928.  
  929.  
  930.   October 10, 1991             RPSORT Reference                      Page  15
  931.  
  932.  
  933.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  934.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  935.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  936.  
  937.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  938.  
  939.  
  940.     Miscellaneous Switches
  941.  
  942.       /Q - Suppressing Copyright And Completion Messages.
  943.  
  944.          The /Q switch, if it is the first parameter, suppresses display of:
  945.  
  946.          . The Copyright message when the sort starts.
  947.          . The "Sort successfully completed." message after successful sort.
  948.  
  949.          Error messages, if any, will still be displayed.
  950.  
  951.       /Eerrfile - Directing Error Messages To A File.
  952.  
  953.          This switch directs error and successful completion messages to the
  954.          file designated by errfile instead of the screen.  For example:
  955.  
  956.                 /Ec:\mydir\myerrors
  957.  
  958.          Specify /Enul to send error messages to the DOS NUL file which means
  959.          nowhere.  Only the /Q switch, if any, should precede the /E switch.
  960.  
  961.       /B - Ignoring Control Breaks Entered From The Keyboard.
  962.  
  963.          Tells RPSORT to ignore Ctrl-Break from the keyboard.  This would be
  964.          useful if you setup a batch file which includes RPSORT and you don't
  965.          want the users of the batch file to be able to interrupt RPSORT.
  966.  
  967.       /D - Delete Records Whose Sortkeys Duplicate Those In A Previous Record
  968.  
  969.          Tells RPSORT to delete any records/lines whose sort keys duplicate
  970.          those in a previous one.  This deletes records/lines even if they
  971.          are not identical to a previous one since all that is required is
  972.          that the sort keys be the same.
  973.  
  974.          To only delete identical records/lines, tack on /+a as the last sort
  975.          key.  This produces an equal compare only for identical
  976.          records/lines.  For example:
  977.  
  978.                 RPSORT /D /+1:2
  979.  
  980.          deletes any lines whose first two bytes equal those on a previous
  981.          line, while
  982.  
  983.                 RPSORT /D /+1:2 /+a
  984.  
  985.          deletes only lines that are identical to a previous line.
  986.  
  987.  
  988.  
  989.   October 10, 1991             RPSORT Reference                      Page  16
  990.  
  991.  
  992.   Usage:  RPSORT  [/Q]  [/Eerrfile]  [/]?  [inputfile[+inputfile]]
  993.                   [outputfile]  [/A]  [/B]  [/C]  [/D]  [/Fnnnn]  [/N]  [/P]
  994.                   [/R]  [/Td]  [/Z]  [sort key defin. . .]
  995.  
  996.   Sort key defin syntax:  /+ [col] [:len] [A] [C] [F] [I] [M] [P] [R] [T] [U]
  997.  
  998.  
  999.     Miscellaneous Switches (continued)
  1000.  
  1001.       /N - Delete Null Lines
  1002.  
  1003.          This switch deletes all null lines (i.e. lines consisting only of a
  1004.          CRLF).  Lines that are all spaces and thus look like null lines when
  1005.          you list them will not be deleted.  This switch is not allowed for
  1006.          fixed length records for which it would be meaningless.
  1007.  
  1008.  
  1009.       /Td - Designate Drive To Be Used For Temporary Files.
  1010.  
  1011.          Given enough memory, RPSORT loads the entire input into memory,
  1012.          sorts it and writes the sorted data to the output file.  In such
  1013.          cases, RPSORT does not need to create any temporary files.
  1014.  
  1015.          If the input is larger than the available memory, RPSORT reads the
  1016.          file a chunk at a time, sorts each chunk and writes the sorted
  1017.          chunks to a temporary file.  RPSORT then does one or more merge
  1018.          phases to combine the chunks into a single sorted output file.
  1019.  
  1020.          RPSORT normally puts temporary files on the default drive.  The /T
  1021.          switch lets you to specify an alternate drive.  For example:
  1022.  
  1023.             /TC
  1024.  
  1025.          puts the temporary file(s) on your C drive.  See the section on
  1026.          "Efficiency Considerations" for more details.
  1027.  
  1028.  
  1029.       /Z - Ignore Ctrl-Z In Text File.  Use Entire Physical File.
  1030.  
  1031.          RPSORT (just like MS-DOS) treats Ctrl-Z as the end of a text file.
  1032.          This is usually the correct thing to do since Ctrl-Z, if present,
  1033.          normally follows the last byte of actual data.
  1034.  
  1035.          Sometimes, however, one or more Ctrl-Zs occur in the middle of a
  1036.          text file.  Files downloaded from bulletin boards may contain
  1037.          garbage characters (such as Ctrl-Z) due to a noisy line.  If you
  1038.          sort such a file, the sorted output is shorter than the original
  1039.          file because RPSORT uses only part of the input.
  1040.  
  1041.          The /Z switch tells RPSORT to ignore Ctrl-Zs and to use the entire
  1042.          input.  RPSORT deletes any Ctrl-Zs except for one at the end of the
  1043.          file.  /Z is not applicable to fixed length records where Ctrl-Z has
  1044.          no special meaning and is just taken as another data byte.
  1045.  
  1046.  
  1047.  
  1048.   October 10, 1991             RPSORT Reference                      Page  17
  1049.  
  1050.  
  1051.   Efficiency Considerations
  1052.  
  1053.     Do ASCII Sort If Text Keys Are All Upper Case Or All Lower Case
  1054.  
  1055.       An ASCII sort puts text keys in order according to the ASCII code
  1056.       assigned each of the characters.  This is the fastest possible sort
  1057.       because RPSORT can sequence records by directly comparing the sort keys
  1058.       without having to pre-process them in any way.
  1059.  
  1060.       If a file contains both upper and lower case letters and you want all
  1061.       the keys starting with a lower case "a" to be together with the keys
  1062.       starting with an upper case "A" and so on, then you can't do an ASCII
  1063.       sort and must do a case insensitive sort.
  1064.  
  1065.       However, if your file contains only upper case letters (or if it
  1066.       contains only lower case letters) then an ASCII sort will acheive the
  1067.       the same result as a case insensitive sort but will be faster.  You
  1068.       specify an ASCII sort either by using the A attribute in each sort key:
  1069.  
  1070.         RPSORT  /+1:5A  /+12:7A  INPUT.DAT  OUTPUT.DAT
  1071.  
  1072.       or by using the /A switch:
  1073.  
  1074.         RPSORT  /A  /+1:5  /+12:7  INPUT.DAT  OUTPUT.DAT
  1075.  
  1076.       If your files contain foreign letters, punctuation or currency symbols
  1077.       and you want these to sort the same as their American English
  1078.       equivalents then you must do a case insensitive sort.
  1079.  
  1080.  
  1081.  
  1082.   October 10, 1991             RPSORT Reference                      Page  18
  1083.  
  1084.  
  1085.   Efficiency Considerations (continued)
  1086.  
  1087.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space
  1088.  
  1089.       The amount of memory (I mean conventional memory not Expanded or
  1090.       Extended memory) affects RPSORT's speed in the following ways:
  1091.  
  1092.       . If memory is big enough or conversely the file is small enough to do
  1093.         the sort in memory, in one pass, then the sort will be optimally fast.
  1094.  
  1095.       . Otherwise the input must be sorted a chunk at a time with the chunks
  1096.         being written to a temp file.  Then one or more merge phases will be
  1097.         required to combine the chunks.  If memory is very small and many
  1098.         merge phases are required, RPSORT would slow down dramatically.
  1099.  
  1100.       The following pages contain a lot of nitty gritty detail about the
  1101.       conditions which force RPSORT to use temp disk space and how much temp
  1102.       disk space it might need.  You can ignore these details if your
  1103.       situation meets either of the following conditions:
  1104.  
  1105.       . No temp files are needed if the free memory (see "Using CHKDSK Or MEM
  1106.         To Determine Free Memory" below) equals the input size plus twice the
  1107.         line/record count plus 70,000.  A 10,000 line 400,000 byte file
  1108.         requires 400,000 plus (2 * 10,000) plus 70,000 or a total of 490,000
  1109.         bytes of free memory to sort the input without using temp disk space.
  1110.  
  1111.       . If the drive assigned to hold temp files (either the default drive or
  1112.         the drive specified in the /T switch) has twice as much space as the
  1113.         size of the input file, this will always be sufficient.
  1114.  
  1115.  
  1116.       Using CHKDSK Or MEM To Determine Free Memory
  1117.  
  1118.         To determine the amount of free memory in your system, use the CHKDSK
  1119.         command which gives you a display something like:
  1120.  
  1121.                 362496 bytes total disk space
  1122.                  53248 bytes in 2 hidden files
  1123.                 303104 bytes in 36 user files
  1124.                   6144 bytes available on disk
  1125.  
  1126.                 655360 bytes total memory
  1127.                 581168 bytes free
  1128.  
  1129.         The free memory is on the last line (581168 in this example).  If you
  1130.         own MS-DOS 5.0 you can use the MEM command and get something like:
  1131.  
  1132.                 655360 bytes total conventional memory
  1133.                 655360 bytes available to MS-DOS
  1134.                 564288 largest executable program size
  1135.  
  1136.         Here the free memory appears on the "largest executable program size"
  1137.         line (564288 in this case).
  1138.  
  1139.  
  1140.  
  1141.   October 10, 1991             RPSORT Reference                      Page  19
  1142.  
  1143.  
  1144.   Efficiency Considerations (continued)
  1145.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space (cont.)
  1146.  
  1147.       Sorts Requiring No Merge Phase And No Temporary Files
  1148.  
  1149.         If possible, RPSORT will do a sort in a single pass without requiring
  1150.         any temporary files.  Use the following steps to determine whether a
  1151.         given file can be sorted in a single pass:
  1152.  
  1153.         . First determine the amount of free memory (called FREEMEM below).
  1154.           See "Using CHKDSK Or MEM To Determine Free Memory" above.
  1155.  
  1156.         . Then the memory space required, by RPSORT, for the input equals:
  1157.  
  1158.             File Size  +  Twice The Number Of Records/Lines In The File
  1159.  
  1160.           This sum is called FILESPACE below.  For example, if the file size
  1161.           were 453,868 bytes and it consisted of 8,323 lines then FILESPACE
  1162.           would equal 453,868 + 8,323 + 8,323 or 470,514 bytes.
  1163.  
  1164.         . RPSORT also requires some memory for itself and for buffers and
  1165.           tables.  This depends on the size of FREEMEM:
  1166.  
  1167.           . If FREEMEM exceeds 170,000 bytes RPSORT reserves 70,000 bytes.
  1168.             In this case, a file can be sorted in one pass if:
  1169.  
  1170.               FILESPACE  is less than    FREEMEM - 70,000
  1171.  
  1172.           . If FREEMEM is less than 170,000 bytes then RPSORT reserves 18,000
  1173.             bytes plus one-third of the remainder of FREEMEM for itself.
  1174.             This means that a file can be sorted in a single pass if:
  1175.  
  1176.                                            2 * (FREEMEM - 18,000)
  1177.               FILESPACE  is less than      ----------------------
  1178.                                                       3
  1179.  
  1180.           . If FREEMEM is less than approximately 30,000 bytes, then RPSORT
  1181.             will be unable to do the sort at all.
  1182.  
  1183.  
  1184.  
  1185.   October 10, 1991             RPSORT Reference                      Page  20
  1186.  
  1187.  
  1188.   Efficiency Considerations (continued)
  1189.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space (cont.)
  1190.  
  1191.       Sorts Requiring One Merge Phase And One Temporary File
  1192.  
  1193.         When a single pass sort is not possible, RPSORT breaks up the file
  1194.         into "chunks" and sorts each chunk separately.  Then it merges these
  1195.         chunks to produce the sorted output.  Use the following steps to
  1196.         check whether a file can be sorted with a single merge phase using
  1197.         only a single temporary file the same size as the input file:
  1198.  
  1199.         . Compute FREEMEM and FILESPACE as described in the previous section.
  1200.  
  1201.         . Then compute the number of chunks (called #CHUNKS below) as
  1202.           follows and round up to the next higher integer:
  1203.  
  1204.           . If FREEMEM exceeds 170,000 bytes then:
  1205.  
  1206.                               FILESPACE
  1207.                #CHUNKS  =  ----------------
  1208.                            FREEMEM - 70,000
  1209.  
  1210.           . If FREEMEM is less than 170,000 then:
  1211.  
  1212.                               3 * FILESPACE
  1213.                #CHUNKS  =  ----------------------
  1214.                            2 * (FREEMEM - 18,000)
  1215.  
  1216.         . Now compute the maximum number of chunks that RPSORT can merge at
  1217.           one time (called MAXMERGE below) as follows and round down to the
  1218.           next lower integer:
  1219.  
  1220.           . If FREEMEM exceeds 315,000 then:
  1221.  
  1222.                             FREEMEM - 50,000
  1223.                MAXMERGE  =  ----------------
  1224.                                  16,000
  1225.  
  1226.           . If FREEMEM exceeds 90,000 but is less than 315,000 then:
  1227.  
  1228.                MAXMERGE  =  16
  1229.  
  1230.           . If FREEMEM is less than 90,000 then:
  1231.  
  1232.                             8 * (FREEMEM - 18,000)
  1233.                MAXMERGE  =  ----------------------
  1234.                                    36,000
  1235.  
  1236.         . If #CHUNKS is less than or equal to MAXMERGE, then RPSORT will do a
  1237.           single merge phase sort using a single temp file the same size as
  1238.           the input file.
  1239.  
  1240.  
  1241.  
  1242.   October 10, 1991             RPSORT Reference                      Page  21
  1243.  
  1244.  
  1245.   Efficiency Considerations (continued)
  1246.     How Memory Size Affects RPSORT Speed And Need For Temp Disk Space (cont.)
  1247.  
  1248.       Sorts Requiring Two Or More Merge Phases And Two Temporary Files
  1249.  
  1250.         If necessary, RPSORT will do a multiple merge phase sort.  This
  1251.         requires two temporary files each the size of the input file.
  1252.  
  1253.         Actually, RPSORT doesn't abruptly go to a full second merge phase if
  1254.         it can't do the sort in one merge phase.  If #CHUNKS is less than
  1255.         twice MAXMERGE it does a one and a fraction merge phase sort.  The
  1256.         first temp file (TEMP1) will be the same size as the input but the
  1257.         second (TEMP2) will be smaller as follows:
  1258.  
  1259.                              #CHUNKS - MAXMERGE + 1
  1260.           Size of TEMP2  =   ----------------------  *  Size of input file
  1261.                                     #CHUNKS
  1262.  
  1263.  
  1264.     Deciding What Drives To Put Temporary And Output Files On
  1265.  
  1266.       Reading one file and writing another file concurrently on the same
  1267.       drive is generally inefficient because it requires that the drive head
  1268.       assembly constantly move back and forth between the two files.  This
  1269.       can slow things down significantly.
  1270.  
  1271.       RPSORT always finishes reading the input file before it starts writing
  1272.       the output file.  This means there is no loss of efficiency if the
  1273.       input and output are on the same drive.  Of course there must be enough
  1274.       room on this drive to hold the output file.
  1275.  
  1276.       If a sort requires temporary files they are written at the same time as
  1277.       the input file is read.  Similarly, temporary files are read at the
  1278.       same time as the output file is written.  The drive assigned for
  1279.       temporary files must have enough space to hold the entire input and in
  1280.       some cases twice that much.  Temp files go to the default drive but you
  1281.       can over-ride this with the /T switch.
  1282.  
  1283.       If you have a big enough RAM disk, you should consider putting the temp
  1284.       files there.  This could markedly enhance the performance of RPSORT.
  1285.  
  1286.       If you don't use a RAM disk, you should assign temp files to a drive
  1287.       other than the ones on which the input and output files reside.  This
  1288.       dictum is not absolute, however, as indicated by the following:
  1289.  
  1290.       . If you have only one hard drive and both the input and output files
  1291.         reside there, you are better off putting the temp files on the same
  1292.         hard drive than on a floppy.
  1293.  
  1294.       . If you are short of disk space, putting the temp files and the output
  1295.         file on the same drive could help because the output file might be
  1296.         able to reuse part of the space allocated to temp files.
  1297.  
  1298.  
  1299.  
  1300.   October 10, 1991             RPSORT Reference                      Page  22
  1301.  
  1302.  
  1303.   Efficiency Considerations (continued)
  1304.  
  1305.     Buffers Command In Your Config.Sys
  1306.  
  1307.       MS-DOS allocates disk buffers in memory to support read and write
  1308.       operations.  The buffers are usually 512 bytes each.  MS-DOS allocates
  1309.       10 or 15 buffers depending on whether your system has less or more than
  1310.       512K of memory.  Some applications run faster with a larger number of
  1311.       buffers.  You specify this in your config.sys file.  For example:
  1312.  
  1313.         BUFFERS=30
  1314.  
  1315.       On my computer (a 10Mhz 286 with a slow hard disk):
  1316.  
  1317.       . Sorting a modest size file (say up to a megabyte) speeds up little
  1318.         if at all when I increase the number of buffers.
  1319.  
  1320.       . Sorting a large file (say a few megabytes), speeds up a very few
  1321.         percent with BUFFERS=20.
  1322.  
  1323.       . BUFFERS=30 produces an additional small improvement for very large
  1324.         files (upwards of ten megabytes).
  1325.  
  1326.       To fine tune the performance of RPSORT on your system, sort files of
  1327.       the type and size typical for you and test the effect of various BUFFER
  1328.       values.  In any case, you probably will use the number of buffers that
  1329.       is optimal for your principal applications not for RPSORT.
  1330.  
  1331.  
  1332.     Using Disk Cache Programs
  1333.  
  1334.       Disk cache programs (like SMARTDRV.SYS which is distributed as part of
  1335.       MS-DOS 5.0 package) set aside an area of memory called the disk cache.
  1336.       Typically the disk cache is allocated in expanded or extended memory
  1337.       and may be quite large (i.e. a megabyte or more).
  1338.  
  1339.       Disk cache programs intercept accesses to disk and retain data from
  1340.       the disk, in the cache.  If the data is required later on, the disk
  1341.       cache program can provide the data from memory rather than having to go
  1342.       to the disk drive which would be much slower.
  1343.  
  1344.       If the retained data is needed often enough then the performance of
  1345.       your system will improve.  Otherwise, your system may slow down due to
  1346.       the overhead of the disk cache program.
  1347.  
  1348.       I can't make any definitive statement as to how disk cache programs
  1349.       might improve or degrade the performance of your system.
  1350.  
  1351.       If you contemplate using a disk cache program, I suggest that you
  1352.       perform experiments with caches of different sizes and possibly with
  1353.       different cache programs.  These experiments should include the entire
  1354.       range of activities you perform on your system.
  1355.  
  1356.  
  1357.  
  1358.   October 10, 1991             RPSORT Reference                      Page  23
  1359.  
  1360.  
  1361.   Special Situations
  1362.  
  1363.     Sorting Files That Contain Tabs
  1364.  
  1365.       If the input file contains tabs, they may need to be expanded to the
  1366.       proper number of spaces to align your sort keys.  RPSORT can't sort
  1367.       such a file correctly because it doesn't expand tabs.
  1368.  
  1369.       As a convenience, I have included a program called RPTAB.  It reads
  1370.       your file and produces an output file that is the same except that the
  1371.       tabs have been expanded.  The syntax is:
  1372.  
  1373.         RPTAB  input-filespec  output-filespec  [tabstop...]
  1374.  
  1375.       The parameters must be given in the order defined above.  Listing tab
  1376.       stops is optional.  If you specify none, the default tab stops are at
  1377.       positions 1, 9, 17, 25, 33... and so on at intervals of eight columns.
  1378.  
  1379.       If you specify tab stops they must be a sequence of integers each
  1380.       greater than the preceding one.  The first tab stop is always column 1
  1381.       and need not be given.  The interval between the last two explicit tab
  1382.       stops implies subsequent tab stops at the same interval.
  1383.  
  1384.       The following command expands tabs to the default tab stops:
  1385.  
  1386.            RPTAB   MYTABS.DAT   MYSPACES.DAT
  1387.  
  1388.       The following command says that tab stops are at positions 1, 6, 15,
  1389.       27, 39, 51... etc.  The interval of 12 between 15 and 27 is propagated
  1390.       to subsequent tab stops:
  1391.  
  1392.            RPTAB   MYTABS.DAT   MYSPACES.DAT   6  15  27
  1393.  
  1394.       After creating MYSPACES.DAT as in the above examples, you could use
  1395.       RPSORT to sort it in the usual way.
  1396.  
  1397.       You can also use RPTAB for the reverse operation.  This means to
  1398.       replace spaces by tabs whenever possible.  The syntax is:
  1399.  
  1400.         RPTAB  /T input-filespec  output-filespec  [tabstop...]
  1401.  
  1402.       The syntax is identical except for the addition of the /T switch.  If
  1403.       you have a text file with a lot of spaces, RPTAB can reduce its size
  1404.       while leaving it readable by many text processing utilities.
  1405.  
  1406.       This package includes the source code for RPTAB in the file RPTAB.PAS.
  1407.       It is written in Turbo Pascal and compiled with the version 6.0.  You
  1408.       may modify RPTAB in any way you choose.  Please!  Please! do not
  1409.       distribute any modified version under my name.
  1410.  
  1411.       RPTAB.PAS consists of Pascal statements and assembly language
  1412.       sub-routines.  The latter were written using Turbo Pascal's inline
  1413.       assembler (a very useful addition by Borland).
  1414.  
  1415.  
  1416.  
  1417.   October 10, 1991             RPSORT Reference                      Page  24
  1418.  
  1419.  
  1420.   Special Situations (continued)
  1421.  
  1422.     Writing The Output To The File That Contained The Input
  1423.  
  1424.       Nothing stops you from specifying the same file as both input and
  1425.       output in a RPSORT command.  It is dangerous but it can be beneficial
  1426.       in some circumstances.
  1427.  
  1428.       It is possible to do this is because RPSORT never starts writing the
  1429.       output file until after it has finished reading the input file.
  1430.       Therefore it will not destroy the input before it has read it.
  1431.  
  1432.       The danger is that after RPSORT has started writing the output file but
  1433.       before it has finished, your system may go down due possibly to a power
  1434.       failure or a software or hardware problem or whatever.  In this case
  1435.       the input would be destroyed and the output would not yet exist.  This
  1436.       would mean the loss of your data unless you had backed up your file or
  1437.       it could be recreated in some way.
  1438.  
  1439.       The benefit is realized when you must put the output file on the same
  1440.       drive as the input file but there is not enough space, on the drive, to
  1441.       hold both.  By using the same file for input as for output you would
  1442.       re-use the same disk space and thus might be able to do a sort that
  1443.       otherwise you could not do.  Once again, don't do this unless you have
  1444.       backed up your data or you have some relatively easy way to recover it.
  1445.  
  1446.       None of the above applies if RPSORT is being used as a filter.  In that
  1447.       case if the output file is the same as the input then the input file
  1448.       will be destroyed by DOS before RPSORT even starts executing.
  1449.  
  1450.   Two Incompatibilities With The DOS SORT
  1451.  
  1452.     Their are two exceptions to the statement that any command that works
  1453.     with the DOS SORT will produce the same result with RPSORT:
  1454.  
  1455.     . RPSORT will not let you type the input file from the keyboard.
  1456.  
  1457.     . The DOS SORT tacks the CRLF, that ends a line, onto the sort key.
  1458.       RPSORT doesn't.  Thus, RPSORT sorts null lines to the beginning of a
  1459.       file.  The DOS SORT precedes them with any line whose sort key starts
  1460.       with a character like tab or formfeed whose ASCII value is less than
  1461.       that for CR.
  1462.  
  1463.  
  1464.  
  1465.   October 10, 1991             RPSORT Reference                      Page  25
  1466.  
  1467.  
  1468.   Error Messages
  1469.  
  1470.     Error Numbers And Return Codes
  1471.  
  1472.       Each type of error that RPSORT can detect has been assigned an error
  1473.       number which appears in the corresponding error message.  For example:
  1474.  
  1475.         ERROR 049: No room on disk to write sorted output file.
  1476.  
  1477.       When RPSORT terminates, it sets the "errorlevel" return code as follows:
  1478.  
  1479.       . If the sort was successful, RPSORT sets the return code to zero.
  1480.  
  1481.       . If one or more syntax errors are discovered,  the relevant error
  1482.         messages are displayed and the sort is terminated.  The return code
  1483.         is set to the error number for the first error detected.
  1484.  
  1485.       . If an error is discovered while executing the sort (typically some
  1486.         kind of input, output or insufficient memory error), the appropriate
  1487.         error message is displayed and the return code is set to the error
  1488.         number for that error.
  1489.  
  1490.         The error numbers are broken down into groups as follows:
  1491.  
  1492.           Error Number Group        Range Of Error Numbers
  1493.           ----------------------    ----------------------
  1494.           Syntax Errors                      1 - 34
  1495.           DOS Version Before 2.0                 37
  1496.           Insufficient Memory               40 - 41
  1497.           Line/String Too Long Errors       43 - 44
  1498.           Input/Output Errors               46 - 54
  1499.  
  1500.          There are also a number of error messages with error numbers in the
  1501.          range 59 through 74 which should never happen.  Any of these could
  1502.          imply a bug in RPSORT.
  1503.  
  1504.          If you run RPSORT from a batch file, you can test the return codes
  1505.          in statements like:
  1506.  
  1507.            IF  ERRORLEVEL  1  GOTO SORTERR
  1508.  
  1509.          This would catch any return code greater than or equal to one and
  1510.          thus any error at all.  Another example:
  1511.  
  1512.            IF  ERRORLEVEL  40  GOTO EXECERR
  1513.  
  1514.          This would catch any return code greater than or equal to 40 and
  1515.          thus any sort execution error.
  1516.  
  1517.  
  1518.  
  1519.   October 10, 1991             RPSORT Reference                      Page  26
  1520.  
  1521.  
  1522.   Error Messages (continued)
  1523.  
  1524.     Syntax Error Messages
  1525.  
  1526.       When RPSORT parses the command line it displays messages for any syntax
  1527.       errors it finds.  It always parses the complete command line and
  1528.       therefore may report several errors.  Many error messages display the
  1529.       bad parameter at the end of the message.  For example:
  1530.  
  1531.         ERROR 019: Only one keylength allowed: "/13:5:7"
  1532.  
  1533.       In the message listing below, the quoted word "badparm" stands for the
  1534.       bad parameter that RPSORT is complaining about.
  1535.  
  1536.       RPSORT never executes the sort if it finds syntax errors but instead
  1537.       terminates immediately after displaying the last error message.
  1538.  
  1539.       The list of syntax error messages follows:
  1540.  
  1541.       ERROR 001: Slash (/) must be followed by a parameter.
  1542.  
  1543.         A slash was followed by a space.  Slash must always be followed by
  1544.         one of the switch characters or it must start a sort key definition.
  1545.  
  1546.       ERROR 002: Illegal parameter: "badparm"
  1547.  
  1548.         This message is displayed when RPSORT finds an illegal parameter but
  1549.         can't figure out a more specific error to cite.  It lists this
  1550.         message and the bad parameter that it objects to.
  1551.  
  1552.       ERROR 003: Only one /X switch is allowed.
  1553.  
  1554.         /X in this message will either be /F, /E or /T.  Each of these
  1555.         switches may only be specified once in an RPSORT command.
  1556.  
  1557.       ERROR 004: /P and /C are incompatible.
  1558.  
  1559.         /P and /C are mutually exclusive.  /P says that all character string
  1560.         sort keys are Pascal style strings while /C says that all character
  1561.         string sort keys are C language style strings.  There is no way a
  1562.         character string can be both of these.
  1563.  
  1564.       ERROR 005: Record len must be between 1 and 32,750 in: "badparm"
  1565.  
  1566.         "badparm" is a /Fnnnn switch specifying a record length that is
  1567.          either zero or greater than 32750.  This is not allowed.
  1568.  
  1569.       ERROR 006: Pascal string key only allowed in fixed len record: "badparm"
  1570.  
  1571.         "badparm" is a sort key definition specifying a Pascal style string
  1572.         (i.e. including the P attribute).  This is only allowed if a /Fnnnn
  1573.         switch was specified to tell RPSORT that the file consists of fixed
  1574.         length records.
  1575.  
  1576.  
  1577.  
  1578.   October 10, 1991             RPSORT Reference                      Page  27
  1579.  
  1580.  
  1581.   Error Messages (continued)
  1582.     Syntax Error Messages (continued)
  1583.  
  1584.       ERROR 007: /P only allowed for fixed length records.
  1585.  
  1586.         The /P switch which says that all character string sort keys are
  1587.         Pascal style sort keys is only allowed if a /Fnnnn switch was
  1588.         specified to tell RPSORT that the file consists of fixed length
  1589.         records.
  1590.  
  1591.       ERROR 008: Binary number key (F,I,M,T or U) only allowed in fixed len
  1592.                  record: "badparm"
  1593.  
  1594.         "badparm" is a sort key definition listing one of the binary number
  1595.         attributes.  These are only allowed if a /Fnnnn switch was specified
  1596.         to tell RPSORT that the file consists of fixed length records.
  1597.  
  1598.       ERROR 009: /N switch not allowed for fixed length records.
  1599.  
  1600.         The /N switch, which says that null lines are to be deleted, is only
  1601.         allowed for a file consisting of lines.  It is not allowed if a
  1602.         /Fnnnn switch has been specified.
  1603.  
  1604.       ERROR 010: One and only one temp drive letter may be entered: "badparm"
  1605.  
  1606.         "badparm" is a /T switch specifying either no drive letters or more
  1607.         than one.  It should list only a single drive to be used for
  1608.         temporary files (e.g. /TC).
  1609.  
  1610.       ERROR 011: Non-existent drive: "badparm"
  1611.  
  1612.         "badparm" is a /T switch specifying a drive letter that does not
  1613.         exist in your system.
  1614.  
  1615.       ERROR 012: Invalid character for the drive: "badparm"
  1616.  
  1617.         "badparm" is a /T switch specifying a non-alphabetic drive.  A drive
  1618.         can only be specified by a letter.
  1619.  
  1620.       ERROR 013: Start column must be between 1 and 32,750: "badparm"
  1621.  
  1622.         "badparm" is a sort key definition specifying a start column that is
  1623.         either zero or larger than 32750.  This is not allowed.
  1624.  
  1625.       ERROR 014: Start column must not exceed record len: "badparm"
  1626.  
  1627.         "badparm" is a sort key definition specifying a start column that is
  1628.         larger than the record length in the /Fnnnn switch.  This is not
  1629.         allowed.
  1630.  
  1631.  
  1632.  
  1633.   October 10, 1991             RPSORT Reference                      Page  28
  1634.  
  1635.  
  1636.   Error Messages (continued)
  1637.     Syntax Error Messages (continued)
  1638.  
  1639.       ERROR 015: Only one start column allowed: "badparm"
  1640.  
  1641.         "badparm" is a sort key definition that specifies more than one start
  1642.         column for the sort key.  This is not allowed.
  1643.  
  1644.       ERROR 016: Error in sort key: "badparm"
  1645.  
  1646.         "badparm" is an erroneous sort key definition.  RPSORT is unable to
  1647.         cite a more specific error.
  1648.  
  1649.       ERROR 017: Key len must be between 1 and 32,750: "badparm"
  1650.  
  1651.         "badparm" is a sort key definition specifying a key length that is
  1652.         either zero or larger than 32750.  This is not allowed.
  1653.  
  1654.       ERROR 018: Key len is too big to fit in record: "badparm"
  1655.  
  1656.         "badparm" is a sort key definition containing a key length that would
  1657.         cause the key to extend beyond the end of the record as specified by
  1658.         the /Fnnnn switch.
  1659.  
  1660.       ERROR 019: Only one key length allowed: "badparm"
  1661.  
  1662.         "badparm" is a sort key definition that specifies more than one key
  1663.         length for the sort key.  This is not allowed.
  1664.  
  1665.       ERROR 020: Length for 80x87 floating point number must be 4, 8 or
  1666.                  10: "badparm"
  1667.  
  1668.         "badparm" is a sortkey definition specifying an 80x87 type floating
  1669.         point number (attribute F).  The key length (either explicit or the
  1670.         implied key length to the end of the record) is not one of the
  1671.         legitimate values (4, 8 or 10).
  1672.  
  1673.       ERROR 021: Length for GWBASIC/BASICA floating point number must be 4 or
  1674.                  8: "badparm"
  1675.  
  1676.         "badparm" is a sortkey definition specifying a GWBASIC/BASICA type
  1677.         floating point number (attribute M).  Its key length (either explicit
  1678.         or the implied key length to the end of the record) is not one of the
  1679.         legitimate values (4 or 8).
  1680.  
  1681.       ERROR 022: Length for Turbo Pascal floating point number must be
  1682.                  6: "badparm"
  1683.  
  1684.         "badparm" is a sortkey definition specifying a Turbo Pascal type
  1685.         floating point number (attribute T).  It specifies a key length other
  1686.         than 6 which is the only legitimate value.  It is not necessary to
  1687.         specify a key length for Turbo Pascal floating point numbers because
  1688.         RPSORT assumes the length 6 by default.
  1689.  
  1690.  
  1691.  
  1692.   October 10, 1991             RPSORT Reference                      Page  29
  1693.  
  1694.  
  1695.   Error Messages (continued)
  1696.     Syntax Error Messages (continued)
  1697.  
  1698.      ERROR 023: Length for Pascal strings must be between 2 and 256: "badparm"
  1699.  
  1700.         "badparm" is a sortkey definition specifying a Turbo Pascal type
  1701.         string (attribute P).  It specifies a key length less than 2 or more
  1702.         than 256 which are the limits for this type of string and correspond
  1703.         to string[1] and string[255] respectively.
  1704.  
  1705.       ERROR 024: Length for Pascal strings must be between 2 and 256.
  1706.  
  1707.         The /P switch was specified telling RPSORT that all character string
  1708.         type sort keys were Turbo Pascal style strings but at least one of
  1709.         the character string sort key definitions gave a key length less than
  1710.         2 or more than 256. Alternatively, one of them had no explicit key
  1711.         length but the implied key length to the end of the record was not in
  1712.         the required range.
  1713.  
  1714.       ERROR 025: "P" and "C" attributes are incompatible: "badparm"
  1715.  
  1716.         "badparm" is a sort key definition that specifys both the P and C
  1717.         attributes,  thus saying that the sort key is both a Pascal style
  1718.         string and a C style string.  This is not possible.
  1719.  
  1720.       ERROR 026: C attribute conflicts with /P: "badparm"
  1721.         or
  1722.       ERROR 026: P attribute conflicts with /C: "badparm"
  1723.  
  1724.         "badparm" is a sort key definition that specifys the C or P attribute.
  1725.         This conflicts with the opposite /P or /C switch thus implying that
  1726.         the sort key is both a C style string and a P style string.  This is
  1727.         not possible.
  1728.  
  1729.       ERROR 027: Sort key cannot be both a binary number and a
  1730.                  string: "badparm"
  1731.  
  1732.         "badparm" is a sort key definition specifying one of the attributes
  1733.         (A, C or P) appropriate to a character string key and also one of the
  1734.         attributes (F, I, M, T, U) appropriate to a binary number key.  This
  1735.         is not allowed.
  1736.  
  1737.       ERROR 028: Only one binary key type allowed in a sort key: "badparm"
  1738.  
  1739.         "badparm" is a sort key definition which includes more than one of
  1740.         the binary number attributes (F, I, M, T, U).  A sort key can't be
  1741.         two different kinds of number.
  1742.  
  1743.  
  1744.  
  1745.   October 10, 1991             RPSORT Reference                      Page  30
  1746.  
  1747.  
  1748.   Error Messages (continued)
  1749.     Syntax Error Messages (continued)
  1750.  
  1751.       ERROR 029: Only one list of input files and a single output file may be
  1752.                  given.  Found additional file spec: "badparm"
  1753.  
  1754.         "badparm" is the third filespec or list of filespecs listed in the
  1755.         command line.  The first filespec or list of filespecs separated by
  1756.         plus signs is taken to be the input.  Then there should be a single
  1757.         filespec for the output.  For example:
  1758.  
  1759.           RPSORT  INPUT1.DAT+INPUT2.DAT  OUTPUT.DAT
  1760.  
  1761.         No additional filespec is not allowed.
  1762.  
  1763.       ERROR 030: Multiple files not allowed in output spec: "badparm"
  1764.  
  1765.         The first filespec or list of filespecs separated by plus signs is
  1766.         taken to the input.  Subsequently, in the command line, you would
  1767.         enter the output filespec.  This must be a single file.
  1768.  
  1769.       ERROR 031: Misplaced plus sign in input file list: "badparm"
  1770.  
  1771.         The list of files you specify for the input must be separated by plus
  1772.         signs.  There must be no spaces around the plus signs and there must
  1773.         be no plus sign before the first filespec or after the last filespec
  1774.         in the list.
  1775.  
  1776.       ERROR 032: Input is redirected from the standard input, output must go
  1777.        to the standard output.  The following file spec is illegal: "badparm"
  1778.  
  1779.         You redirected the standard input to a file.  In this case the
  1780.         output must also go to the standard output.  This can either be to
  1781.         the screen by default or can be redirected to a file.
  1782.  
  1783.       ERROR 033: You must specify an input file.
  1784.  
  1785.         You did not specify an input file either explicitly or by redirecting
  1786.         the standard input to a file.  RPSORT insists that its input come
  1787.         from a file specified in one of these two ways.
  1788.  
  1789.       ERROR 034: No name specified for error file: "badparm"
  1790.  
  1791.         "badparm" is a /E switch that did not include a file name.  The /E
  1792.         switch must include a file name.  For example:  /ESORTERRS.TXT
  1793.  
  1794.  
  1795.  
  1796.   October 10, 1991             RPSORT Reference                      Page  31
  1797.  
  1798.  
  1799.   Error Messages (continued)
  1800.  
  1801.     DOS Version Before 2.0 Message
  1802.  
  1803.       ERROR 037: RPSORT requires MS DOS version 2.00 or later.
  1804.  
  1805.         RPSORT uses MS-DOS functions that were added in version 2.0 and
  1806.         therefore can not run with an earlier version.
  1807.  
  1808.  
  1809.     Insufficient Memory Messages
  1810.  
  1811.       ERROR 040: Not enough memory.  RPSORT requires 30,000 bytes.
  1812.  
  1813.         RPSORT can run in very small amounts of memory but there is a limit.
  1814.  
  1815.       ERROR 041: Not enough memory to hold at least two records/lines at a
  1816.                  time.
  1817.  
  1818.         If the records or lines in your file are large, you may need more
  1819.         available memory than the basic 30K RPSORT usually requires.  You
  1820.         need room to hold at least two lines or records at a time plus you
  1821.         need memory to hold the RPSORT program and a few tables and other
  1822.         odds and ends.  In the extreme case where your lines or records are
  1823.         32000 bytes each, you might need some 90K of memory to run RPSORT.
  1824.  
  1825.     Line Or String Too Long Messages
  1826.  
  1827.       ERROR 043: Line exceeds max length of 32750 bytes.
  1828.  
  1829.         RPSORT found a line in the file that exceeded the  maximum allowed
  1830.         length of 32750 bytes.
  1831.  
  1832.       ERROR 044: Found Pascal string whose length byte exceeds specified key
  1833.                  length.
  1834.  
  1835.         The binary number in the first byte of a Pasal string (the length
  1836.         byte) must be less than the length attribute specified in the sort
  1837.         key definition.  Otherwise, the string would extend beyond the end
  1838.         of the key.
  1839.  
  1840.  
  1841.  
  1842.   October 10, 1991             RPSORT Reference                      Page  32
  1843.  
  1844.  
  1845.   Error Messages (continued)
  1846.  
  1847.     Input/Output Error Messages
  1848.  
  1849.       ERROR 046: No data in input file(s) so nothing to do.
  1850.  
  1851.         There was no data in the input file(s).  Either the size of the input
  1852.         file(s) was zero or the first byte of each input file was a Ctrl-Z
  1853.         thus terminating the input file(s) at the very beginning.
  1854.  
  1855.       ERROR 047: Input file not found: filename
  1856.  
  1857.         The input file named by "filename" was not found.  Check the spelling
  1858.         of the name or add a path if appropriate.
  1859.  
  1860.       ERROR 048: Error reading input file.
  1861.  
  1862.         Normally you would not see this error message from RPSORT.  Usually
  1863.         if there is an uncorrectable error while reading a disk, DOS will
  1864.         tell you and then prompt you to specify:
  1865.  
  1866.          Abort, Retry, Ignore, Fail
  1867.  
  1868.         Typically you would try R for retry a few times to see if it can get
  1869.         past the error.  If not, you would probably enter A for abort and
  1870.         RPSORT would never know what happened since DOS would terminate it.
  1871.  
  1872.         If, however, you entered F for fail then DOS would return this info
  1873.         to RPSORT and RPSORT would display the ERROR 048 message.
  1874.  
  1875.         If you were to enter I for ignore then DOS would return to RPSORT
  1876.         with no indication that the read had failed.  RPSORT would assume
  1877.         that data from the file had actually been read into memory.  This
  1878.         data would be garbage but RPSORT would happily sort the garbage and
  1879.         produce a meaningless output file.
  1880.  
  1881.       ERROR 049: No room on disk to write sorted output file.
  1882.  
  1883.         There is not enough space on the drive you assigned for the output
  1884.         file to hold the latter.
  1885.  
  1886.       ERROR 050: No room on disk to write temp file.
  1887.  
  1888.         The drive you assigned for RPSORT temporary files has insufficient
  1889.         space to hold them.
  1890.  
  1891.       ERROR 051: Unable to create temp file.
  1892.  
  1893.         There was an error attempting to create a temporary file.  Probably,
  1894.         the disk you assigned to hold temporary files doesn't have enough
  1895.         directory entries available in the current directory.  RPSORT may
  1896.         require up to three directory entries for temporary files.
  1897.  
  1898.  
  1899.  
  1900.   October 10, 1991             RPSORT Reference                      Page  33
  1901.  
  1902.  
  1903.   Error Messages (continued)
  1904.     Input/Output Error Messages (continued)
  1905.  
  1906.       ERROR 052: Unable to create output file.
  1907.  
  1908.         There was an error attempting to create the output file.  Probably,
  1909.         the drive and directory you assigned to the output file doesn't have
  1910.         any directory entries available.
  1911.  
  1912.       ERROR 053: Unable to create error file: "badparm"
  1913.  
  1914.         There was an error attempting to create the error message file.
  1915.         Probably, the drive and directory you assigned to the error file
  1916.         doesn't have any directory entries available.
  1917.  
  1918.       ERROR 054: Ran out of space on disk attempting to write error file.
  1919.                  Redirecting error messages to the screen.
  1920.  
  1921.         There is not enough space on the drive you assigned for the error
  1922.         message file to hold the latter.  RPSORT displays the current and any
  1923.         subsequent error messages to the screen before terminating.
  1924.  
  1925.  
  1926.     Never Should Happen Error Messages
  1927.  
  1928.       At a number of points, in RPSORT, I check for errors resulting from the
  1929.       use of DOS functions under conditions where in principle no errors
  1930.       could occur.  Any such errors would imply the possibility of a bug in
  1931.       RPSORT.
  1932.  
  1933.       If any of these error messages are displayed, please  send me a precise
  1934.       description of the circumstances.  This would include the amount of
  1935.       memory available in your system (the amount reported by CHKDSK or MEM
  1936.       not the total amount), the size of the file in bytes and the count of
  1937.       records or lines, whether the file consists of fixed length records or
  1938.       lines and the kind of sort key(s) you were using.
  1939.  
  1940.       ERROR 059: Error allocating memory.
  1941.  
  1942.         An error occurred using memory allocation functions in MS-DOS.
  1943.  
  1944.       ERROR 060: Unknown error accessing disk.
  1945.         through
  1946.       ERROR 074: Unknown error accessing disk.
  1947.  
  1948.         These messages all have the same text, but the error number would
  1949.         tell me where in the program the error occurred.  All of these have
  1950.         to do with disk I/O.
  1951.  
  1952.  
  1953.