[comp.sys.ibm.pc] Problems with the Random Open statement in Basic

wiltonh@copper.TEK.COM (Wilton Hart) (05/04/88)

There seems to be a bug in Basic which keeps me from running some of the 
public domain programs.  It is related to the reclen in the open statement.
If reclen is longer than 128 it gives an error message.

Example:  10 OPEN "R",1,"file",128

This statement works but if you increase reclen to any larger value it fails.
My manual says that reclen is assumed as 128 if you do not put in a value and
that it can go from 1 to 32,768. 

I have tried this in Dos Version 3.2 and 2.1 as well as some other versions.

Does anybody know why this fails?


Path     wiltonh@compdat.LA.tek.com        The work ethic is only for those
                                           who do not know about windsurfing.

wcf@psuhcx.psu.edu (Bill Fenner) (05/06/88)

In article <1973@copper.TEK.COM> wiltonh@copper.TEK.COM (Wilton Hart) writes:
<There seems to be a bug in Basic which keeps me from running some of the 
<
<Example:  10 OPEN "R",1,"file",128
<
<This statement works but if you increase reclen to any larger value it fails.
<My manual says that reclen is assumed as 128 if you do not put in a value and
<that it can go from 1 to 32,768. 
<
<Does anybody know why this fails?
<

Yeah.  You need to specify /s:xxxx on the BASIC command line when you start
it from DOS (I.E. BASICA /s:xxxx or GWBASIC /s:xxxx or whatever)

Microsoft decided to do this to save buffer space... I think, and probably
a lot of people think, that they should have made the default a *bit*
larger... in older versions of MS-BASIC (I.E. the BASIC for my TRS-80
Model I yes Microsoft wrote that) the default is 256 bytes.

    Hope this helped...
-- 
   __      _  _      _____   Bill Fenner     Bitnet: wcf @ psuhcx.bitnet
  /  )    // //       /  '                   Internet: wcf @ hcx.psu.edu
 /--<  o // //     ,-/-, _  __  __  _  __    UUCP: ihnp4!psuvax1!psuhcx!wcf
/___/_<_</_</_    (_/   </_/ <_/ <_</_/ (_   Fido: Sysop at 263/42

leonard@bucket.UUCP (Leonard Erickson) (05/07/88)

In article <1973@copper.TEK.COM> wiltonh@copper.TEK.COM (Wilton Hart) writes:
<There seems to be a bug in Basic which keeps me from running some of the 
<public domain programs.  It is related to the reclen in the open statement.
<If reclen is longer than 128 it gives an error message.
<
<Example:  10 OPEN "R",1,"file",128
<
<This statement works but if you increase reclen to any larger value it fails.
<My manual says that reclen is assumed as 128 if you do not put in a value and
<that it can go from 1 to 32,768. 

It fails because Basic assumes a maximum record length of 128 unless you use
the /s option to set it to a different value on the command line. This is 
explained on page 2-5 of my IBM BASIC manual. Try looking under "options"
near the beginning of the table of contents on your BASIC manual...

-- 
Leonard Erickson		...!tektronix!reed!percival!bucket!leonard
CIS: [70465,203]
"I used to be a hacker. Now I'm a 'microcomputer specialist'.
You know... I'd rather be a hacker."