home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / bigsrt44.zip / bigsort.txt < prev   
Text File  |  1997-12-29  |  12KB  |  295 lines

  1.      BIGSORT V4.4  : A Fast in-memory sort for files of any size.
  2.           ----------------------------------------------------
  3.                          User Supported Program
  4.                 Continued use requires a donation of $20
  5.  
  6.  
  7. (C)1988-93 Turgut Kalfaoglu <turgut@frors12.bitnet>,<turgut@frmop11.bitnet>
  8.  
  9.  
  10. BIGSORT uses the fastest known sorting algorithm to sort files that can
  11. be as large as your swapping area (not RAM) allows. A wide range of
  12. options along with multiple key fields enable you to pinpoint the
  13. desired sorting method.
  14.  
  15. BIGSORT is especially well suited for batch files, and to be called from
  16. other programs. It returns specific error codes, and never prompts for
  17. verification or additional information. Always using the defined
  18. (primary) collating sequence for your country, BIGSORT will be able to
  19. place your national characters in the correct order.
  20.  
  21. Unless /Verbose option is specified, BIGSORT never writes its messages
  22. to the standard output, to prevent its messages from getting written to
  23. an output file. Its messages are always directed to "standard error."
  24. Under OS/2, it is possible to redirect stderr to a file, if desired.
  25.  
  26. This program is shareware: A registration allows you stay up-to-date on
  27. enhancements to the product, and enables you to purchase the source
  28. code.
  29.  
  30.  
  31. Usage:
  32.  
  33. BIGSORT [options] < inputfile > outputfile
  34.  
  35. if you omit the '< inputfile' part, BIGSORT will wait for an answer from
  36. the keyboard. If that is what you wish, enter the data, separating each
  37. one by a RETURN character, then enter CTRL-Z to finish the entry.
  38.  
  39. if you omit '> outputfile' part, BIGSORT will send its output to the
  40. screen.
  41.  
  42. For some online help, type
  43.       BIGSORT HELP
  44.  
  45.  
  46. The normal usage of BIGSORT is either thru OS/2 "pipes", or thru
  47. redirection. Pipes enable a program's output to be sent as input to a
  48. second program. This is specified by using the "|" symbol between the
  49. two programs. Redirection is similar, it allows the output of a command
  50. to be sent to a file, instead of getting displayed on the screen. The
  51. ">" symbol indicates that the output should be sent to the file, not to
  52. the screen. Note that the > symbol causes the previous contents of the
  53. file to be lost. The >> symbol can be used to append to the previous
  54. contents.
  55.  
  56.  
  57.  
  58. Options
  59. -------
  60.  
  61.     Use options to change the default behavior of BIGSORT, which is:
  62.         * Start sorting on the first position of each line,
  63.         * Do a case-sensitive alphanumeric sort,
  64.         * Reserve room for 100,000 lines of input file. (Lines, not
  65.           bytes).
  66.  
  67.     If you wish to use multiple options, you need to separate them by
  68. spaces. The options available with this version are:
  69.  
  70.   /+nnn   where nnn's are a number, will cause BIGSORT to start sorting
  71.           items from that column. If omitted, BIGSORT sorts the file
  72.           starting from the first character.
  73.  
  74.   /+nnn-mmm where nnn and mmm are the column numbers, causes the program
  75.           to focus only on the area between those two columns. This
  76.           option can be repeated as many times as necessary to specify
  77.           secondary sort keys. See the chapter on multiple keys.
  78.  
  79.   /R      Reverses the sort order. The sorting order will be descending
  80.           order for that field, if this option is specified.
  81.  
  82.   /Ds     Specifies the symbol to use as a delimiter for the date
  83.           symbol. 's' can be either a dash "-", a slash "/", a period
  84.           "." or nothing. If "/D " is specified, BIGSORT assumes that
  85.           the digits are attached to each other, like 19921220, to
  86.           specify a date of Dec 20th, 1992. Default: /D-
  87.  
  88.   /I      Ignore case. Without this option, A comes before a, and Z comes
  89.           before a. Use this option to prevent this.
  90.  
  91.   /MMDDYY The field is a date field, in the format of MM-DD-YY. Unless
  92.           the /D option is specified, BIGSORT assumes that dashes
  93.           separate the digits.
  94.   /DDMMYY Similar - the data field is in DD-MM-YY format.
  95.   /YYMMDD Similar - the data field is in YY-MM-DD format.
  96.  
  97.   /Snnnn   Specifies the index size for the file. One index entry per
  98.           each line in your file is needed to load the file. Normally
  99.           BIGSORT reserves a room for 100 thousand lines. If the number
  100.           of lines (or records) in your file is more than 100 thousand,
  101.           you need to specify the /S option. For example, if your file
  102.           is 200 thousand lines, and you expect it to grow, you may tell
  103.           bigsort to reserve room for 500 thousand:  /S500000
  104.  
  105.   /N      Indicates that the field specified is a numeric field, thus a
  106.           numeric comparison should take place. This prevents leading
  107.           blanks and other characters from interfering with the sorting
  108.           order of numbers. If /N is specified, BIGSORT compares the
  109.           field contents after converting them to floating-point
  110.           numbers. This ensures accurate sorting of numbers with decimal
  111.           places.
  112.  
  113.  
  114. Specifying Ranges
  115. -----------------
  116.  
  117. Ranges limit the area where BIGSORT should focus on. For example, if you
  118. wanted to sort the files displayed with OS/2 DIR command, based on the
  119. file sizes, you could tell BIGSORT to sort the data based on the
  120. information contained between column 17 and 27. The option for that
  121. would look like:  "/+17-27".
  122.  
  123. Options are parsed from left to right, changing the internal defaults as
  124. it goes along. When BIGSORT comes upon a range field, it records the
  125. current setting of such options as "/R", "/I", "/N" and date-related
  126. options, for that range. It then resets these options to the defaults,
  127. to enable you to construct a completely new set of rules of your second
  128. sort field specification, if any.
  129.  
  130. Let's see this with an example. Let's try to sort DIR's output on
  131. creation date, and then on the name. Our idea is to display the files in
  132. the chronological order, but files created on the same day, should be
  133. sorted by name within themselves.
  134.  
  135. Here is a ruler line, followed by a sample output of the DIR command:
  136.  
  137. 0        1         2         3         4         5
  138. 12345678901234567890123456789012345678901234567890
  139.  
  140.   9-11-92  8:01p     <DIR>         922  .
  141.   9-11-92  8:01p     <DIR>         690  ..
  142.  12-22-92  7:14p      5638           0  BIGSORT.BAK
  143.  12-22-92  7:42p      5267           0  BIGSORT.C
  144.  12-22-92  7:14p       869           0  BIGSORT.H
  145.  12-22-92  8:44p      5167           0  BIGSORT.TXT
  146.  12-22-92  7:12p      3004           0  COMPARES.C
  147.  (...)
  148.  
  149. The command to give to BIGSORT to sort the above list would be:
  150.  
  151. DIR | BIGSORT /MMDDYY /d- /+1-9 /i /+41-80 > myfile.output
  152.  
  153. Let's analyze this command. When OS/2 "sees" this line, it first erases
  154. and opens the "myfile.output" which will store the results of the
  155. operation. It then runs the "DIR" command, passing its output to BIGSORT
  156. with all the parameters.
  157.  
  158. When BIGSORT starts, it defaults to using its case-sensitive
  159. alphanumeric sort. The first option changes this to the sort on the date
  160. field. The second option specifies that the month, days and year digits
  161. are separated by dashes, which is the default, by the way. When we
  162. specify the range, "/+1-9" our /MMDDYY option is recorded as the desired
  163. sort method for the first range, and BIGSORT resets the sort method to
  164. case-sensitive alphanumeric sort. Now it reads the "/I" option and
  165. switches its current sort method to case-insensitive, alphanumeric sort.
  166. When it reads the "/+41-80" range specifier, it records that our second
  167. field selection should be sorted using an alphanumeric, but
  168. case-insensitive sort.
  169.  
  170. When BIGSORT is done, it sends the result to "standard output" which has
  171. been redirected to a file with the "> myfile.output" part of the
  172. command.
  173.  
  174. Each time a range is specified, the specified options are recorded for
  175. that range, and the options are reset. Thus, you may have to specify the
  176. same option several times in the command line, in some cases. For
  177. example, to sort on the Lastname, then on the firstname, both using
  178. case-insensitive sort, you need to put something like:
  179.  
  180.         TYPE myfile | BIGSORT /i /+10-25 /i /+27-40
  181.  
  182.  
  183. Multiple Ranges
  184. ---------------
  185.  
  186. BIGSORT accepts up to twenty ranges. This means that you can specify up
  187. to twenty different "zones" in your data for BIGSORT to sort on.
  188. Multiple key fields are useful if you wish for example that your
  189. database output be sorted on the date field, and within that, on the
  190. last name of the person. You can tell BIGSORT to sort the first field
  191. definition corresponds to a date, and the second one to a name. This
  192. way, BIGSORT will continue sorting records on the name, if the dates are
  193. identical.
  194.  
  195.  
  196. BIGSORT and multiple files:
  197. ---------------------------
  198.  
  199. If you wish to sort and merge several files into one, you can do it with
  200. one command under OS/2. Just do a:
  201.  
  202. TYPE *.* | BIGSORT > result.txt
  203.  
  204. Note that the TYPE command also sends the filename of the file it is
  205. processing, to "standard output". You may have to manually remove such
  206. records.
  207.  
  208. BIGSORT Swap Area:
  209. ------------------
  210.  
  211. BIGSORT creates no swap area of its own, but uses OS/2 to allocate
  212. necessary memory to load the entire file, along with an index pointer
  213. for each line. You can "guesstimate" that an input file of 8MB, will
  214. occupy a little over 8MB of RAM when BIGSORT is working on that file.
  215. OS/2 will first allocate all available RAM, then provide the rest from
  216. its swap area. Since this area grows and shrinks automatically, there is
  217. nothing wrong with having a temporarily large swap file - just make sure
  218. to have enough space on the disk where the swap file resides.
  219.  
  220. Shareware
  221. ---------
  222.  
  223. BIGSORT represents countless hours of work. Please contribute to the
  224. shareware discipline by sending $20 of registration fee to:
  225.  
  226.         Turgut Kalfaoglu
  227.         1378 Sok. 8/10
  228.         Izmir 35210
  229.         Turkey
  230.  
  231.  
  232.  
  233. Source Code
  234. -----------
  235.  
  236. BIGSORT is compiled under IBM C/SET 2, at CSD level 28. Clear and
  237. well-documented source code with documentation is available ONLY to the
  238. registered users. Send $10 (to cover shipping charges) and a blank disk
  239. (either 3.5 or 5.25) to the above address to receive the source code.
  240.  
  241. The author encourages you to register, but also to ask for additional
  242. features, or comments. Please don't think that you need to register this
  243. software for additional features or to report problems or suggestions.
  244. However, regular use requires a donation of $20 to the above address.
  245.  
  246.  
  247.  
  248. Update History
  249. --------------
  250.  
  251. Version 4.2:
  252. ------------
  253. Fixes problem with sorting based on date specifications.
  254. Adds more timing information into the "/V" (verbose) option.
  255.  
  256. Version 4.1:
  257. ------------
  258.  
  259. Implements the "/N" (numeric field) option.
  260.  
  261. Version 4:
  262. ----------
  263.  
  264. Implements multiple key fields,
  265. Implements sort ranges,
  266. Implements the /D option.
  267. Implements country-specific information
  268.  
  269. Version 4 is almost a complete re-write with division of source code
  270. into five segments.
  271.  
  272.  
  273. New Version: V3
  274. ---------------
  275. Implements unlimited input filesize.
  276.  
  277.  
  278.  
  279. New Version: (V2.1 to V2.2)
  280. ---------------------------
  281.  
  282. Added features: It can now handle dates as well!
  283.                 Now /R and /I can be used at the same time.
  284.                 Improved performance, but code size still about
  285.                 the same (you should see the tricks that were done
  286.                 to keep it that way :)
  287.  
  288. Bugs Removed:   None were found in V2.1
  289.  
  290. New Version: (V2.2 to V2.4)
  291. ---------------------------
  292. Added features: Now accepts input lines up to 10K in size.
  293.                 Optimized for Pentium processor.
  294.  
  295.