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



Thanks Alan.
So the people on this list that have suggested to others that they use a "select into :arrayDS" have never actually tried that?
My faith has been shaken.

Michael Koester

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Alan
Campin
Sent: Monday, September 14, 2015 1:25 PM
To: RPG programming on the IBM i (AS/400 and iSeries)
Subject: Re: Loading arrayDS from sql select into statement?

It is just you. You have to use a declare cursor, open cursor, fetch next
into for number of rows and close your cursor.

On Mon, Sep 14, 2015 at 10:08 AM, Koester, Michael <mkoester@data-
east.com>
wrote:

I'm not real good at using sql set-at-a-time processing, so I'm hoping
someone can give me some clues.

I'm okay with declaring cursors, and loading arrays with a multi-row
fetch, or from "fetch next" inside a for-loop. I'm trying to improve
my coding techniques, and understand the options.

I've seen mentions on this list of using "select into :ArrayDS", but
whenever I try to code up such a thing, the sql precompiler says I
can't - tells me my array is no good.
Specifically, "SQL0312: Position 16 Variable ArrayDS not defined or
not usable."

I've tried all kinds of adjustments to simplify the host data
structure to appease the precompiler, but it is not in the mood.

Compiling with CRTSQLRPGI on v7.1 with mostly up-to-date PTFs (I'm
told).
Could be missing one?
Or could be that I don't know what I'm doing. Or could be no one else
can do this either?

Code that DOES NOT work:

DCL-DS ArrayDS QUALIFIED DIM(64);
userAcct CHAR(50);
END-DS ;

// dds-defined physical file SV02 has 3 records that meet
"where"
criteria.
// sv2eml is defined as character 50; sv2sts is defined as
character 1.

exec sql
select sv2eml into :ArrayDS
from sv02
where sv2sts = '';

Is it just me ??? Thanks.
Michael Koester


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.