Search code examples
file-iobasicbusiness-basicbbj

What is error 31 in BBx (Business Basic)?


I am currently trying to transfer a few thousand records out of a MULTIKEYED file to a flat STRING file, that is building a large SQL INSERT statement to take the data off of our servers FILE bases system to insert into SQL Server for testing.

I have successfully done this with a few other files with a very similar program, but this one keeps producing error 31 workspace overflow, I have tried shortenign the length of the string, the array, and filtering through the file so I only get records with a date newer than Feb 15 2012

here is a snippet fro mthe online help from BBx about error 31:

!ERROR=31 - Workspace Memory Overflow For BBj-specific information, see !ERROR Changes in BBj.

Insufficient workspace memory. Allocating a larger workspace with the START verb can correct this error.

•Attempting to dimension a large string or array.

•Attempting to LOAD a large program.

•Attempting to manipulate a large string.

•Attempting to READ or WRITE a large record.

•Attempting to edit a program that would cause the program to become larger than available memory.

•Attempting to make a program longer than allowed, even if there is enough memory.

•Attempting to enter a console mode command whose compiled length is greater than 256 bytes.

I am fairly confident I am not breaking any of these conditions

any ideas?

0001 STRING "/u/x/scc/scott.sql"
0002 OPEN (1)"/u/x/scc/scott.sql"
0004 LET ARRAYLEN=27
0005 DIM A$[1:ARRAYLEN]
0010 OPEN (2)"V1OEMF"
0015 LET K$=""; READ (2,KEY=K$,DOM=0016)
0020 LET K$=KEY(2,END=15000)
0030 READ (2,KEY=K$)A$[ALL]
0035 FOR I=1 TO ARRAYLEN STEP 1; IF A$[I]="" THEN LET A$[I]=".."; NEXT I
0036 FOR I=1 TO ARRAYLEN STEP 1
0039 IF POS("'"=A$[I])<>0 THEN LET A$[I](POS("'"=A$[I]),1)=" "; GOTO 0039
0040 NEXT I
0050 IF A$[14]<"B20215" THEN GOTO 0020
0080 PRINT "INSERT INTO WMS.dbo.V1OEMF VALUES ('"+A$[1]+"','"+A$[2]+"','"+A$[4
0080:]+"','"+A$[5]+"','"+A$[6]+"','"+A$[7]+"','"+A$[8]+"','"+A$[9]+"','"+A$[12
0080:]+"','"+A$[14]+"','"+A$[25]+"','"+A$[27]+"');"
0100 GOTO 0020
15000 CLOSE (1); CLOSE (2)

Solution

  • Moving the Next I on line 35 to its own line, it is not getting executed if the IF statement is false