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