Volume 2 · Number 2 · April 1982

Page 22 of 37

the program names, the program prices and the numbers sold at each price. The first two are essentially ‘standing’ or file information. We will therefore need some means of building up a file of these, together with routines to enter new data and amend or delete existing data. My solution was to make use of Program Power’s ‘Basic File Handler’ program, which gives amongst other things the ability to save and load string data.

The numbers of each program sold must obviously be entered each quarter. This leaves the price information. I established that, although there were perhaps only 10 basic prices for programs, the variations discussed earlier could easily multiply this by a factor of at least 10. Thus I thought it best to deal with this in the same way as numbers sold.


Name and Address File – this can fairly simply be held as follows: N$(I), A$(I), B$(I), C$(I), D$(I) – where N is the name; A, B & C are a three line address; and D is the telephone number, (strictly speaking not required for this application). The subscript ‘I’ will be used as a key effectively to the file of authors.

As regards the programs, I decided to go for a two dimensional string array, as this permits ease of handling. Thus, for a file of 30 authors (covering just one of the micros), we have the array P$(I,​J), where J is the key to the programs of each author. Since there are very few authors who have more than two programs, this is very wasteful of memory space, but as it is not a problem in this particular case, the benefits of ease of handling will be allowed to take preference.

I mentioned earlier that the majority of the information has to be output twice. This means that the price and numbers sold data must be held between one print run and the next. Alternatively, it could be saved as a temporary file, but this solution was not thought to be very elegant. My first solution to this problem was to create two three- dimensional numeric arrays viz. P(I,​J,​K) to hold the prices and S(I,​J,​K) to hold the relevant numbers sold. A quick calculation of 2(arrays) x 30(authors) x 20(programs) x 10 (prices) x 6 bytes per variable = 72000bytes persuaded me I had better think again.

I then thought of the way in which the information will be used. The main part of the program will start with the first author, deal with his programs in turn and then move on down the list of authors until they have all been looked at. A solution much less wasteful of space would therefore be to create two single tier arrays viz. K(X) for prices and L(X) for numbers sold, with a variable element deliberately left

Page 22 of 37