Comment by bitwize
8 hours ago
One feature that Business BASIC did have even way back in 1975 that I really appreciate is some form of exception handling: just about every I/O operation had, as a required argument, at least one line number to jump to in case of failure. Some required several, for different types of failures (file not found, I/O error, etc.).
That code you looked at must have been incredibly old! I think that BBj and ProvideX both added structured-programming features to make working in their environments at least somewhat tolerable. As intolerable as we find it today, Business BASIC was really a breath of fresh air in its time compared to the alternatives, like COBOL...
I dug up to code to make sure I was remembering properly and, oh boy, I was! There's a header on the file that indicates a revision date of 2011. I wonder if the coding style isn't based on style-guidelines at the MAS 90 customization company. I'm betting they have code going back decades, and keeping a consistent style is probably a win (even if the style is eye-gougingly bad to read). I do see they've adopted a mix of numeric line numbers and alphanumeric labels.
I'm used to "ON ERR GOTO"-type error handling in BASIC dialects, whereas in this code I'm seeing a lot of defensive "IF ERR=xxx" after API calls. It looks like they're also "cleverly" using the division by zero handler as an "escape hatch" out of a subroutine. To paraphrase some their code:
> 31338 IF ERR=15 THEN LET ERRMSG$=MSG(-1) ELSE IF ERR=14 THEN GOSUB DB_LOGIN; IF NO_CONNECT THEN LET a=1/0 ELSE GOTO 31337
That's the stuff!
Apparently they didn't make use of line renumbering (or the ProvideX environment doesn't support it) because I see features and error-handling shoehorned in between lines numbered ascending by 10. It reminds me of 9 y/o me shoehorning in new code when I was trying to write text adventure games using a unique INPUT / IF/THEN / GOTO block for each "room" of the game.