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



Rather than moving the data around base the MyDs over the DSArr Data structure as in:

D MyDsBase S * Inz(%Addr(DSArr))
D MyDS E DS ExtName(MyFile)
Based(MyDsBase)
D DSArr DS
D Array 10A Dim(10)

Exec SQL Select * into :MyDS from MyFile Where rrn=6;
Dsply Array(1);

You don't have the overhead of moving data around.
You can define the MyDs simply so that the sql pre-compiler will accept it.
You can define the DSArr as complex as you wish, arrays, structs within structs, arrays of structs, etc...

Duane Christen

--


Duane Christen
Senior Software Engineer
(319) 790-7162
Duane.Christen@xxxxxxxxxx

Visit PAETEC.COM


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Birgitta Hauser
Sent: Thursday, September 03, 2009 7:56 AM
To: 'RPG programming on the IBM i / System i'
Subject: AW: SQL select into [array]?

It is not possible to fetch something directly into an array with embedded SQL.
It seems also not to be possible to build a data structure and overlay it with an array or define an array within a data structure.
The only way would be to fetch into a data structure and move this data structure into an other that is overlayed by the array.

D MyDS E DS ExtName(MyFile)
D DSArr DS
D Array 10A Dim(10)

Exec SQL Select * into :MyDS from MyFile Where rrn=6;
DSArr = MyDS;
Dsply Array(1);

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 David FOXWELL
Gesendet: Thursday, 03. September 2009 14:37
An: RPG programming on the IBM i / System i
Betreff: RE: SQL select into [array]?

I'm sorry, I thought I was being clearer than I was.

I meant

CREATE TABLE MyArray AS
Select Field1, Field2, Field3
From *libl/MyTable

Then, I don't know exactly how you plan to use your array. If I wanted the equivalent of MyArray(6), I could use SQL or a CHAIN operation.

Select * from MyArray where RRN(MyArray)=6

OR

CHAIN 6 MyArray

-----Message d'origine-----
De : rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Dennis Lovelady
Envoyé : jeudi 3 septembre 2009 12:36 À : 'RPG programming on the IBM
i / System i'
Objet : RE: SQL select into [array]?

Is there a reason why one could not use CREATE TABLE AS... and use
that table instead of the array?

________________________________
* Subject: SQL select into [array]?
* From: "Koester, Michael" <mkoester@xxxxxxxxxxxxx>
* Date: Thu, 27 Aug 2009 11:54:33 -0400

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

Does that help with the question? What would the SQL SELECT look like
then?
How would the table be build? Maybe we should see a little more
detail about what follows "CREATE TABLE AS..." ?

Dennis Lovelady
http://www.linkedin.com/in/dennislovelady
--
"When I was a boy of fourteen, my father was so ignorant I could
hardly stand to have the old man around. But when I got to
twenty-one, I was astonished at how much he had learned in seven
years."
-- Mark Twain

--
This is the RPG programming on the IBM i / System i
(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.


--
This is the RPG programming on the IBM i / System i (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 ...

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.