×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Yes, you use ALLOC the 1st time, and REALLOC every record after that.  It
would help performance some to ALLOC 500 hundred records, though it seems
extremely fast just ALLOCating 1 record at a time.

> ----------
> From:         M. Lazarus[SMTP:mlazarus@ttec.com]
> Reply To:     RPG400-L@midrange.com
> Sent:         Friday, December 08, 2000 1:01 PM
> To:   RPG400-L@midrange.com
> Subject:      RE: Based variables
> 
> At 12/8/00 11:33 AM -0600, you wrote:
> >The way you do this is to NOT use a field, ONLY use a pointer that is
> first
> >Allocated to 1 record, and then Reallocated for an additional record each
> >time you read another record in.  This creates a completely dynamic and
> >contiguous memory block that holds the records for the file.  The
> externally
> >described Data Structure to the file is Based on a Pointer, and you
> >re-calculate this pointer to the correct position in the dynamic memory
> >block.
> 
>   Let me get this straight.  If the DS is based, the pointer is set for
> the 
> first record read.  I increment the pointer to point to the byte right 
> after the DS.  How do I know I'm not stepping on some valid data in 
> memory?  Do I use ALLOC / REALLOC to reserve it?  If yes, then that should
> 
> work well.
> 
>   Does it make sense (performance wise) to only add one record to the 
> memory allocation?  Or should I just add, say, 500 records worth.
> 
> 
> >Another technique in the RPG Programmer's guide is to create a Linked
> List.
> >The problem with this is that it requires at least 2 pointers per record,
> >and possibly 3, and creates a lot of pointer management issues.  The
> above
> >technique requires only 1 pointer for the data, and an additional pointer
> >for the Based Data Structure.
> 
>   I agree that a linked list is too complicated for this application.
> 
>   -mark
> 
> +---
> | This is the RPG/400 Mailing List!
> | To submit a new message, send your mail to RPG400-L@midrange.com.
> | To subscribe to this list send email to RPG400-L-SUB@midrange.com.
> | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
> | Questions should be directed to the list owner/operator:
> david@midrange.com
> +---
> 
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.