• Please review our updated Terms and Rules here

MODEL II BASIC ?BN ERROR

The problem would be on line 30 would it not?
The BASIC manual I downloaded from here doesn't list any BM. Looking at the TRSDOS II manual, :2 would mean the system is checking the third drive. Does the system have 3+ drives?

I was guessing it meant Bad Media but that could be from completely different system so I am disappointed that the manual doesn't include it.
Thanks for the reply. Yes there is a drive 3 that has the COBOL source code files.
Capture.PNG

I tried the open with :1 (assuming that would look on drive 2) and got this error
Capture.PNG
I tried opening a file on drive 3 and got this error
Capture.PNG
 
?BM Error is "Bad file mode"

(source: GWDATA.ASM from the GWBASIC source code)

That means things like you've opened a file in a record-oriented mode and trying to read it in a character-oriented mode, etc. Since it's on the OPEN command, the file itself probably has an attribute that doesn't allow for text input.
I used the IMPORT2 (see trs80gp-2.4.11.html). the file imported is a standard notepad text file that is a directory listing of an IMD diskette.
 
I used the IMPORT2 (see trs80gp-2.4.11.html). the file imported is a standard notepad text file that is a directory listing of an IMD diskette.
AO = file already open (probably the file number, possibly the disk file)
I formatted a new the IMD and ran the the same command to import the DIR/TXT

trs80gp.exe -m2 -frehd -hx -d1 m2-trsdos-util.dmk -d2 XFER.IMD -d3 70050121.IMD -iw Date -i "06/21/2023\r\rIMPORT2 DIR.TXT DIR/TXT:2\r


I could not open the file in BASIC. I killed that file created a file in BASIC did
OPEN "O",1,"DIR.TXT:2".
CLOSE#1
OPEN "I",1,"DIR.TXT:2"
no error. I can open the file without an error.
 
Last edited:
I am a little confused. I see what you are doing though...

We seem to be swapping the '.' and '/' characters. Are we sure on which one we should be using.

The other issue is whether the file is considered to be a sequential text file or a fixed length record file. The two are not necessarily interchangeable at the BASIC level.

Dave
 
I am a little confused. I see what you are doing though...

We seem to be swapping the '.' and '/' characters. Are we sure on which one we should be using.

The other issue is whether the file is considered to be a sequential text file or a fixed length record file. The two are not necessarily interchangeable at the BASIC level.

Dave
The notes regarding IMPORT2 state even if you don't provide the destination name. It uses the source name and replaces the . with a /

I'll try opening as a direct file.
 
The notes regarding IMPORT2 state even if you don't provide the destination name. It uses the source name and replaces the . with a /

I'll try opening as a direct file.
I tried opening the same file with using the "R" or "E" mode. But get the ?BM error. I can open it with "O" mode but can't INPUT# or LINE INPUT#. ?BM error too. I suppose I'll try a different model and/or a different OS such as LDOS or XENIX.
 
I don't remember the Model II BASIC being this problematic. I am suspecting something is wrong with the setup of TRS-DOS or the file transfer program but I can't think of a good test.
 
My reading is that if you supply a trs80file it will use whatever name is provided. Only if you omit the trs80file is the '.' changed to a '/'.

Just thinking aloud - do you need to use the IMPORT2 -n switch to convert <newlines> into <returns>?

The other thing you didn't do in post #25 is to try and PRINT# to the file you created and then INPUT# from it.

Is it possible to 'hexdump' the file you are transferring from your host operating system (e.g. DIR.TXT) so we can physically see what it looks like?

Then can you create and PRINT# to a file and EXPORT2 it to your host filesystem and then hexdump that.

Let's see if we can understand what is actually going on.

If it is not the file contents, it may be something in the TRS-DOS directory structure.

Dave
 
Thanks for the reply. Yes there is a drive 3 that has the COBOL source code files.
View attachment 1259548

I tried the open with :1 (assuming that would look on drive 2) and got this error
View attachment 1259545
I tried opening a file on drive 3 and got this error
View attachment 1259546
AO would be "Already Open" meaning the selected file is already open. Also, the file name within the quotes may not support the "/". You may want to check the file procedures for Random access and Sequential access. Syntax is everything within TRDOS - not very forgiving.

Edit: Disregard the comment on "/".
 
Last edited:
My reading is that if you supply a trs80file it will use whatever name is provided. Only if you omit the trs80file is the '.' changed to a '/'.

Just thinking aloud - do you need to use the IMPORT2 -n switch to convert <newlines> into <returns>?

The other thing you didn't do in post #25 is to try and PRINT# to the file you created and then INPUT# from it.

Is it possible to 'hexdump' the file you are transferring from your host operating system (e.g. DIR.TXT) so we can physically see what it looks like?

Then can you create and PRINT# to a file and EXPORT2 it to your host filesystem and then hexdump that.

Let's see if we can understand what is actually going on.

If it is not the file contents, it may be something in the TRS-DOS directory structure.

Dave
I used the -n option but still get an errors
trs80gp.exe -m2 -frehd -hx -d1 m2-trsdos-util.dmk -d2 XFER.IMD -d3 70050121.IMD -iw Date -i "06/21/2023\r\rIMPORT2 -n DIR.TXT DIR/TXT:2\r
Capture.PNG

TRYING PRINT AS YOU SUGGESTED.
Capture2.PNG

I'M DONT KNOW HOW TO DO A HEX DUMP I SHARED THE FILES DIR.TXT IS THE FILE USED IN ALL THE TESTING SO FAR

ANOTHER TEST

Capture4.PNG
HERE ARE THE FILES
https://u.pcloud.link/publink/show?code=kZj9WUVZQ76IC12Q0mhtTqctqR8AsLiEOdpk

Thanks for your assistance
John
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    88.9 KB · Views: 1
Unfortunately your BASIC code is incorrect in pretty much every case I am afraid. The error reports are real!

You can't open a file for output "O" and then INPUT from it. Bad Mode.

When you then close the output file it will then be empty. So when you try to INPUT from it you will get an Empty File error.

If you open a file for INPUT "I", you can't then PRINT to it. Bad Mode error.

Your last program looks correct.

However, can you re-attempt the BASIC programs again please. OPEN for OUTPUT "O" and then PRINT to the file. OPEN for INPUT "I" and then INPUT from the file.

>>> Thanks for your assistance.

No problem, it is interesting trying to remember stuff I did so many years ago 😀!

Dave
 
Unfortunately your BASIC code is incorrect in pretty much every case I am afraid. The error reports are real!

You can't open a file for output "O" and then INPUT from it. Bad Mode.

When you then close the output file it will then be empty. So when you try to INPUT from it you will get an Empty File error.

If you open a file for INPUT "I", you can't then PRINT to it. Bad Mode error.

Your last program looks correct.

However, can you re-attempt the BASIC programs again please. OPEN for OUTPUT "O" and then PRINT to the file. OPEN for INPUT "I" and then INPUT from the file.

>>> Thanks for your assistance.

No problem, it is interesting trying to remember stuff I did so many years ago 😀!

Dave
output works,input fails
Capture1.PNG

input without output same error
Capture2.PNG
 
But haven't we already ascertained that some of the statements cannot be executed in direct mode but must form part of a program? EDIT: Yes, see post #12.

Please write a small BASIC program (with line numbers) as you did previously.

Dave
 
Using IMPORT2 -NE DIR.TXT DIR/TXT:1 works.

BASIC requires a logical record length of 1 which the "E" option sets.

There may be a way for BASIC to open files with different logical record lengths.
 
The OPEN function supports different record sizes with the default record size being 256 bytes. See page 447.

One oddity I did not recall is that the string following a period in the OPEN statement is the password. The example given is OPEN "D",2,"DATA/BAS.SPECIAL" or the BASIC file named DATA with a password of SPECIAL. That could result in some unexpected results.

Also consider trying INPUT$ instead of INPUT#. It might be easier with the code examples.
 
But haven't we already ascertained that some of the statements cannot be executed in direct mode but must form part of a program? EDIT: Yes, see post #12.

Please write a small BASIC program (with line numbers) as you did previously.

Dave
Sorry, I forgot about the direct mode issue Here is a test using a program with line numbers
Capture1.PNG
Looked promising until
Capture2.PNG
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    86.8 KB · Views: 2
Back
Top