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



Wouldn't there be a problem with overlaying the array over the
DS that contains the array though?


That is not what is happening.
The OVERLAY keyword is used to position a subfield in a specific location within
a data structure. You can specify either another subfield name or the data
structure name itself. The second parameter of OVERLAY is the actually position
within the overlaid subfield where you want the new field to begin. If the
overlaid "subfield" is really the data structure name, then it is within the
data structure itself and the second parameter is the position within the data
structure where you want the new subfield to appear.
If the second parameter is not specified, then it defaults to 1.
Hence, Jerry's example is the (only?) correct one.

It is just too darn bad that IBM didn't think of using OVERLAY(*DS) instead of
the actually data structure name... makes using LIKEDS with an overlay hurt my
brain.

-Bob Cozzi


On 4/27/07, Jerry Adams <jerry@xxxxxxxxxxxxxxx> wrote:

Maybe I'm just lazy (oh yeah, I am), but I don't type all of
that. Rather:


D myDS DS
D POQ1WB
D POQ2WB
D POQ3WB
D POQ LIKE(POQ1WB) overlay(myDS)
D DIM(10)


Maybe putting the array definition after the individual fields makes a
difference; I doubt it, but I've never run a test on that hypothesis.
Assuming (for purposes of illustration) that the POQxWB fields are 1 A,
then the array POQ will contain a total of 10 characters. Since the
fields are defined elsewhere, POQ2WB will occupy position 2 in the data
structure. By overlaying the array on top of myDS, POQ(2) contains the
same value as POQ2WB.


Defining the data structure and array without length and type values is,
by the way, good programming. If it is ever necessary to change the
definition of the POQxWB fields, re-compiling the program (at least as
regards the array definition; logic considerations may require other
changes) is all that is necessary.



* Jerry C. Adams
*IBM System i5/iSeries Programmer/Analyst
B&W Wholesale Distributors, Inc.* *
voice
615.995.7024
fax
615.995.1201
email
jerry@xxxxxxxxxxxxxxx <mailto:jerry@xxxxxxxxxxxxxxx>



Scott Klement wrote:
Hi Joe,

Your fields aren't overlaying each other... so they're all in the same
DS,
but they're separate fields in that DS.

Try using the OVERLAY keyword.

D myDS DS
D POQ LIKE(POQ1WB) overlay(myDS:1)
D DIM(10)
D POQ1WB overlay(myDS:1)
D POQ2WB overlay(myDS:*next)
D POQ3WB overlay(myDS:*next)
D POQ4WB overlay(myDS:*next)
D POQ5WB overlay(myDS:*next)
D POQ6WB overlay(myDS:*next)
D POQ7WB overlay(myDS:*next)
D POQ8WB overlay(myDS:*next)
D POQ9WB overlay(myDS:*next)
D POQ0WB overlay(myDS:*next)


--
This is the RPG programming on the AS400 / 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.



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.