× 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.



I thought there was a third way of doing it. Using a MODS is not the way
to go. I don't want to create a new DS for each element of the array.
That is very heavy. I saw an example by Scott yesterday but can't find it
today. It don't remember it involving DIM or MODS. I have seen other
references to it as well, but never with an example.... just people
saying.... 'There are lots of examples, google is your friend'. I know
that there is a way to get past the 32767 DIM limit and rely totally on
the 16MB space limitation.


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



Alan Campin <alan0307d@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
10/08/2010 12:31 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






You can use either dim or multiple occurrance data structures. Doesn't
really matter.

I think what you want is:

p DemoMultipleOccurance2...
p b
d pi
d InCount...
d Like(StdInt)
d Value

d DemoMO...
d ds LikeDs(TD_DemoDs)
d Occurs(32767)
d Based(ptrDemoMO)

d cInitialNum...
d c 3
d cIncrement...
d c 2

d x...
d s Like(StdInt)
d AllocateCount...
d s Like(StdInt)
/Free

For x = 1 To InCount;
If x > AllocateCount;
If AllocateCount = 0;
AllocateCount = cinitialNum;
ptrDemoMO = %Alloc(%Size(DemoMO) * AllocateCount);
Else;
AllocateCount += cIncrement;
ptrDemoMO = %ReAlloc(ptrDemoMO :
%Size(DemoMO) * AllocateCount);

EndIf;
%Occur(DemoMO) = x;
DemoMO.Field1 = 'ABC';
DemoMO.Field2 = 'G';
DemoMO.Field3 = 505;
EndIf;
EndFor;



On Fri, Oct 8, 2010 at 9:48 AM, Bryce Martin <BMartin@xxxxxxxxxxxx> wrote:

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.

Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777
--- 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.