|
Nigel,
You don't have to allocate any storage if you don't want to (except for the
heading area of the user space). There is an API to retrieve a pointer to the
user space. You can add the offset length for entries to "retrieve" your
information without really moving it. You need to declare a based structure
that defines the structure of the API's entries. These are usually defined in
QSYSINC with the name of the list API. The API that retrieves a pointer to the
beginning of a user space is QUSPTRUS and it is very simple to use. The only
tricky part is pulling in the offset to the beginning of data and the entry
lengths. This information may depend on the API used to load the user space
and should be in the list API's documentation. The definition usually comes
from QSYSINC/QRPGLESRC QUSGEN format QUSH0100. The offset to the first entry
is in QUSOLD.
David Morris
>>> <nigel.percy@pocruises.com> 04/14 8:32 AM >>>
Hi All,
Could someone give me some advice regarding using ILE RPG and list
API's via user spaces. As you know you can manipulate data in user
spaces via pointers in ILE RPG. If I going to be retrieving data via
an API into a user space and I have no idea how much data is going to
be returned, what do I set the Data Structure/Array Size to?
If I set it 'Really Big' this will obviously have a negative impact on
the amount of storage that the pgm uses.
You can't use dynamic allocation because I don't know how items are
going to be returned via the API.
The pointer method seems to be at a disadvantage when compared with
using the QUSRTVUS and incrementing the offset
Please someone tell me I got it wrong and that the pointer method is
the way to go.
Nigel Percy
_______________________________________________________________
Please note that the e-mail address for
P&O Cruises has changed to @pocruises.com
+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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 mailing list archive is Copyright 1997-2025 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.