home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug039.arc / BSORT.DOC < prev    next >
Text File  |  1979-12-31  |  3KB  |  86 lines

  1.     NOTES ON BSORT.COM
  2.  
  3. Written and copyrighted by C. E. Duncan 1979, 1980, 1981.
  4. Permission granted to copy for non-commercial and personal use.
  5.  
  6. BSORT is a combination sort for fixed length records.  It operates
  7. on a contiguous array of records in memory, which it has read from
  8. disk, then writes the sorted records again out to disk.
  9.  
  10. BSORT is a CP/M COM file and is called as follows:
  11.  
  12.     BSORT <input file name> <output file name>
  13.  
  14. The file names are, according to CP/M conventions
  15.  
  16.     [d:]name.typ
  17.  
  18. where the brackets [] mean that the contents are optional.
  19.  
  20. After the program is initiated, you will be asked for the record
  21. length.  Respond with a suitable number between 1 and 255, the
  22. upper limit.  This length must be that which is in the disk record.
  23. If each record terminates with carriage return and line feed, as
  24. would be the case of a list of words prepared under the CP/M editor,
  25. then the record length must be the fixed word length plus two.
  26. BSORT reads the disk file without change, complete, to an internal
  27. array in the form
  28.  
  29.     [1:number of records][1:record size] CHAR
  30.  
  31. where CHAR is an eight bit byte.
  32.  
  33. Next you will be asked for sort parameters, by means of which you
  34. may designate one or two sort fields.  Your response must take the
  35. form
  36.  
  37.     s1l s1h [a| |d] [s2l s2h [a| |d]]
  38.  
  39. where "snl" are the position numbers of the first characters of the
  40. sort substrings and the "snh" are the position numbers of the last
  41. characters of the sort substrings. The symbol "|" indicates alternate
  42. choices.  The sort substrings may not overlap.
  43. The letters "a" and "d", which may be either upper or lower case,
  44. indicate the direction of the sort, whether ascending or descending
  45. according to numerical byte value.  When omitted, default is to
  46. ascending.
  47. The program makes many checks on the appropriateness of the
  48. entered data and requests re-entry when not satisfied.  It also
  49. checks that the requested file will fit into available storage.
  50.  
  51. Typical dialog:
  52.  
  53.     BSORT B:FILE.DAT OUT.DAT
  54.  
  55.     Enter record length: 9
  56.  
  57.     Enter sort parameters: 9 9 d 1 8
  58.  
  59. This dialog requests that file "FILE.DAT" from the "B" disk be sorted
  60. and the sorted file be written out to file "OUT.DAT" on the default
  61. disk.  It consists of 9-byte records, and is to be sorted in descending
  62. order on the ninth character, under which it will be in ascending order
  63. on bytes 1 to 8.
  64. Entry of record length and the sort parameters has few constraints
  65. of format.  For record length, the first set of contiguous ASCII
  66. digits is taken; all other input is ignored:
  67.  
  68.     Enter record length: #swX  R14,tg  9 8 (etc)
  69.  
  70. This response will be interpreted as "14".
  71.  
  72. Sort parameters will be sought in the following five patterns:
  73.  
  74.     n n {a|d} n n {a|d}
  75.     n n {a|d} n n
  76.     n n n n {a|d}
  77.     n n {a|d}
  78.     n n
  79.  
  80. Only the ten digits and the letters "A", "a", "D" and "d" are
  81. recognized, hence any other characters may be present but will be
  82. ignored.  I.e. all other characters, including blanks, will act as
  83. separators for the parameters.
  84.  
  85. The program may be aborted in the entry portion by typing control-C.
  86.