Page 1 of 1

OUT OF STRING SPACE andOUT OF DATA SPACE

Posted: Thu Aug 07, 2008 10:12 pm
by JIMMMMYG
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 !!!

STRINGs

Posted: Thu Aug 07, 2008 11:40 pm
by burger2227
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

Posted: Thu Aug 07, 2008 11:55 pm
by Ralph
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.

Posted: Fri Aug 08, 2008 9:22 am
by MystikShadows
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.

Posted: Fri Aug 08, 2008 1:47 pm
by moneo
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

??????

Posted: Fri Aug 08, 2008 6:27 pm
by burger2227
What error code is returned for "Out of Data Space"?

Never saw it listed anywhere.

Posted: Fri Aug 08, 2008 7:41 pm
by MystikShadows
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

Re: ??????

Posted: Fri Aug 08, 2008 8:43 pm
by moneo
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

THANKS

Posted: Sat Aug 09, 2008 2:09 pm
by JIMMMMYG
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..

Re: THANKS

Posted: Sun Aug 10, 2008 6:39 pm
by moneo
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

Posted: Sun Aug 10, 2008 7:52 pm
by Nodtveidt
Could be a chained sort of some kind.

Posted: Sun Aug 10, 2008 9:18 pm
by burger2227
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!

sort this problem

Posted: Mon Aug 11, 2008 10:39 am
by JIMMMMYG
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

Posted: Mon Aug 11, 2008 12:51 pm
by MystikShadows
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.

Posted: Mon Aug 11, 2008 7:11 pm
by MystikShadows
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 :)

SORT

Posted: Tue Aug 12, 2008 12:33 am
by JIMMMMYG
THANKS MYSTIC !!!
I WILL LOOK INTO THIS ONE !

THANKS TO ALL