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
As an Amazon Associate we earn from qualifying purchases.