Error 8

by Les Ellingham

 

Issue 21

May/Jun 86

Next Article >>

<< Prev Article

 

 

I keep getting ERROR 8 but I have checked the line and nothing is wrong'

Les Ellingham offers a solution to help beginners

The above must be one of the most common calls for help that we get from our readers. Most people look up the error to find 'DATA MIS-MATCH' or similar (see Steve Pedler's article for further information) and because the on screen message states 'Error 8 in line xxx' they assume that the line in question has been typed wrong. Not necessarily so. The error is normally linked to a READ statement in the line in question and the actual error is in the DATA that this line is trying to read. So how do you know where the error actually is?

What you need to do is check through the DATA in your program for a mis-type, maybe a full stop instead of a comma, a letter O instead of figure 0 or a comma at the end of a line. If however the program has dozens of lines of DATA as is often the case, how do you know where to look? Fear not, this little program added to the end of your listing will help you to pinpoint the error quite quickly.

32500 ERRLINE=PEEK(183)+256*PEEK (184):ERRITEM=PEEK (182)
32510 ? "DATA MIS-MATCH IN LINE ";ERRLINE;" ITEM NO ";ERRITEM+1 

32520 ? :LIST ERRLINE

 

How to use the listing:

As the listing is so short you could just type it in at the end of each program but a better way is to type it in now and save it to tape using LIST "C:" or to disk using LIST "D: ERROR.8". When you have typed in your program, add this listing by typing ENTER "C:" or ENTER "D:ERROR.8" which will then add these lines to the end of your program. (Make sure that the program does not already use the same line numbers.)

You now have two choices. RUN your program and if 'ERROR 8' comes up, type GOTO 32500 and you will find out where the error is. Alternatively you can automate the process by adding the following line to your program

0 TRAP 32500

and the program will then jump straight to the routine.

Once you have edited the line concerned, RUN the program again until you have no more errors. It is a good idea to SAVE the edited program regularly or note separately each alteration as some programs do not allow you to break and save them once they are up and running.

A Final Warning.

This little routine is not infallible. Some programs read numbers into a variable followed by letters into a string and the errors come when you get out of sequence. Always check that you have enough DATA in the preceding line usually numbers). If you have made a complete mess, such as missing out a whole line, then I am afraid you are back on your own!

Try the routine anyway, it could save you many frustrating hours.

top