× 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, Bryce, according to what you said in a message to Alan, this is not
what you're looking for.

This requires you to allocate each structure. The direct answer to your
question is that it's the latter, a 2-element array of pointers to
masterList structures, which was what I thought you wanted. (The 2 rather
than "n" was for simplicity of example; now I see it may have further
clouded the issue.)

I guess I'm not getting the point of what you are looking for. Sorry.

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"A bore is a man who, when you ask him how he is, tells you."
-- Bert Leston Taylor

Does pmasterListArr Dim(2) represent the Customer and Rank Columns of
the
array? Or is this just a 2 element array of myMasterList? If is the
former then its what I'm looking for I think.

I've read so much the last two days and tried so many things I'm having
trouble keeping it all straight. Might be time to regroup with the
simplest thing I can think of.


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777



"Dennis Lovelady" <iseries@xxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/08/2010 12:14 PM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>


To
"'RPG programming on the IBM i / System i'" <rpg400-l@xxxxxxxxxxxx>
cc

Subject
RE: Based data structure as dynamic array






Something like this?

D MasterList_T...
D DS qualified based(TEMPLATE)
D Customer...
D 6s 0
D Rank...
D 6s 0

D myMasterList...
D DS likeds(MasterList_T)
Based(pMasterList)

D pMasterList S *
D pmasterListArr S * dim(2)


... somewhere in your code

pMasterListArr(1) = %Alloc(%Size(myMasterList) ;
// check for error... if OK, continue
pMasterListArr(2) = %Alloc(%Size(myMasterList) ;
// check for error...


... later

pMasterList = pMasterListArr( idx ) ;






Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"A banker warned the British poet Robert Graves that one could not grow
rich
writing poetry. He replied that if there was no money in poetry, there
was
certainly no poetry in money, and so it was all even."
-- Robert Graves

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-
bounces@xxxxxxxxxxxx] On Behalf Of Bryce Martin
Sent: Friday, October 08, 2010 11:48 AM
To: RPG programming on the IBM i / System i
Subject: Based data structure as dynamic array

Ok, I know this can be done, and I've looked all morning for an
example
but everything I see is related to Dim on the ds and that is NOT what
I
want. I know you can base a datastructure on a pointer, and then
allocate
space as needed. I'll be d*mned if I can find a simple example of
this.
And no, I don't want to use userspaces. Its unnecessary. I need a
datastructure that has 2 elements. So this will basically be a two
dimensional array, practicallys speaking.

So I'm assuming I would do something like this....

D MasterList_T...
D DS qualified based(TEMPLATE)
D Customer...
D 6s 0
D Rank...
D 6s 0

D myMasterList...
D DS likeds(MasterList_T)

I guess I'm just not sure of exactly how to progress from here.

I've looked at so many examples and counter examples that my mind is
just
kinda going to mush because half the articles I see are from 2002 or
2004
or around that time and the way people used to do it just isn't
needed
any
more and new relevant examples don't seem to be as abundant. Once I
get
this working I'm going to be doing a bunch of writeups on what I used
and
why I used them, including my architecture decisions. But I need to
build
it before I write about it. This process is way easier that I've
been
finding it to be, and that is the frustrating part.


--
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 message (including any attachments) is intended only for the
use of the individual or entity to which it is addressed and may
contain information that is non-public, proprietary, privileged,
confidential, and exempt from disclosure under applicable law. If you
are not the intended recipient, you are hereby notified that any use,
dissemination, distribution, or copying of this communication is
strictly prohibited. If you have received this communication in error,
please notify us and destroy this message immediately. ---
--
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 ...

Follow-Ups:
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.