OUT OF STRING SPACE andOUT OF DATA SPACE

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
User avatar
JIMMMMYG
Newbie
Posts: 4
Joined: Thu Aug 07, 2008 9:41 pm
Location: De Berry, TEXAS

OUT OF STRING SPACE andOUT OF DATA SPACE

Post by JIMMMMYG » Thu Aug 07, 2008 10:12 pm

OK I LOOKED THROUGH SEVERAL SEARCHES BUT MY PROBLEM IS A LITTLE DIFFERENT.
i HAVE A PROGRAM THAT REQUIRES DATA INPUT FOM AN OUTSIDE SOURCE AND ONE OF THE "DIM" ARRAYS IS NOW AT "R$(4001)
WHICH CAUSES AN ERROR SCREEN OF "OUT OF STRING SPACE"

AFTER REDUCING SOME OTHER "DIMS" THE ERROR IS NOW "OUT OF DATA SPACE"
ALREADY USE ---- "CLEAR , , 5000"
IS THERE ANOTHER CLEAR COMMAND OR QBASIC PROPERTY THAT HELP ME???
ALL SUGGESTIONS WILL BE TRIED !!!
JIMMMMYG

User avatar
burger2227
Veteran
Posts: 2435
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

STRINGs

Post by burger2227 » Thu Aug 07, 2008 11:40 pm

String Space cannot exceed 32,767 string characters, whether printed or kept in an Array. If you have 4K elements how long are the strings held in them? Each character of a string takes 1 byte of memory.

To reduce memory type problems, etc. try creating some SUB programs. SUBs release the memory used when they are exited. I've never seen an "Out of Data Space" message.

Ted
Last edited by burger2227 on Fri Aug 08, 2008 1:09 am, edited 1 time in total.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

Ralph
Veteran
Posts: 148
Joined: Fri Feb 09, 2007 3:10 pm
Location: Katy, Texas

Post by Ralph » Thu Aug 07, 2008 11:55 pm

My IBM BASIC handbook speaks of:

Error 4 - Out of data, caused by a READ statement trying to read a DATA after the last data was read. One can re-read data by using the RESTORE staement. But, there is no "Out of Data Space" error listed there.

Error 14 - Out of string space, which I think burger77 explained very well. My QuickBASIC 4.5 Help also shows, under Types, the 32,767 byte limit for strings.
Ralph, with QuickBASIC 4.5, operating under Windows XP, wiht anHP LaserJet 4L Printer. Bilingual in English/Spanish

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Fri Aug 08, 2008 9:22 am

QBASIC, as mentioned in the original post, has a limit of 160Kb for both Code and Data. Perhaps you've reached that limit (depends on how big your code (you .bas file) module is.

Perhaps it's time to find yourself QuickBasic which doesn't have this limit. Either that or for the sake of getting the program to run, see where you can streamline your code if at all possible.
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Post by moneo » Fri Aug 08, 2008 1:47 pm

Yes, there is an "Out of data space" error.

For both the "Out of data space" and the "Out string space", as well as the "Out of memory" errors, the Quickbasic manual recommends:

* Use a smaller file buffer in the OPEN statement's LEN clause.
* Use the $DYNAMIC metacommand at the top of your program.

I hope these suggestions work for you.

Regards..... Moneo

User avatar
burger2227
Veteran
Posts: 2435
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

??????

Post by burger2227 » Fri Aug 08, 2008 6:27 pm

What error code is returned for "Out of Data Space"?

Never saw it listed anywhere.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Fri Aug 08, 2008 7:41 pm

IT seems that you can get more than one error message depending on version number and such. It's on the Microsoft knowledge base right here: http://support.microsoft.com/kb/58023
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Re: ??????

Post by moneo » Fri Aug 08, 2008 8:43 pm

burger2227 wrote:What error code is returned for "Out of Data Space"?

Never saw it listed anywhere.
Curiously enough, my Quickbasic manual has error code 7 for both "Out of data space" and "Out of memory."

Regards..... Moneo

User avatar
JIMMMMYG
Newbie
Posts: 4
Joined: Thu Aug 07, 2008 9:41 pm
Location: De Berry, TEXAS

THANKS

Post by JIMMMMYG » Sat Aug 09, 2008 2:09 pm

I HAVE NOT BEEN ABLE TO TRY THE SUGGESTIONS .... YET
BUT I WILL
I DO TEND TO PUSH THE LIMITS ON MY PROGRAMS AND THEN WIND UP CUTTING IT DOWN ...SPLITTING IT UP AND "CHAINING" THE PROGRAMS TOGETHER.//
ALSO, IF ANYBODY NEEDS IT , I HAVE A THREE DEMINSIONAL SORT ROUTINE WHICH I HAVE USED FOR THE LAST 20 YEARS. I CREATED IT ONE CHRISTMAS AT THE DINING TABLE..
JIMMMMYG

moneo
Veteran
Posts: 451
Joined: Tue Jun 28, 2005 7:00 pm
Location: Mexico City, Mexico

Re: THANKS

Post by moneo » Sun Aug 10, 2008 6:39 pm

JIMMMMYG wrote: .....
I HAVE A THREE DEMINSIONAL SORT ROUTINE WHICH I HAVE USED FOR THE LAST 20 YEARS.....
What is a three-dimensional sort, and what do you use it for?

Regards..... Moneo

User avatar
Nodtveidt
Veteran
Posts: 826
Joined: Sun Jul 25, 2004 4:24 am
Location: Quebradillas, PR
Contact:

Post by Nodtveidt » Sun Aug 10, 2008 7:52 pm

Could be a chained sort of some kind.

User avatar
burger2227
Veteran
Posts: 2435
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 » Sun Aug 10, 2008 9:18 pm

I think he is talking about sorting a 3 dimensional array.

I sure hope he finds that CAP LOCK key and quits yelling at us!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0

User avatar
JIMMMMYG
Newbie
Posts: 4
Joined: Thu Aug 07, 2008 9:41 pm
Location: De Berry, TEXAS

sort this problem

Post by JIMMMMYG » Mon Aug 11, 2008 10:39 am

lets say that you have 12 students (H) -- 1 to H
each student has 32 courses (L)
and each student has different grades in each course, of course, buy you want to rank them from 1 to 12 and print it on one page with student's name on the left side vertically - the course accross the top and their rank in each under that.
what kind of sort routine would you use ?????
-- there are no caps in this one
:D
JIMMMMYG

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Mon Aug 11, 2008 12:51 pm

I would have a hidden "total" column that's not shown on the screen and use that to sort the records. Total or an average would work fine.

You total the courses up put it in the hidden total column and you do any sort on that total column. then you just sort the array based on that last column. using SWAP to swap the rows of data as needed to move the student's scores to the right position in the array based on that total (or average) field.

This way you don't have to worry about the scores of each 32 courses. on a global scale the one with the highest total (or the biggest average) is the one that belongs in the first position, and so on and so forth for the other students . ;). Now that I wrote this, average probably gives a more realistic value to work with...assuming the following scenario:

Suppose one student has 80% in all his/her courses
Suppose another student failed 2 courses but had 100% in all other courses.

Which deserves to go at the top of the list?

Student 1 has a total of 2560
Student 2 has a total of 3100 but failed 2 courses.

Or this scenario.

same student that failed two courses but has 100% everywhere else
Another student that has 90% everywhere. and let's say both these students have the same total of say 3100 which would give them the same average too. Which goes on top in this case? you could keep tract of how who has the highest notes and evaluate that, 32 90% versus 30 100% and see which deserves the top position. Or you could just use the total and average.

Sound like an interesting challenge to me :). I think I'll be busting my brains a bit on that one.

I'll share my results here.
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com

MystikShadows
Veteran
Posts: 703
Joined: Sun Nov 14, 2004 7:36 am
Contact:

Post by MystikShadows » Mon Aug 11, 2008 7:11 pm

Ok here's what I came up with.

FIrst I generate random scores for the 12 students and 32 courses each. I display that matrix first.

Then I display the student records unsorted and then sort the records based on the following conditions.

1. I sort the records in descending order by Score (biggest score first)
2. I then browse the students and if two students have the same score:
___ I compare the 100% counts (PerfectCount field) and swap then as needed
___ if they're equal I compare the Failure count (FailCount field) an swap if they need to. (this means the student with the least failures go first in the list)
____Now if the two students compared both have the same failures the one with the most 100% goes on top.
____If they both have the same 100% counts the one with the least failures goes on top.
____If they both have different 100% count and failures then ultimately the one with the least amount of failures goes on top. (you can look at the SortStudents routine to see how it works (last routine in the code below).

The code to my student classification idea can be found here:
http://www.symbioticsoftware.net/files/students.txt

here's a sample run:

THE STUDENT SCORE MATRIX:

Code: Select all

  96%  77%  54%  96%  75%  60%  72%  81%  58%  72%  94%  94%
  52%  64%  51%  54%  60%  60%  92%  95%  59%  71%  73%  52%
  89%  88%  73%  75%  77%  62%  63%  63%  95%  91%  84%  57%
  87%  84%  90%  56%  84%  75%  80%  52%  91% 100%  80%  83%
  53%  71%  75%  63%  77%  65%  72%  92%  71%  54%  87%  65%
  70%  86%  54%  87%  99%  54%  67%  51%  71%  90%  73%  83%
  80%  73%  75%  94%  88%  64%  81%  96%  67%  51%  57%  93%
  89%  83%  62%  53%  82%  77%  62%  66%  64%  84%  51%  93%
  81%  79%  84%  67%  97%  95%  80%  75%  98%  70%  61%  92%
  98%  61%  66%  52%  58%  73%  86%  86%  63%  56%  52%  93%
  75%  61%  84%  77%  72%  52%  99%  98%  80%  78%  76%  55%
  80%  95%  63%  85%  63%  97%  91%  95%  62%  91%  86%  98%
  94%  75%  60%  95%  75%  97%  54%  92%  57%  94%  98%  64%
  56%  87%  67%  59%  77%  86% 100%  82%  97%  59%  82%  80%
  66%  56%  64%  96%  61%  67%  72%  82%  57%  54%  81%  96%
  68% 100%  92%  72%  65%  98%  98%  92%  56%  66%  99%  82%
  99%  51%  83%  66%  70%  66%  74%  64%  57%  73%  81%  54%
  93% 100%  78%  65%  51%  74%  74%  90%  61%  76%  73%  93%
  63%  57%  52%  81%  77%  73% 100%  93%  84%  56%  91%  72%
  74%  94%  73%  64%  67%  83%  65%  65%  82%  70%  80%  63%
  65%  95%  60%  56%  77%  68%  76%  94%  70%  97%  72%  90%
  68%  52%  94%  58%  59%  60%  76%  70%  56%  99%  63%  61%
  87%  58%  68%  74%  83%  53%  93%  60%  61%  56% 100%  54%
  66%  80%  93%  82%  71%  89%  62%  66%  78%  74%  81%  76%
  57%  75%  60%  83%  63%  71%  77%  52%  65%  88%  91%  93%
  97%  57%  79%  51%  63%  54%  62%  77%  88%  84%  54%  86%
  95%  71%  74%  89%  97%  82%  76%  62%  73%  92%  52%  84%
  67%  71%  53%  65%  59%  85%  97%  94%  79%  54%  69%  77%
  88%  84%  57%  53%  67%  94%  80%  70%  59%  92%  66%  74%
  59% 100%  71%  87%  61%  59%  92%  77%  76%  54%  75%  53%
  55%  96%  59% 100%  79%  52%  77%  63%  67%  96%  60%  65%
  64%  98%  80%  88%  98%  87%  80%  56%  89%  58%  88%  55%

press a key to view sorted students
THE STUDENT LIST (UNSORTED THEN SORTED:

Code: Select all

UNSORTED STUDENTS

Student Name       Total Avg.  Ps  Fs
-------------------------------------
Stephane Richard    2431  76%   0   6
Paul Anka           2479  77%   3   6
Dorothy Wilcox      2248  70%   0   7
Mathew Simmons      2343  73%   1   9
Alan Parson         2352  74%   0   4
Mark Baxton         2332  73%   0   6
Lucy Witherspoon    2530  79%   2   1
Maria Gandolpho     2451  77%   0   4
Peter Norton        2291  72%   0   8
Terrence Callahan   2400  75%   1  10
Julie Manhattan     2430  76%   1   5
Nathaly Wilson      2430  76%   0   7


SORTED STUDENTS

Student Name       Total Avg.  Ps  Fs
-------------------------------------
Lucy Witherspoon    2530  79%   2   1
Paul Anka           2479  77%   3   6
Maria Gandolpho     2451  77%   0   4
Stephane Richard    2431  76%   0   6
Julie Manhattan     2430  76%   1   5
Nathaly Wilson      2430  76%   0   7
Terrence Callahan   2400  75%   1  10
Alan Parson         2352  74%   0   4
Mathew Simmons      2343  73%   1   9
Mark Baxton         2332  73%   0   6
Peter Norton        2291  72%   0   8
Dorothy Wilcox      2248  70%   0   7


Note to Pete: I tried to do a [ code ] tag to paste the code here instead but got very weird results, missing lines, bad cuttouts of lines. (pasted from a windows editor too) so I included the link above instead.


Hope this helps you Jimmy :)
When God created light, so too was born, the first Shadow!

MystikShadows

Need hosting? http://www.jc-hosting.net

Interested in Text & ASCII development? Look no further!
http://www.ascii-world.com

User avatar
JIMMMMYG
Newbie
Posts: 4
Joined: Thu Aug 07, 2008 9:41 pm
Location: De Berry, TEXAS

SORT

Post by JIMMMMYG » Tue Aug 12, 2008 12:33 am

THANKS MYSTIC !!!
I WILL LOOK INTO THIS ONE !

THANKS TO ALL
JIMMMMYG

Post Reply