[Coco] ? OS ERROR

William Astle lost at l-w.ca
Sun Apr 30 16:22:58 EDT 2023


You're running out of string space. OS means "out of string space". 
There's a fixed amount of space available for "dynamic" strings. A 
dynamic string is one that is not a string constant and is not referring 
to a random file buffer. OD$ in your code refers to the random file 
buffer so doesn't use string space. The "R" and "DW" strings are 
constant and if there were assigned to a variable they would refer to 
the basic program text rather than using string space.

On the other hand, IT$ and D$ are dynamic strings and need string space. 
When you do the D$=IT$ line, you double the amount of string space 
required because it has to make a copy of IT$ to assign to D$. So if IT$ 
is 50 bytes long, then D$ will require an additional 50 bytes.

Anyway, by default 200 bytes of string space are available. If that 200 
bytes is completely filled up, you get the OS error. You'll need to use 
CLEAR to allocate more than 200 bytes of string space. Be aware that 
CLEAR also erases all variables so you need to do that at the start of 
the program. You might try something like CLEAR 1000 and see if that 
makes things work.

Note that if you have string variables whose contents you no longer need 
(temporaries for instance), they may still be using up string space for 
whatever they had assigned to them last. You can get that back by 
assigning an empty string to them.

On 2023-04-30 12:23, coco--- via Coco wrote:
> All
> 
> I am runing a program in Disk Basic that is giving the error
> 
> ?OS ERROR IN 236
> 
> This is a section of the code
> 
> 
> 210 OPEN "R",#1,F$
> 215 OPEN "DW",#2,O$,RL
> 220 FIELD #2,RL AS OD$
> 225 RN=1
> 230 'REPEAT LOOP UNTIL END OF FILE.
> 235 :INPUT #1,IT$
> 236 :D$=IT$
> 
> The error occurs before the loop occurs the test input file I was using 
> was a
> basic program saved in ascii format so the lines were ont exceptionally 
> long.
> 
> Any Ideas what I  may have done wrong.
> 
> Charlie
> 
> 

-- 
William Astle



More information about the Coco mailing list