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



Jon summarizes my take on it. If all of the other data in the program
(standalone fields, constants, data structure subfields) can be INZ'd on a
D-spec, why would I want to do something else for an array?

Most of the suggestions seem to be to initialize the values in strings and
use the overlay technique. Since that seems to be the most widely offered
suggestion, I would take that to be the current "best practice".

The applicaiton that I'm using has a known, finite, practically guaranteed
set of values that won't change ('footer', 'header' in my example, another
is 'top', 'bottom', 'left', 'right'). For simple data like that, I want it
hard-coded into the D-specs, no need to load it from a database.

I hoped that something like the following would have been possible
(apologize in advance if the formatting is thrown off, it lined up when I
typed it in).

D Array1 1 dim(4) inz('fFhH')
D Array2 6 dim(4) inz('footer+
D footer+
D header+
D header')

Thanks for all of the suggestions and follow-up.

Craig Pelkie



-------- Original Message --------
Subject: Re: Is this the simplest way to define corresponding arrays in
D-specs
From: Jon Paris <[1]jon.paris@xxxxxxxxxxxxxx>
Date: Thu, August 08, 2013 10:31 am
To: "RPG programming on the IBM i (AS/400 and iSeries)"
<[2]rpg400-l@xxxxxxxxxxxx>

Simple answer Rory.

Quick scenario.

I am reviewing a large program.
I encounter a piece of code that uses an array.
Need to see how the array is defined so I go the D specs.
Find that it is a compile time array and have to go to the other end of
the universe (sorry - source) to find the definition.
Annoying and non-productive.

Admittedly since I use RDi all the time now it is not as ugly as having
to wade through a 5,000 line source in SEU but you get the point. Even
in RDI because of the 3 different locations I can't use the quick
bookmark to get there and back.

If the data items are lengthy then I would rather they be in a database
and loaded from that.

I confess that I would not personally use most of the D-spec versions
shown because I would rather have each value on a separate line for
clarity. Or at least if the data were of the form Code Letter + Long
Name version (e.g. HHeader, FFooter, etc. I would actually "waste" a
character so that I could code them as H-Header, F-Footer, etc. But
that's just me and I'd have done the same thing with compile time data
back in the day when I was forced to use it.

On 2013-08-08, at 12:13 PM, Rory Hewitt <[3]rory.hewitt@xxxxxxxxx>
wrote:

> Trevor, Perhaps it's because he wants to put it in a copybook?
>
> Jon, frankly, I'm not sure why you consider any of the methods
discussed
> earlier any 'better' than Michael's compile-time array - they *all*
involve
> hard-coding data into the program source, in one way or another.
Michael's
> method is certainly the easiest where one is talking about longer
strings
> of data (which *can* be specified in the D-specs, but it's ugly).
Plus, at
> least with a compile-time array, the data strings are all in one
place, at
> the bottom of the source, rather than dotted about the D-specs or
(gasp!)
> hidden in a separate copybook (OK, that was *my* idea :))
>
> Rory
>
>
> On Thu, Aug 8, 2013 at 5:31 AM, Briggs, Trevor (TBriggs2) <
> [4]TBriggs2@xxxxxxxxxxx> wrote:
>
>> The OP did say he wanted to do everything in D-specs (although he
didn't
>> specify why).
>>
>> Trevor Briggs
>> Analyst/Programmer
>> Lincare, Inc.
>> (727) 431-1246
>> [5]TBriggs2@xxxxxxxxxxx
>> -----Original Message-----
>> From: [6]rpg400-l-bounces@xxxxxxxxxxxx
>> [[7]mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Michael
Schutte
>> Sent: Thursday, August 08, 2013 8:21 AM
>> To: RPG programming on the IBM i (AS/400 and iSeries)
>> Subject: Re: Is this the simplest way to define corresponding arrays
in
>> D-specs
>>
>>
>> D Array DS 7 CTDATA PERRCD(1) DIM(4)
>> D SubSet1 1 OverLay(Array)
>> D SubSet2 6 Overlay(Array:*NEXT)
>>
>>
>> **
>> hheader
>> HHEADER
>> ffooter
>> FFOOTER
>>
>>
>>
>> Or...
>>
>> D Subset1 Ds 1 CTDATA PERRCD(4) DIM4)
>> D Subset2 Ds 6 CTDATA PERRCD(1) DIM4)
>>
>>
>> **
>> hHfF
>> **
>> header
>> HEADER
>> footer
>> FOOTER
>>
>> Sometimes, things are just over thought...
>>
>>
>> On Wed, Aug 7, 2013 at 6:07 PM, Rory Hewitt
<[8]rory.hewitt@xxxxxxxxx>
>> wrote:
>>
>>> As a slight alternative, how about this:
>>>
>>> D ds
>>> D ARRAYS 28
>> inz('hheaderHHEADERffooterFFOOTER')
>>> D ARRAY dim(4) Overlay(ARRAYS)
>>> D ARRAYA 1 overlay(ARRAY)
>>> D ARRAYB 6 overlay(ARRAY:*next)
>>>
>>> Basically the same thing, but it intersperses the 1-char lookup
values
>> with
>>> the 6-char return values.
>>>
>>> This also allows slightly easier-to-view formatting of the ARRAYS
>> string,
>>> to show each ARRAY element on its own line:
>>>
>>> D ARRAYS 28 inz('hheader+
>>> D HHEADER+
>>> D ffooter
>>> D FFOOTER')
>>>
>>> Rory
>>>
>>>
>>> On Wed, Aug 7, 2013 at 1:14 PM, Booth Martin <[9]booth@xxxxxxxxxxxx>
>> wrote:
>>>
>>>> Is this responsive to your request?
>>>>
>>>> D ds
>>>> D ARRAYS 28
>> inz('hHfFheaderHEADERfooterFOOTER')
>>>> D ARRAYA 1 dim(4) overlay(ARRAYS)
>>>> D ARRAYB 6 dim(4) overlay(ARRAYS: *next)
>>>>
>>>> The simplest way seemed to me to be using an ALT array, but that
can
>> not
>>>> be done entirely inside the D-specs; leastways, I couldn't do it.
>>>>
>>>>
>>>> --
>>>> This is the RPG programming on the IBM i (AS/400 and iSeries)
>> (RPG400-L)
>>>> mailing list
>>>> To post a message email: [10]RPG400-L@xxxxxxxxxxxx
>>>> To subscribe, unsubscribe, or change list options,
>>>> visit: [11]http://lists.midrange.com/mailman/listinfo/rpg400-l
>>>> or email: [12]RPG400-L-request@xxxxxxxxxxxx
>>>> Before posting, please take a moment to review the archives
>>>> at [13]http://archive.midrange.com/rpg400-l.
>>>>
>>>>
>>>
>>>
>>> --
>>> Rory Hewitt
>>>
>>> [14]http://www.linkedin.com/in/roryhewitt
>>> --
>>> This is the RPG programming on the IBM i (AS/400 and iSeries)
>> (RPG400-L)
>>> mailing list
>>> To post a message email: [15]RPG400-L@xxxxxxxxxxxx
>>> To subscribe, unsubscribe, or change list options,
>>> visit: [16]http://lists.midrange.com/mailman/listinfo/rpg400-l
>>> or email: [17]RPG400-L-request@xxxxxxxxxxxx
>>> Before posting, please take a moment to review the archives
>>> at [18]http://archive.midrange.com/rpg400-l.
>>>
>>>
>> --
>> This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
>> mailing list
>> To post a message email: [19]RPG400-L@xxxxxxxxxxxx
>> To subscribe, unsubscribe, or change list options,
>> visit: [20]http://lists.midrange.com/mailman/listinfo/rpg400-l
>> or email: [21]RPG400-L-request@xxxxxxxxxxxx
>> Before posting, please take a moment to review the archives
>> at [22]http://archive.midrange.com/rpg400-l.
>>
>>
>>
************************************************************************************************************************************************************************************************************
>> This message originates from Lincare Holdings Inc. It contains
information
>> which may be confidential or privileged and is intended only for the
>> individual or entity named above.
>> It is prohibited for anyone else to disclose, copy, distribute or use
the
>> contents of this message.
>> All personal messages express views solely of the sender, which are
not to
>> be attributed to Lincare Holdings Inc., and may not be copied or
>> distributed without this disclaimer.
>> If you received this message in error, please notify us immediately
at
>> [23]MailAdmin@xxxxxxxxxxx or (800) 284-2006.
>>
>>
************************************************************************************************************************************************************************************************************
>>
>> --
>> This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L)
>> mailing list
>> To post a message email: [24]RPG400-L@xxxxxxxxxxxx
>> To subscribe, unsubscribe, or change list options,
>> visit: [25]http://lists.midrange.com/mailman/listinfo/rpg400-l
>> or email: [26]RPG400-L-request@xxxxxxxxxxxx
>> Before posting, please take a moment to review the archives
>> at [27]http://archive.midrange.com/rpg400-l.
>>
>>
>
>
> --
> Rory Hewitt
>
> [28]http://www.linkedin.com/in/roryhewitt
> --
> This is the RPG programming on the IBM i (AS/400 and iSeries)
(RPG400-L) mailing list
> To post a message email: [29]RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: [30]http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: [31]RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at [32]http://archive.midrange.com/rpg400-l.
>

Jon Paris

[33]www.partner400.com
[34]www.SystemiDeveloper.com

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: [35]RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: [36]http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: [37]RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at [38]http://archive.midrange.com/rpg400-l.

References

Visible links
1. mailto:jon.paris@xxxxxxxxxxxxxx
2. mailto:rpg400-l@xxxxxxxxxxxx
3. mailto:rory.hewitt@xxxxxxxxx
4. mailto:TBriggs2@xxxxxxxxxxx
5. mailto:TBriggs2@xxxxxxxxxxx
6. mailto:rpg400-l-bounces@xxxxxxxxxxxx
7. mailto:rpg400-l-bounces@xxxxxxxxxxxx
8. mailto:rory.hewitt@xxxxxxxxx
9. mailto:booth@xxxxxxxxxxxx
10. mailto:RPG400-L@xxxxxxxxxxxx
11. http://lists.midrange.com/mailman/listinfo/rpg400-l
12. mailto:RPG400-L-request@xxxxxxxxxxxx
13. http://archive.midrange.com/rpg400-l
14. http://www.linkedin.com/in/roryhewitt
15. mailto:RPG400-L@xxxxxxxxxxxx
16. http://lists.midrange.com/mailman/listinfo/rpg400-l
17. mailto:RPG400-L-request@xxxxxxxxxxxx
18. http://archive.midrange.com/rpg400-l
19. mailto:RPG400-L@xxxxxxxxxxxx
20. http://lists.midrange.com/mailman/listinfo/rpg400-l
21. mailto:RPG400-L-request@xxxxxxxxxxxx
22. http://archive.midrange.com/rpg400-l
23. mailto:MailAdmin@xxxxxxxxxxx
24. mailto:RPG400-L@xxxxxxxxxxxx
25. http://lists.midrange.com/mailman/listinfo/rpg400-l
26. mailto:RPG400-L-request@xxxxxxxxxxxx
27. http://archive.midrange.com/rpg400-l
28. http://www.linkedin.com/in/roryhewitt
29. mailto:RPG400-L@xxxxxxxxxxxx
30. http://lists.midrange.com/mailman/listinfo/rpg400-l
31. mailto:RPG400-L-request@xxxxxxxxxxxx
32. http://archive.midrange.com/rpg400-l
33. http://www.partner400.com/
34. http://www.systemideveloper.com/
35. mailto:RPG400-L@xxxxxxxxxxxx
36. http://lists.midrange.com/mailman/listinfo/rpg400-l
37. mailto:RPG400-L-request@xxxxxxxxxxxx
38. http://archive.midrange.com/rpg400-l

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.