× 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 Reeve,

I appreciate your response.
I was trying to avoid keying in the ds subfields by using extname or
likerec. I tried it with and without qualified. I'll definitely be keeping
your sample code handy for when I do need to create a ds with subfields.
Embedding sql into rpg should be easier.
I'm all good now from Daniel's suggestion.
Thank you again. :-)

Yours truly,

Glenn Gundermann
Email: glenn.gundermann@xxxxxxxxx
Cell: (416) 317-3144
---


On Mon, 25 Apr 2022 at 00:40, Reeve <rfritchman@xxxxxxxxx> wrote:

Glenn, are you using the QUALIFIED keyword?

Here's code I use to load an array from values (commodity codes) in one
shot from a reference table. The "for 198 rows" is what makes this code
different.

dcl-ds CommArray dim(200) qualified inz;
Comm char(10);
Desc char(40);
end-ds;
...
...
EXEC SQL
DECLARE t2 CURSOR FOR
SELECT tbdak1
FROM aap002
WHERE tbdkey = 'AHCOMM'
ORDER BY tbdak1;


EXEC SQL
OPEN t2;

EXEC SQL
FETCH NEXT FROM t2 FOR 198 ROWS INTO :commarray;

EXEC SQL
GET DIAGNOSTICS :j = ROW_COUNT;

EXEC SQL
CLOSE t2;


On Sun, Apr 24, 2022 at 4:36 PM Glenn Gundermann <
glenn.gundermann@xxxxxxxxx>
wrote:

Hi Reeve,

Thank you for taking the time to reply.
The statement with "dcl-ds arTransactions ..." won't work?

Yours truly,

Glenn Gundermann
Email: glenn.gundermann@xxxxxxxxx
Cell: (416) 317-3144

---

On Sun, 24 Apr 2022 at 19:17, Reeve <rfritchman@xxxxxxxxx> wrote:

arTransactions has to be defined--where's the definition? Its name is
longer than 10 characters, so it must be a program-defined data
structure.

SQL doesn't make them automatically.

\reeve

On Sun, Apr 24, 2022 at 4:07 PM Glenn Gundermann <
glenn.gundermann@xxxxxxxxx>
wrote:

Hi folks,

After not working with RPG and embedded SQL for four years, I feel
I'm
starting all over and some of it is not easy.

Basically, with a SQLRPGLE member, I'm trying to define a DS and
using
FETCH NEXT FROM cursorName INTO dsName.

it won't compile and I'm getting:

SQL0312 30 105 Position 34 Variable ARTRANSACTIONS not defined
or
not
usable. Reason: No declaration for the variable
exists,
the declaration is not within the current scope,
or
the
variable does not have an equivalent SQL data
type.

Below are parts of the program. In the compile listing, it shows
ARTRANSACTIONS as undefined. What am I missing? The SQL statement
works
when I copy it into Run SQL Scripts.

dcl-f vascct disk usage(*output);

dcl-ds arTransactions extname('VASCCT': *OUTPUT) qualified;
end-ds;

exec sql
DECLARE arCursor CURSOR FOR long-sql-select-statement;

exec sql
OPEN arCursor;

exec sql
FETCH NEXT FROM arCursor INTO :arTransactions;

dow sqlState = '00000';
write vascctr arTransactions;
exec sql
FETCH NEXT FROM arCursor INTO :arTransactions;
endDo;

exec sql
CLOSE arCursor;




Yours truly,

Glenn Gundermann
Email: glenn.gundermann@xxxxxxxxx
Cell: (416) 317-3144
--
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.

Help support midrange.com by shopping at amazon.com with our
affiliate
link: https://amazon.midrange.com

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

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

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

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

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

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com


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.