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



Well, this was a simplified example to talk about nesting. The answer is
not always 1 when there are more elements. I've pasted a larger example
here. It does look recursive, but I'm not overlaying the TtlSiz field
with the "Arr" field, so to the compiler, I suppose they're not related. I
think I've posted enough of a snippet that you should be able to paste it
into an RPG program an do a test compile.

dcl-s CurCol_t uns(3) template;
dcl-s ColHdr_t varchar(40) template;
dcl-s ColWid_t uns(3) template;

dcl-ds CD_t qualified template;
Col like(CurCol_t);
Wid like(ColWid_t);
Hdg1 like(ColHdr_t);
Hdg2 like(ColHdr_t);
end-ds;

dcl-ds T1 qualified;
TtlSiz;
dcl-ds FullName overlay(TtlSiz);
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(46);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('Employee');
end-ds;

dcl-ds blank overlay(TtlSiz:*next);
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(7);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('*BLANKS');
end-ds;

dcl-ds Code overlay(TtlSiz:*next);
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(7);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('Code');
end-ds;

dcl-ds CodeDesc overlay(TtlSiz:*next);
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(38);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('Description');
end-ds;

arr likeds(CD_t) dim(T1Cnt) pos(1);
end-ds;

dcl-c T1Cnt %div(%size(T1.TtlSiz):%size(CD_t));
___________________________________
Darren Strong
Dekko





From: Jon Paris <jon.paris@xxxxxxxxxxxxxx>
To: Rpg400 Rpg400-L <rpg400-l@xxxxxxxxxxxx>
Date: 06/16/2017 04:35 PM
Subject: Re: OVERLAY with nested data structure
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



I don't see how that can ever work because it is effectively saying to
work out how big I am in order to determine how big I should be. And as I
noted it would seem the answer is always 1 anyway.


Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Jun 16, 2017, at 3:44 PM, Darren Strong <darren@xxxxxxxxx> wrote:

To trick the compiler into calculating an array size as shown here.
dcl-c T1Cnt %div(%size(T1.TtlSiz):%size(CD_t));


___________________________________
Darren Strong
Dekko





From: Jon Paris <jon.paris@xxxxxxxxxxxxxx>
To: Rpg400 Rpg400-L <rpg400-l@xxxxxxxxxxxx>
Date: 06/16/2017 03:41 PM
Subject: Re: OVERLAY with nested data structure
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx>



Not directly related to your problem Darren - but why on earth are you
overlaying TtlSiz to begin with?

Why not just:

dcl-ds T1 qualified;
dcl-ds FullName;
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(46);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('Employee');
end-ds;
arr likeds(CD_t) dim(T1Cnt) pos(1);
end-ds;

For that matter the POS doesn't seem to make sense either. Doesn't this

achieve the same thing?

dcl-ds FullName dim(T1Cnt);
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(46);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('Employee');
end-ds;

What am I missing. It also seems at first glance (although I haven't
checked in detail) that T1Cnt will always be 1.

Jon Paris

www.partner400.com
www.SystemiDeveloper.com

On Jun 16, 2017, at 11:27 AM, Darren Strong <darren@xxxxxxxxx> wrote:

I'm trying out the new i7.3 TR2 stuff. I have a data structure like
the

following that I'm trying to convert to nested, but I'm not allowed to
use
the overlay in a datastructure definition. I've pasted the error
message

in the "Desired State" section below. Is there a way around this? This
example only shows one nested element, but my production program has
several. They were removed to simplify the example.


Current state:
dcl-ds CD_t qualified template;
Col like(CurCol_t);
Wid like(ColWid_t);
Hdg1 like(ColHdr_t);
Hdg2 like(ColHdr_t);
end-ds;

dcl-ds FullName1CD_t qualified template;
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(46);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('Employee');
end-ds;

dcl-ds T1 qualified;
TtlSiz;
FullName likeds(FullName1CD_t) inz(*likeds) overlay(TtlSiz);

arr likeds(CD_t) dim(T1Cnt) pos(1);
end-ds;

dcl-c T1Cnt %div(%size(T1.TtlSiz):%size(CD_t));


Desired State that gives the error:
dcl-ds CD_t qualified template;
Col like(CurCol_t);
Wid like(ColWid_t);
Hdg1 like(ColHdr_t);
Hdg2 like(ColHdr_t);
end-ds;

dcl-ds T1 qualified;
TtlSiz;
dcl-ds FullName qualified overlay(TtlSiz);
RNF0202: KEYWORD NOT ALLOWED FOR A NESTED DATA STRUCTURE SUBFIELD
Col like(CurCol_t) INZ;
Wid like(ColWid_t) inz(46);
Hdg1 like(ColHdr_t) inz('');
Hdg2 like(ColHdr_t) inz('Employee');
end-ds;
arr likeds(CD_t) dim(T1Cnt) pos(1);
end-ds;

dcl-c T1Cnt %div(%size(T1.TtlSiz):%size(CD_t));
--
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.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD

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

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


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

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


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.