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



Fetch does not clear the DS...

Neither does SELECT or VALUES INTO for that matter...thus code like so...

myflag = *off;
exec SQL
select '1' into :myflag
from mytable
where ....;


Charles

On Thu, Aug 31, 2023 at 1:39 PM Greg Wilburn <
gwilburn@xxxxxxxxxxxxxxxxxxxxxxx> wrote:

I get what you're saying about the row count. I actually do that with GET
DIAGNOSTICS after fetching the first cursor defined. Your method of
checking SQLER3 is more efficient.

Before I bore you with all the code... My question is whether the Fetch
into the DS "initializes" the DS? Or does it just overlay the DS with the
rows retrieved?

Clearing the DS seems to work for now. What I saw in debug was just odd.

-----Original Message-----
From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Buck
Calabro
Sent: Wednesday, August 30, 2023 4:39 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: SQL Fetch into DS

Not exactly, but it won't hurt.

I understand that you tried it and got no results; perhaps posting that
code will clear this up. Lord knows I myself have put a CLEAR one line
too far down...

What I myself do for multi-row FETCHes is to handle undesired SQLSTATEs,
and then only use as many rows as got actually returned by checking SQLER3.

https://www.ibm.com/docs/en/i/7.4?topic=area-field-descriptions

--
--buck

http://wiki.midrange.com
Your updates make it better!


--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.



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.