× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Sorry, my stomach just turned. Returning pointers from programs or service
program calls is just a wonderful way to blow your brains out.

Their a a whole host of reasons that you do not to want to do this. This
most important being that what a user does with that pointer can be
anything. That is a window into your program or service programs. If they
screw up you end with all kinds of issues.

From a design point of view you have an internal data structure that you are
exposing to the outside world. What happens if you need to change it?
Everything that calls it can be invalidated.

The ILE solution I would follow is to have a function in a service program
that reads the data and creates in an internal structure (In memory or a
user space). I then have functions that call and get the data I need. I am
either going to return a data structure with the data I need or have a
function or method for each value I want. I would think about as if I was
designing an object in Java. Their are so many values that could be returned
I would probably do the latter.

The principle is Information Hiding.

So just off the top of my head.

NumberOfObjects = OBJI_LoadObjectInfo(parms you need)

For x = 1 to NumberOfObjects;
OBJI_SetOccurance(x);
ObjectName = OBJI_GetObjectName();
ObjectLibrary = OBJI_GetObjectLibrary();
ObjectType = OBJI_GetObjectType()
... etc
EndFor;

or

For x = 1 to NumberOfObjects;
ObjectName = OBJI_GetObjectName(x);
ObjectLibrary = OBJI_GetObjectLibrary(x);
ObjectType = OBJI_GetObjectType(x)
... etc
EndFor;

Just my opinion.

On Wed, Aug 10, 2011 at 2:46 PM, Dennis <iseries@xxxxxxxxxxxx> wrote:

The way I do it, is to use the copybooks in QSYSINC/QRPGLESRC.
(QSYSINC/QRPGLESRC.QUSLOBJ in this case). Some people don't like the names
included therein but it's a standard with which I can easily live. :)

Use pointers in your programs, rather than moving data around.

I think I have an example of this at http://www.lovelady.com somewhere.
If not, I'll throw one together for you.


++
Dennis
++
There are very few personal problems that can't be solved by a suitable
application of high explosives.



Sent from my Galaxy tablet phone. Please excuse my brevity.
For any grammatic/spelling errors, there is no excuse.
++


"Jack Tucky" <jacktucky@xxxxxxxxx> wrote:

I downloaded an example program for reading objects using QUSLOBJ. It
works fine.




<
http://www.code400.com/forum/showthread.php/9493-QUSLOBJ-example-in-free-fo
rmat>

http://www.code400.com/forum/showthread.php/9493-QUSLOBJ-example-in-free-for
mat





It has a FOR loop that moves the user space into a DS one object at a
time.



What's the best way to let other RPG programs use this program to get a
list
of objects? Should I return the user space name and define the DS in
my
calling program?



I'd really like to do this the cool latest way.



Thanks



Jack





--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.