             Microdrive File Utility Suite



          W.F. Barnard of Oxon helps to get us

          organised with three useful programs

                  for use with files.



"We'd like to know a [little] bit about you for our files"

said Simon and Garfunk[el] to Mrs. Robinson. She needn't

have worried if they were kept on a Microdrive as they are

bound to get lost or confused.

   But, now we have this suite of program to enable Micro-

drive owners to get some order and organisation in their

system, three in all and they perform the following tasks:



1) FILE ANALYSER



This program prompts for the name of a file and which

Microdrive it is on. It then reads through the file

displaying information about each line and then the line

itself. The information is of the form:



Line number, Line length, Maximum line length so far, and

the Total number of bytes in the file so far.



The listing can be halted for viewing by pressing any key.

It is assumed that the last line of the file is four stars,

i.e. '****'.



2) FILE COPIER



With only one Microdrive it is not easy to make copies of

data files onto other cartridges. This program will make a

copy of a Microdrive file to another cartridge using only

one Microdrive. The size of the file is limited by the

amount of memory available in the computer.

   The program prompts for the filename, the number of

lines in the file and the length of the longest line in the

file. If any of this information is not known then the file

should be first read by my File Analyser. If the last line

of the file is not '****', then this is added for future

use. A facility is also included to make a copy of this

file to cassette. This is sometimes known as archiving.



3) FILE SORTER



This program allows Microdrive files of up to 90K to be

sorted into alphabetical order. The size of the file that

can be sorted depends on how many Microdrives you have.

Assuming that a full 90K is available on your cartridges

then with one Microdrive a file of 30K can be sorted, with

two Microdrives a file of 45K, and with three Microdrives a

file of 90K.

   The program uses two temporary files during my sort and

merge algorithm. The last line of the file again should be

'****'. The program will take some [or many!] minutes to

sort a large file so it tells you roughly what it is doing

whilst executing.

   The program reads so many lines from the main file into

an array and then sorts these into order. It then merges

this array with one of the temporary files into the other

temporary file. This continues until the end of the main

file. The number of lines that are read from the main file

and sorted is selected by the user. This value together

with the length of the longest line should be as large as

the computer's memory allows.



[ As this is a Microdrive suite, I have supplied these

  programs in a .mdr file instead of the more usual .tzx.

  Well, if you can't read it, they wouldn't be much use

  anyway, would they?

  Apart from the three main programs, the .mdr also has

  four data files on it. "datafile" is a normal data file,

  as expected by the programs. "endless" is a file without

  the concluding '****' line, and "brokenfile" is one which

  has two '****' lines, one halfway through and one at the

  end; I provided those so you can see how the programs

  break when given inappropriate files.

  "largefile" is a file of just over 48 kilobytes, to give

  the suite something to stretch its muscles. Copier, of

  course, won't handle it, since it won't fit in memory at

  all. Analyser has no problems with it. Neither does

  Sorter, if you give it a second .mdr to use, although it

  does take rather a while to handle it; on my emulator,

  it took over 10 minutes to sort, at about 800% speed-up.

  Doing the maths, on a real Speccy it should have taken

  well over an hour - rather a bit more than the "some

  minutes" Mr. Barnard refers to! But, long time or not,

  it did manage to sort the entire file.

  Finally I added the two programs, "File Entry" and "Make

  Large", which I used to create these files. Both create

  files only on Microdrive nr. 1; apart from that, their

  operation should be obvious.

                                        RLB, Januari 2012 ]