home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR2 / BSORT102.ZIP / BIGSORT.DOC next >
Text File  |  1993-10-04  |  24KB  |  458 lines

  1.  
  2.                                  BIGSORT(tm)
  3.                                 Version 1.02
  4.  
  5.                        Written By: David Sheppard Poor
  6.  
  7.               Copyright (C) 1993: MeadowBrook Industries, Ltd 
  8.                              ALL RIGHTS RESERVED
  9.  
  10.  
  11. DESCRIPTION: A utility to sort files:
  12.           * Sorts small to extremely large files
  13.           * Customized and complex key structures
  14.           * FAST!
  15.           * Fixed length and variable length records
  16.           * Supports comma and other delimited file formats
  17.           * Supports dBASE and compatible file formats
  18.           * Up to eight input files with a single output file
  19.  
  20. ON-LINE HELP:  Enter: BigSort /?
  21.  
  22. EXECUTION:
  23.      BigSort InputFile OutputFile [Format [Key[+Key2[+Key3..]]]]
  24.  
  25.           Note that only the first two parameter fields are required.
  26.  
  27.  
  28.    INPUT FILE: Should contain all the data you want to sort.  If an input
  29.           file is not in the current directory, explicitly give the path
  30.           (e.g. C:\DATA\DATAFILE.TXT).  Up to eight files can be combined as
  31.           multiple input files, with the output going to a single output
  32.           file.  Wildcards (? and *) may be used, and multiple file
  33.           specifications can be combined with a plus (+) immediately between
  34.           each input file spec (e.g. C:\USER\YOU\*.DAT+C:\DATA\*.DAT).  Note
  35.           that if the format of the input file is dBASE, there can only be
  36.           one input file.
  37.  
  38.    OUTPUT FILE: All data from the input file(s) will be written to this file.
  39.  
  40.    FORMAT: Describes the format of the input and output data files.
  41.           CRLF:               Standard variable length records. (Default)
  42.           Custom Variable:    Any variable length records. (See "FORMAT")
  43.           FIXED:              Standard fixed length records.
  44.           Custom Fixed:       Any fixed length records. (See "FORMAT")
  45.           COMMA:              Standard comma delimited records.
  46.           Custom Delimited:   Any delimited records. (See "FORMAT")
  47.           dBASE:              For dBASE III and IV records.
  48.  
  49.    KEY:   The key defines what part of each record will be used to sort the
  50.           records.  The key is made up of segments of the form:
  51.                RecordPosition[(FieldLength)][/A|/D][/S|/I][/L|/R]
  52.           Each segment consists of the following elements:
  53.                RecordPosition      Starting position in the record.
  54.                FieldLength         Number of byte for the key segment.
  55.                Switches            Sets case sensitivity and ordering.
  56.  
  57. FORMAT: The Format tells BigSort(tm) what kind of input to expect.  There are
  58.      four basic flavors:
  59.           Fixed: All records are exactly the same number of bytes.  This is
  60.                generally the most speed-efficient record format.
  61.           Variable: Records may differ in length, but each ends with a
  62.                characteristic "end-of-record" marker.  This is the default.
  63.           Delimited: Variable length records, where each part of the record
  64.                is split into fields.  The delimiter separates these fields.
  65.           dBASE: Records compatible with dBASE III or dBASE IV.
  66.  
  67.      FIXED: Specifies the number bytes in each record is the same, and each
  68.           record has an end-of-record marker of CR (carriage return) followed
  69.           by LF (line feed).  BigSort(tm) will automatically figure out the
  70.           length of the Fixed records in the input file. To use, enter the
  71.           format parameter as be "FIXED".  Since sorting fixed length records
  72.           is faster than variable length records, specify FIXED records
  73.           instead of CR/LF whenever applicable.
  74.  
  75.      Custom Fixed: Specifies the number of bytes per record, which includes
  76.           the end-of-record marker (e.g. if the record ends in CR/LF, be sure
  77.           to include the two bytes in the record length).  To use, set the
  78.           format to be a decimal number, such as "200".
  79.  
  80.      CR/LF: Specifies the precise CR and LF byte(s) which mark the end of
  81.           each record. To use, set the format parameter to be CR, LF, CRLF,
  82.           LFCR, etc.  The CR/LF end of record marker can be used for fixed
  83.           length records and/or variable length records.  Note that many word
  84.           processors, editors, etc. use CRLF to denote the end of a line.
  85.  
  86.      Custom Variable: Specifies the precise byte(s) used to mark the end of
  87.           each record, in HEX form.  This format begins with a pound sign (#)
  88.           and is followed by the hex representation of the bytes denoting the
  89.           end of each record.  This form can be used for the same purpose as
  90.           CR/LF (where CRLF would be represented as #0D0A) as well as for
  91.           more specialized markers (e.g. #00 for null-terminated records).
  92.  
  93.      COMMA: Specifies the records are comma delimited.  This means each field
  94.           of the record is separated by a comma, text fields are enclosed by
  95.           double quotes, and each record is terminated by CRLF.  To use,
  96.           enter the format parameter as "COMMA".  Note that this is the type
  97.           of data file commonly created by programs written in BASIC.
  98.  
  99.      Custom Delimited: For delimited records, other than standard COMMA
  100.           delimited.  This format is comprised of a dollar sign ($), the hex
  101.           representations of the delimiter and text marker, a colon (:), and
  102.           a end-of-record marker.  For example, the standard COMMA delimited
  103.           format can be represented as "$2C22:0D0A", where the delimiter is a
  104.           comma, the text marker is a double quote, and the end-of-record
  105.           marker is CRLF.  This format is seldom used.
  106.      dBASE: For records compatible with the dBASE III or IV file formats. 
  107.           Note that only one dBASE file can be sorted at a time.  To use,
  108.           enter the format as "dBASE".
  109.  
  110. KEYS: The key specifies how the file should be sorted.  The default key is
  111.      "1(100)/L/A/S", i.e. the key starts in position 1, is 100 bytes long, is
  112.      read from left to right, is in ascending order, and is case sensitive.
  113.  
  114.      If a key is specified, each segment of the key is specified by fields in
  115.      the form:  KeyPos[(KeyLen)][/L|/R][/A|/D][/S|/I]. Each segment can be up
  116.      to 255 bytes, and the total length of all segments may not exceed 1024
  117.      bytes.  When a segment is specified, the first field (the KeyPos) is
  118.      required, and the others may be omitted if the defaults are appropriate.
  119.  
  120.   KEYPOS: For Fixed and Variable records:
  121.                The segment's starting position in the record.  (ie.if the
  122.                KeyPos is 10, the segment starts at the 10th byte.)
  123.           For Delimited and dBASE records:
  124.                The field number, where the first field is number 1.  (ie. if
  125.                the KeyPos is 10, the segment would be the 10th field.)
  126.  
  127.   KEYLEN: For Fixed and Variable records:
  128.                Number of bytes for the key segment.  If the records are of
  129.                variable length and the key goes beyond the end of the record,
  130.                #00 is automatically used to fill in the blank space.  
  131.           For Delimited records:
  132.                In the case of numeric fields, always set the KeyLen to 0. 
  133.                For non-numeric fields, KeyLen refers to the number of bytes
  134.                to use from the field, not including the text markers.
  135.           For dBASE records:
  136.                Do not specify a KeyLen.  the length of the segment will be
  137.                set automatically, as defined by the input dBASE file.
  138.      NOTE: If a KeyPos is given without a KeyLen, the KeyLen defaults to 1.
  139.  
  140.   SEQUENCE: The /L and /R switches denote Left-to-Right and Right-to-Left
  141.      ordering.  The default is /L.  Use /R when, for example, you are sorting
  142.      a binary word, and you need to reverse the order of the hi and lo bytes. 
  143.      (e.g. 20(2)/R).  Note that the KeyPos is still the left-most byte when
  144.      using the /R switch. (e.g. the key will use byte 21 followed by 20).
  145.  
  146.   ORDER: The /A and /D switches denote ascending or descending order.  The
  147.      default is /A.  Use /D when, for example, you want the largest number to
  148.      come first in the list. (eg. 10(3)/D).  Note that in the example the
  149.      first three digits starting in position 10 are used.
  150.  
  151.   CASE SENSITIVITY: The /S and /I switches denote Case Sensitive and Case
  152.      Insensitive (or Ignore Case) ordering.  The default is /S. Using a key
  153.      of 1(15)/I will put Michigan before MISSISSIPPI. The key 1(15)/S will
  154.      put MISSISSIPPI before Michigan.  Be sure to always use the /S switch
  155.      when sorting binary numbers.  Also, using the /I may degrade the
  156.      efficiency of bigsort(tm) up to 25%.  See "Suggestions and Technical
  157.      Notes" below for more on how to improve efficiency.
  158.  
  159.   SEGMENTS: The key may be broken into segments when the sorting criteria is
  160.      spread throughout the record.  To do this, put a plus (+) between each
  161.      segment.  Note the second segment will only be used if the first
  162.      segments match exactly.  (e.g. A key such as 100(10)+200(5) will sort
  163.      starting at position 100 for 10 bytes.  If two records have the exact
  164.      same 10 bytes, the 5 bytes at position 200 will serve as a tie breaker.
  165. EXAMPLES: THE BASICS:
  166.  
  167.      There are three sample files included.  They are:
  168.           Sample.TXT     Standard ASCII version of the sample data
  169.           Sample.DEL     Comma delimited version of the sample data
  170.           Sample.DBF     dBASE version of the sample data.
  171.  
  172.      The sample data includes records of states names, capitals, their postal
  173.      abbreviations, and state populations.
  174.  
  175.      To look at the input file, type:
  176.           TYPE SAMPLE.TXT | MORE
  177.      Note that the "|" character is not a colon; it is a vertical bar.  If
  178.      you are working on a portable computer keyboard, you may not have access
  179.      to this character.
  180.  
  181.      After trying an example, look at the output by typing:
  182.           TYPE OUT.DAT | MORE
  183.      To look at the output of the dBASE samples, you must use a database
  184.      package.
  185.  
  186.  1)  To sort by state name, use:
  187.           BigSort SAMPLE.TXT OUT.DAT         (Defaults)
  188.      -or- BigSort SAMPLE.TXT OUT.DAT CRLF 1(14)   Format = CRLF
  189.      -or- BigSort SAMPLE.TXT OUT.DAT FIXED 1(14)  Format = Fixed
  190.      -or- BigSort SAMPLE.TXT OUT.DAT 43 1(14)     Format = Fixed 43
  191.      The output from any of these will be the same.  Note that the fixed
  192.           formats are much faster.  Since the default is CRLF with a key of
  193.           100, it is often good to specify FIXED when you can.
  194.  
  195.  2)  To sort by population, use:
  196.           BigSort SAMPLE.TXT OUT.DAT FIXED 34(8)
  197.      Note that numbers can be sorted when they are right justified.
  198.  
  199.  3)  When the populations are the same, use state names to break the tie:
  200.           BigSort SAMPLE.TXT OUT.DAT FIXED 34(8)+1(14)
  201.      Note: when two keys match exactly for the whole key, the one which
  202.           appeared first in the input file will appear first in the output
  203.           file.
  204.  
  205.  4)  If you have two files with the same format, they can be sorted together. 
  206.      Since there is only one text example file included, we will use it twice
  207.      for demonstration purposes:
  208.           BigSort SAMPLE.TXT+SAMPLE.TXT OUT.DAT FIXED 1(14)
  209.      The output will have two records for each state.
  210.  
  211. EXAMPLES: COMMA AND dBASE:
  212.  
  213.      Both dBASE and delimited forms are based on fields, as opposed to fixed
  214.      positions.
  215.  
  216.  1)  To sort by state name, use:
  217.           BigSort SAMPLE.DEL OUT.DAT COMMA 1(14)(Delimited Only)
  218.      -or- BigSort SAMPLE.DBF OUT.DBF dBASE 1 (dBASE Only)
  219.  
  220.  2)  To sort by state population, use:
  221.           BigSort SAMPLE.DEL OUT.DAT COMMA 4 (Delimited Only)
  222.      -or- BigSort SAMPLE.DBF OUT.DBF dBASE 4 (For dBASE Only)
  223.      Note: By not specifying a length in the delimited field, BigSort(tm)
  224.           knows to treat the field as a number.
  225.  
  226.  3)  If there were a second file (SAMPLE2.DEL), use:
  227.           BigSort SAMPLE*.DEL OUT.DAT COMMA 1(14)
  228.      -or- BigSort SAMPLE.DEL+SAMPLE2.DEL OUT.DAT COMMA 1(14)
  229.      Note: dBASE files can not be sorted together.  You can, however, sort
  230.           two dBASE files separately.
  231.  
  232.  
  233. EXAMPLES: SWITCHES:
  234.  
  235.  1)  If the states are sometimes all in capitals and sometimes starting with
  236.      a single capital followed by lower case letters, use:
  237.              BigSort SAMPLE.TXT OUT.DAT FIXED 1(14)/I
  238.      Note: The /I switch turns off case sensitivity (case Insensitive) and
  239.           allows upper and lower case words to be sorted together.  Without
  240.           the /I switch, they would not be sorted properly.  Note, however,
  241.           that the /I switch slows down processing by about 25%.  Also, never
  242.           use the /I switch with binary numbers.
  243.  
  244.  2)  To sort by state name from "Z" to "A", use:
  245.              BigSort SAMPLE.TXT OUT.DAT FIXED 1(14)/D/I
  246.      Note: The /D switch stands for Descending ordering.
  247.  
  248.  3)  To sort by state name within descending population (99999 -> 00000),
  249.      use:
  250.              BigSort SAMPLE.TXT OUT.DAT FIXED 34(8)/D+1(14)/I
  251.  
  252.  4)  There are some cases in which you might want to reverse the order of the
  253.      characters.  This is especially true when sorting binary numbers.  As an
  254.      example, you might want to sort the state postal code, so that the first
  255.      letter counts as the second digit and vice-versa:
  256.              BigSort SAMPLE.TXT OUT.DAT FIXED 17(1)+16(1)
  257.      -or-    BigSort SAMPLE.TXT OUT.DAT FIXED 16(2)/R
  258.  
  259. SUGGESTIONS AND TECHNICAL NOTES:
  260.  
  261.   A) If the records are known to be of fixed length and that length is known,
  262.      use the FIXED or Record Length format.  BigSort(tm) is fastest with
  263.      fixed length records, performing about 25% better than the default CR/LF
  264.      variable record length format.
  265.  
  266.   B) Avoid using the /I switch when it is not necessary.  It can slow down
  267.      processing by 25%.
  268.  
  269.   C) To maximize its efficiency, have as much RAM available as possible when
  270.      running; the less swapped to disk, the better.
  271.  
  272.   D) To further improve efficiency, send the output to a different volume
  273.      (another hard disk) if available. This prevents the drive from going
  274.      back and forth from the input and output files, which can add up to lots
  275.      of time.  DO NOT use a floppy disk, as they are VERY slow.
  276.  
  277.   E) Make sure there are sufficient FILES available, as defined in your
  278.      CONFIG.SYS.  Generally only about 4 FILES are necessary.  However, in
  279.      the worst case BigSort(tm) requires many more FILES.  Make sure your
  280.      CONFIG.SYS sets FILES=15 or more.
  281.  
  282.   F) The maximum length all the input files is 2,147,483,647 bytes (2GB). 
  283.      The maximum length of each record is 65535 bytes (64KB).  There can be
  284.      up to eight key segments, for a total maximum length of 1024 bytes. 
  285.      Each segment can be up to 255 bytes long.
  286.  
  287.   G) Don't use the name of the input file for the output file.  If you have a
  288.      type-o or the power goes out, you could lose both the original and
  289.      sorted data!
  290.  
  291.   H) Keep the key as short as possible.  For instance, if one part of the key
  292.      is a number which is unique to each record, don't include any additional
  293.      key segments.  Also avoid large sections of white space in the key.
  294.  
  295.   I) Here is a neat trick: If you have a long text file, and you want to sort
  296.      groups of records, place an extra blank line (CR/LF) after each group. 
  297.      Then enter: BigSort <InputFile> <OutputFile> CRLFCRLF <SomeKey>.  This
  298.      tells BigSort(tm) that the group of records is a single variable-length
  299.      record.  This works provided no group of records exceeds 64k.
  300.  
  301. DEFINITION OF SHAREWARE:
  302.  
  303.      Shareware distribution gives users a chance to try software before
  304.      buying it. If you try a Shareware program and continue using it, you are
  305.      expected to register. Individual programs differ on details -- some
  306.      request registration while others require it, some specify a maximum
  307.      trial period. With registration, you get anything from the simple right
  308.      to continue using the software to an updated program with printed
  309.      manual.
  310.  
  311.      Copyright laws apply to both Shareware and commercial software, and the
  312.      copyright holder retains all rights, with a few specific exceptions as
  313.      stated below. Shareware authors are accomplished programmers, just like
  314.      commercial authors, and the programs are of comparable quality. (In both
  315.      cases, there are good programs and bad ones!) The main difference is in
  316.      the method of distribution. The author specifically grants the right to
  317.      copy and distribute the software, either to all and sundry or to a
  318.      specific group. For example, some authors require written permission
  319.      before a commercial disk vendor may copy their Shareware.
  320.  
  321.      Shareware is a distribution method, not a type of software. You should
  322.      find software that suits your needs and pocketbook, whether it's
  323.      commercial or Shareware. The Shareware system makes fitting your needs
  324.      easier, because you can try before you buy. And because the overhead is
  325.      low, prices are low also. Shareware has the ultimate money-back
  326.      guarantee -- if you don't use the product, you don't pay for it.
  327.  
  328. THE ASSOCIATION OF SHAREWARE PROFESSIONALS:
  329.  
  330.      BigSort(tm) is produced by a member of the Association of Shareware
  331.      Professionals (ASP). ASP wants to make sure that the shareware principle
  332.      works for you.  If you are unable to resolve a shareware-related problem
  333.      with an ASP member by contacting the member directly, ASP may be able to
  334.      help.  The ASP Ombudsman can help you resolve a dispute or problem with
  335.      an ASP member, but does not provide technical support for members'
  336.      products.  Please write to the ASP ombudsman at 545 Grover Road,
  337.      Muskegon, MI 49442-9427 USA, FAX 616-788-2765 or send a CompuServe
  338.      message via CompuServe Mail to ASP Ombudsman 70007,3536.
  339.  
  340.                    _______
  341.               ____|__     |               (R)
  342.            --|       |    |-------------------
  343.              |   ____|__  |  Association of
  344.              |  |       |_|  Shareware
  345.              |__|   o   |    Professionals
  346.            -----|   |   |---------------------
  347.                 |___|___|    MEMBER
  348.  
  349.  
  350. DISCLAIMER - AGREEMENT:
  351.  
  352.      Users of BigSort(tm) must accept this disclaimer of warranty:
  353.      "BigSort(tm) is supplied as is.  The author disclaims all warranties,
  354.      expressed or implied, including, without limitation, the warranties of
  355.      merchantability and of fitness for any purpose. The author assumes no
  356.      liability for damages, direct or consequential, which may result from
  357.      the use of BigSort(tm)."
  358.  
  359.      BigSort(tm) is a "shareware program" and is provided at no charge to the
  360.      user for evaluation.  Feel free to share it with your friends, but
  361.      please do not give it away altered or as part of another system.  The
  362.      essence of "user-supported" software is to provide personal computer
  363.      users with quality software without high prices, and yet to provide
  364.      incentive for programmers to continue to develop new products.  If you
  365.      find this program useful and find that you are using BigSort(tm) and
  366.      continue to use BigSort(tm) after a reasonable trial period, you must
  367.      make a registration payment of $20 to MeadowBrook Industries, Ltd.  The
  368.      $20 registration fee will license one copy for use on any one computer
  369.      at any one time.  You must treat this software just like a book.  An
  370.      example is that this software may be used by any number of people and
  371.      may be freely moved from one computer location to another, so long as
  372.      there is no possibility of it being used at one location while it's
  373.      being used at another. Just as a book cannot be read by two different
  374.      persons at the same time.
  375.  
  376.      Commercial users of BigSort(tm) must register and pay for their copies
  377.      of BigSort(tm) within 30 days of first use or their license is
  378.      withdrawn.  Site-License arrangements may be made by contacting
  379.      MeadowBrook Industries, Ltd.
  380.  
  381.      Anyone distributing BigSort(tm) for any kind of remuneration must first
  382.      contact MeadowBrook Industries, Ltd at the address below for
  383.      authorization. This authorization will be automatically granted to
  384.      distributors recognized by the (ASP) as adhering to its guidelines for
  385.      shareware distributors, and such distributors may begin offering
  386.      BigSort(tm) immediately (However MeadowBrook Industries, Ltd must still
  387.      be advised so that the distributor can be kept up-to-date with the
  388.      latest version of BigSort(tm)).
  389.  
  390.      You are encouraged to pass a copy of BigSort(tm) along to your friends
  391.      for evaluation.  Please encourage them to register their copy if they
  392.      find that they can use it.  All registered users will receive a copy of
  393.      the latest version of the BigSort(tm) system and printed documentation.
  394.  
  395. SUPPORT:
  396.  
  397.      If you have any questions or problems concerning the use of BigSort(tm),
  398.      please write to the address below.  Alternately, if you are a user of
  399.      email, write to the email address listed below for a faster response. 
  400.      There are no duration restrictions placed on BigSort's support services. 
  401.      When requesting support, be sure to include the version number, as well
  402.      as a complete description of the problem.
  403.  
  404. REGISTRATION: 
  405.  
  406.      Once you have determined BigSort(tm) is a tool you intend to use, please
  407.      register your copy:
  408.  
  409.      SINGLE MACHINE LICENSE:                      $ 20.00
  410.  
  411.      MULTIPLE SINGLE USER MACHINE LICENSES:       $ 15.00 per machine
  412.                                                        (2+ computers)
  413.  
  414.      NETWORKED MACHINE LICENSES / SINGLE SERVER:  $ 10.00 per node
  415.                                                        (4+ computers)
  416.  
  417.      After receiving your registration fee, MeadowBrook will send your
  418.      registered copies of the latest version of BigSort(tm) with printed
  419.      documentation, and upgrade information as it becomes available.  Be sure
  420.      to include your address and to specify either 3 1/2 or 5 1/4 inch disks. 
  421.      If you prefer product information to arrive via email rather than
  422.      conventional mail, please include your email address.  Please see
  423.      REGISTER.DOC for more information.
  424.  
  425.  
  426. CONTACTING MEADOWBROOK INDUSTRIES:
  427.  
  428.      If you have any questions, suggestions, or wish to register BigSort(tm),
  429.           write to:
  430.  
  431.                     BigSort(tm)
  432.                     MeadowBrook Industries, Ltd.
  433.                     450 Veterans Drive
  434.                     Burlington, NJ 08016
  435.  
  436.      Or send email to:   BigSort@Poor.Pgh.PA.US
  437.  
  438.  
  439. BIGSORT-PLUS: 
  440.  
  441.      BigSortPlus(tm) is now available for $ 49.00 on a commercial basis.  It
  442.      contains all the functionality of BigSort(tm) in an interactive
  443.      environment:
  444.  
  445.                * Interactive version, with pull-down menus
  446.                * On-line, context-sensitive help
  447.                * Comprehensive manual included
  448.  
  449.      If you would prefer to purchase BigSortPlus(tm) instead of registering
  450.      BigSort(tm), either purchase from your local software store or from the
  451.      address above.  Please specify either 3 1/2 or 5 1/4 inch disks.
  452.  
  453.      SINGLE MACHINE COPY OF BigSortPlus(tm):           $ 49.00
  454.  
  455.      Discounts are available for networked systems and multiple single user
  456.      systems.  Please contact MeadowBrook Industries for more information.
  457.  
  458.