Menu

OPEN/RANDOM/LEN=255: FIELD #1, 255 AS D$

2015-12-09
2015-12-10
  • Ronald Herrera

    Ronald Herrera - 2015-12-09

    Hi, the FIELD #1, 255 as D$ makes an Illegal function call when is used with OPEN "filename" FOR RANDOM as #1 LEN=255. GWBASIC apparently respond OK with this.

    OPEN "FILENAME" FOR RANDOM AS #1 LEN = 255: FIELD #1, 255 AS D$

    Ron.

     
    • Rob Hagemans

      Rob Hagemans - 2015-12-09

      The Illegal function call is caused by the OPEN statement, because 255 is greater than the default maximum record length of 128. This is the same behaviour as GW-BASIC.

      You can extend the maximum record length with max-reclen=255 or, on the command line, pcbasic -s=255. Likewise, you can make GW-BASIC allow this with GWBASIC /s:255.

       
  • Ronald Herrera

    Ronald Herrera - 2015-12-09

    Okay, so this means that I can use the option (max-reclen=255), and the OPEN statement will behave just like GWBASIC? I ask because in GWBASIC I opened the same file with the same specifications superseding the default (128) and it accepted it without the error. So I will fix the option: max-reclen=255 at PCBASIC.INI. Thank you, very much.

    Ronald.

     
    • Rob Hagemans

      Rob Hagemans - 2015-12-10

      Which version of GW-BASIC do you use?
      The PC (as opposed to Tandy) version 3.23 that I use for testing has a maximum record length of 128 and gives an illegal function call on the OPEN statement as given above. This is also in line with the Microsoft documentation (though that doesn't mean much). Other versions may behave differently though. Anyway, setting the max-reclen=255 or higher will indeed allow the statement.

       
  • Ronald Herrera

    Ronald Herrera - 2015-12-10

    Yes! You're right. I'm using 3.20 Tandy GWBASIC to emulate Tandy/PCJR programs. That's what my father had in the mid 80's. The version 3.23 causes the same error. So PC-BASIC is emulating the 3.23 ver., until now. I see, now, what you were telling me about the command line /s:255. So with the PCBASIC option I handle the 255 bytes quite right, thanks again. /Ron.

     
    • Rob Hagemans

      Rob Hagemans - 2015-12-10

      It's interesting to see that Tandy GW-BASIC was set up differently in this regard. Perhaps I can change the settings for preset=Tandy to reflect this,

       
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.