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



Sometimes answers only come when I ask. I figured out a way to get the
size of a structure while still building it with an overlayed TtlSiz field:

dcl-ds T2 qualified;
TtlSiz;
Fam likeds(Fam2CD_t) inz(*likeds) overlay(TtlSiz);
Fac likeds(Fac2CD_t) inz(*likeds) overlay(TtlSiz:*next);
Prod likeds(Prod2CD_t) inz(*likeds) overlay(TtlSiz:*next);
arr likeds(Fam2CD_t) dim(T2Cnt) pos(1);
end-ds;

dcl-c T2Cnt %div(%size(T2.TtlSiz):%size(Fam2CD_t));



From: Darren Strong <darren@xxxxxxxxx>
To: "RPG programming on the IBM i \(AS/400 and iSeries\)"
<rpg400-l@xxxxxxxxxxxx>
Date: 05/06/2016 01:11 PM
Subject: Re: Free form nested data structures
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



Hey, somewhat related to this. I wanted to post a method I use to
calculate an array for an initialization structure like this. I don't
recall if I developed it, or if it came from somewhere. Notice the dcl-c
which calculates, during compile, how many array elements will be need to
cover the declared structure. They key is that you can use %size and %div
in a constant declaration. The thing I'm still lacking on, is that I'd like
to declare the array in the same structure as the template, but I can't
%size a structure while also placing a dim() structure within, that is
based on that %size. Causes a rip in the time space continuum I guess.


dcl-ds T2_t qualified template;
Fam likeds(Fam2CD_t) inz(*likeds);
Fac likeds(Fac2CD_t) inz(*likeds);
Prod likeds(Prod2CD_t) inz(*likeds);
end-ds;

dcl-c T2CDCnt %div(%size(T2_t):%size(Fam2CD_t));

dcl-ds T2 qualified;
CD likeds(T2_t) inz(*likeds);
arr likeds(Fam2CD_t) dim(T2CDCnt) pos(1);
end-ds;

for idx1=1 to T2CDCnt;
T2.arr(idx1).Col=idx1-1;
endfor;



From: Darren Strong <darren@xxxxxxxxx>
To: "midrange-RPG RPG message board" <rpg400-l@xxxxxxxxxxxx>
Date: 05/05/2016 03:48 PM
Subject: Free form nested data structures
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>




Trying to define a nested data structure in free form definitions, and the
compiler is complaining. Do you know what I'm doing wrong? I've inserted
the error messages where they're reported by the compiler

dcl-ds T2_t qualified template;
RNF3556: END-DS statement missing for a group containing free-form
statements
dcl-ds Fam qualified;
Col like(CurCol) INZ;
Wid uns(5) inz(10);
Hdg1 like(ColHdr_t) inz('Product');
Hdg2 like(ColHdr_t) inz('Family');
end-ds;

dcl-ds Fac qualified;
Col like(CurCol) INZ;
Wid uns(5) inz(10);
Hdg1 like(ColHdr_t) inz('Dekko');
Hdg2 like(ColHdr_t) inz('Facility');
end-ds;
end-ds T2_t;

RNF3551: END-XX is not expected.

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.



--
This is the RPG programming on the IBM i (AS/400 and iSeries) (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.

Please contact support@xxxxxxxxxxxx for any subscription related questions.




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.