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



Hi,

I'd simply the data structure definition as follows:

D Amounts_DS DS
D Amt01 7P 0
D Amt02 7P 0
D Amt03 7P 0
D Amt04 7P 0
D Amt05 7P 0
D Amt06 7P 0
D Amt07 7P 0
D AmtArray 7P 0 Overlay(Amounts_DS) Dim(7)

Mit freundlichen Grüßen / Best regards

Birgitta Hauser

"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"

-----Ursprüngliche Nachricht-----
Von: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] Im
Auftrag von Dennis Lovelady
Gesendet: Thursday, 27. August 2009 18:28
An: 'RPG programming on the IBM i / System i'
Betreff: RE: SQL select into [array]?

Out of luck. SQL won't accept array elements and into cannot go into
an array.

I put a request for new features that you could do a fetch into an
array but of course who knows if they are ever going to do or at all.

On Thu, Aug 27, 2009 at 9:54 AM, Koester, Michael <mkoester@data-
east.com>wrote:

I am looking for an elegant way to code an embedded SQL statement
that
selects into, where the host target is an array.

As in:

Select Field1, Field2, Field3
into :MyArray(1), :MyArray(2), :MyArray(3) From *libl/MyTable

Where Key1 = :MyKey;

The way I have done this in the past is something like this:

D Amounts_DS DS
D Amt01 7P 0
D Amt02 7P 0
D Amt03 7P 0
D Amt04 7P 0
D Amt05 7P 0
D Amt06 7P 0
D Amt07 7P 0

D pAmts S * Inz(%Addr(Amounts_DS))
D AmtArray S 7P 0 Based(pAmts) Dim(7)

Exec SQL
SELECT Amt1, Amt2, ... Amt7
INTO Amounts_DS
FROM ...
;


HTH

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
The best way to save face is to keep the lower part full




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.