Undefined Line Number
Sharp Sharp MZ
Severity: MinorWhat Does This Error Mean?
Undefined Line Number means a GOTO, GOSUB, or ON/GOTO branch points to a line number that does not exist in the program. Use LIST to review all line numbers and correct the branch to point to a valid one.
Affected Models
- Sharp MZ-80B
- Sharp MZ-80K
- Sharp MZ-700
- Sharp MZ-800
- Sharp MZ-1500
Common Causes
- GOTO or GOSUB references a line that was never written
- Target line accidentally deleted
- Line numbers renumbered but branch statements not updated
- Typo in the line number (e.g. GOTO 100 when line 1000 exists)
How to Fix It
-
Note the line number in the error message.
The Sharp MZ BASIC reports the line containing the bad GOTO or GOSUB. Type LIST and go to that line to see what it branches to.
-
Type LIST to view all line numbers.
Scroll through the full listing. If the target line number does not appear, the branch is referencing a line that was deleted or never existed.
-
Update the GOTO or GOSUB to point to an existing line.
Retype the branch line with the correct target. For example, if GOTO 200 fails because 200 was deleted but 210 exists, retype: 50 GOTO 210
-
After renumbering, update all branch statements manually.
The Sharp MZ BASICs do not automatically update GOTO/GOSUB references when renumbering. After any renumbering, search every GOTO, GOSUB, THEN, and ELSE for stale line numbers.
Frequently Asked Questions
How do I list just one line on the Sharp MZ?
In most Sharp MZ BASICs, LIST followed by a line number lists only that line. For example: LIST 100 shows line 100. LIST 100,200 lists lines 100 through 200 (syntax may vary by BASIC version).
Why did tape programs for the Sharp MZ often have gaps in line numbers?
Magazines published programs with line numbers in steps of 10 (10, 20, 30) to allow readers to insert corrections or additional lines between existing ones. This was standard practice across all 8-bit BASIC machines.