Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
QB45 Error msgs Out of --Data,-String,-Stack space
#21
1.-If you run out of stack space, I suppose you are clever enough to not quit a GOSUB by a GOTO, so you may be using recursion(calling a FUNCTION from itself) .I suppose you have a working end of recursion condition. Try to make STATIC as many local variables as you can, specifically strings.

2.-Supposing the ID's were assigned sequentially at data entry, you can work directly from your file, if you convert it to fixed length field (RANDOM files in QB) . In this case you can ask QB to read just the record with the ID xxx so you could retrieve each name just before printing it. A program creating a RANDOM file from your ASCII file is easy to do...

3.-I suppose you are using many string arrays, in this case $DYNAMIC will not arrange anything. You should use fixed length string arrays, as $DYNAMIC works with them.
Antoni
Reply
#22
****. Enteries are in random order as the data was obtained, anybody in the list could have any ID number. Each persons entry does have the associated ID's for Father and Mother.
***THE ID NUMBER AND THE ABOVE "POINTER" IS THE SAME, RIGHT? Yes.
YOU MAKE SURE THAT THESE ID'S ARE UNIQUE, RIGHT? The data entry program takes care of this, such that ID numbers can only be unique.
THE PERSONS FILE IS A FLATFILE (ASCII) WITH COMMA DELIMITERS BETWEEN FIELDS, RIGHT? Yes

The program allows using any name with its ID as the individual whose pedigree is to be constructed, I.E. My number is 6, mother maybe 3, father 2. etc. Program retrieves the data of the initial designated individual placing it and related info, in an array location with calculated subscript such that it is in the center of the array, not the first item.
*****I DON'T UNDERSTAND WHY YOU PLACE IT IN THE CENTER OF THE ARRAY, BUT CONTINUE. It's the only way I know to organize the printout so top line is last generation name for a given chart, and each succeeding line steps down to next generation etc, so the person whose pedigree is being printed, ends up in the middle of the chart (Vertically), but he is the first person whose data is read, as the user of the program is prompted for the ID number of this person, and that becomes the key to start the ball rolling with further accesses progressing to his parents, then their parents parents etc.
The Persfile itself cannot be previousl arranged in pedigree order, as this would only be good for one individual plus the data only came spradically in random order at different times and they were entered as available ****



Father and mother are retrieved in sequence and located with father above and mother below the designated individual in the array. Each of parents are then in
turn processedfor their parents, etc, so array assignments expand outward from the center and end with the oldest ancestor, who is then in the first location of the array.
***LET'S SEE, FOR A GIVEN PERSON, YOU HAVE TO READ THROUGH THE PERSONS-FILE SEQUENTIALLY UNTIL YOU FIND HIM BY ID. THEN YOU HAVE TO GO THROUGH THE FILE AGAIN TO FIND THE MOTHER, AND THEN AGAIN FOR THE FATHER. IF THE GIVEN PERSON HAS 4 OR 5 GENERATIONS OF FAMILY MEMBERS, YOU'REE GOING TO SPEND A LOT OF TIME READING THAT FILE. IS THAT THE WAY IT WORKS?**** No. *** The Persons File is opened for random and accessed as below, with all the data required for a given individual, to be used in the chart read out at one time.
2650 REM Open the Persons File
2660 LOCATE 10, 1: PRINT "Open the Persons File"
2670 OPEN DR$ + "persfile" + EXT$ FOR RANDOM AS #1 LEN = 256
2680 FIELD 1, 5 AS F1$, 20 AS F2$, 30 AS F3$, 7 AS F4$, 5 AS F6$, 5 AS F7$, 11 AS F8$, 50 AS F9$, 11 AS F12$
2685 GET #1, 400: MAX = ABS(CVSMBF(F1$)): IF PR < 1 OR PR > MAX THEN GOTO 2580**i.e a no good number enter another number
LOCATE 9, 1: PRINT "FRE @ 2685= "; FRE(""), FRE(0), FRE(-1)**********


!
-------------
Some suggestions:
1) The easist way to access the Persons-File would be by setting it up as a Random File, so you can get to a particular person record directly. ***OK, I'M DOING THAT)****
If you can't or don't want to use a Random file, then I have the following 2 suggestions:
2a) Figure out if your entire Persons-File will fit in memory, and do the whole operation in memory.
2b) If not, make an initial pass reading the Persons-File and just suck in the ID-Numbers into memory. Do all the lookup stuff in memory, and then when you've got the list of ID's that you want to printout, read the Persons-File again (one time sequentially) to bring in the other data fields that you want to print. This last part should fit comfortably into one array.
******** AS INDICATED ABOVE I SEE NO WAY TO ORGANIZE THE PERSONS FILE AHEAD OF TIME. I MIGHT STICK MORE STUFF IN IT TODAY AND THE ID'S WOULD JUST ADD ABV THE NEXT HIGHER AVAILABLE NUMBERS
Good luck!

*****[/quote]

Let me say I feel deeply indebted for your sticking with me on this, and I really didn't intend to engage you or others in unending discourse. Just for kicks I'll send you a few short excerpts off list which may illustrate things I haven't been able to adequately describe.
Cheers and many thanks again.
Bdecker
Reply
#23
Quote:1.-If you run out of stack space, I suppose you are clever enough to not quit a GOSUB by a GOTO, ****I don't believe I've done that anywhere*********

***so you may be using recursion(calling a FUNCTION from itself) .I suppose you have a working end of recursion condition***I'm using a big, nested For Next Loop to access successive, selected names from the file, process the data and store it in an appropriate pigeon hole in the array. Then return for the next one etc. ******

Try to make STATIC as many local variables as you can,
****The string variables = the complete line of info on each person, composed as necessary for print out, cannot be fixed length, as data avalable for different person may be greater or lesser for one than for another. Using one fixed length would have to be as big as the longest expected length for everybody which would use more space? I think.*********

2.-Supposing the ID's were assigned sequentially at data entry, you can work directly from your file, if you convert it to fixed length field (RANDOM files in QB) . In this case you can ask QB to read just the record with the ID xxx so you could retrieve each name just before printing it. A program creating a RANDOM file from your ASCII file is easy to do...**********See my answer to previous post next abv.***


3.-I suppose you are using many string arrays, in this case $DYNAMIC will not arrange anything. You should use fixed length string arrays, as $DYNAMIC works with them******Not sure of your meaning here The array by itself in my application, does not arrange anything,--the processing code calculates the appropriate subscript to be used for each given name and puts its descriptive string in the calculate location, so after all processing, the final array is arranged in direct print out order , from top to bottom..

Thanks Antonio I certainly appreciate your interest and comments
Bdecker
Reply
#24
I just noticed that 12 generations will need a 2048 rows by 370
columns PrintImage array.Right?... Where do you print it? A plotter?

And 12 generations is 240 years back...Where do you find so old records?

Well, first of all, this 800 K array will not fit into heap so you have two options:
-Store your printimage in EMS/XMS or in a file. The printimage should include the names and all lines involved in the printout.

-If you can find the way to print randomly a single name in the appropiate position you could avoid the memory problems and make the program undefinitely expandable (13, 14 generations)
Antoni
Reply
#25
Quote:I just noticed that 12 generations will need a 2048 rows by 370
columns PrintImage array.Right?... Where do you print it? A plotter?

*******Hi Antoni,
Just tried to send an item by item reply, but it was scrubbed by the system somehow. Will have to try again tomorrow as it's getting way past my bedtime. Thanks for your followup and helpful suggestions.
Bdecker***********

And 12 generations is 240 years back...Where do you find so old records?

Well, first of all, this 800 K array will not fit into heap so you have two options:
-Store your printimage in EMS/XMS or in a file. The printimage should include the names and all lines involved in the printout.

-If you can find the way to print randomly a single name in the appropiate position you could avoid the memory problems and make the program undefinitely expandable (13, 14 generations)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)