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



Yes, you're right. It just seems like a lot of trouble to go to avoid a
few Evals. I would find the Evals much easier to understand if I was the
person who had to amend this program in 5 years time. If there were 10
sets of address fields, then fair enough, but for two?

Trevor Briggs
Analyst/Programmer
Lincare, Inc.
(727) 431-1246
TBriggs2@xxxxxxxxxxx

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, March 03, 2014 1:08 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Treat file fields as an array

Hi Trevor,

On 3/3/2014 11:38 AM, Briggs, Trevor (TBriggs2) wrote:
Scott, my reading of the question is that the OP wants a way to define
the addresses in such a way that he can process them as an array
without
doing those 6 evals, and off the top of my head, I don't think he can.

I'm still not 100% sure that I understand. But, he could do something
like this, right? (This assumes that he's not using DS I/O):

D CustAddr_t ds qualified template
D Customer like(BTCustomer)
D Name like(BTName)
D Address1 like(BTAddress1)

D Addresses ds
D BTCustomer
D BTName
D BTAddress1
D STCustomer
D STName
D STAddress1
D Cust likeds(CustAddr_t) Dim(2)
D overlay(Addresses:1)


Of course, this trades 6 eval statements for 14 lines of DS definitions.

Not sure that it's worth it?! Also, if the BT fields are ever changed

to a different length than the ST fields, the overlay won't work
properly, and will cause problems here that will not produce a compiler
warning or error. Still.. it'd work, right?


If he is using DS I/O, then he could do it with pointers:

D CustAddr_t ds qualified template
D Customer like(BTCustomer)
D Name like(BTName)
D Address1 like(BTAddress1)

D Cust ds likeds(CustAddr_t) dim(2)
D based(p_Cust)
D p_Cust s * inz(%addr(BTCustomer))

This would only work if the address fields are all together and in the
proper sequence, and it also would have the same problem as the first
solution if the BT/ST fields ever didn't match.

But, would work.

But, at the end of Charles' original message, he shows something like
this:

Cust(1) = GetCustinfo(wBtCustomer);
Cust(2) = GetCustInfo(wStCustomer);
//eval-corr here perhaps?

So that makes me think that he didn't really want to make the database
read automatically load stuff into the array, but that he wanted to do
it with eval-type opcodes... But, it's hard to see how this would
save him much vs. just eval the 6 fields...

Hopefully he can clarify.

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.