× 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 for the information. Was not finding that option for some reason:-)

The system I am using is at V7 R5.

On Thu, Feb 8, 2024 at 6:43 PM Jon Paris <jon.paris@xxxxxxxxxxxxxx> wrote:

The answer to the question as asked is yes. But if you create the array
as Dim(*Auto: .... ) you don't need to set it.

Here's an example:

Dcl-Ds results ExtName('ANIMALS') qualified Dim( *Auto : 1000 );
End-Ds;

Dcl-Ds animal likeDs(results);

Dcl-s type like(results.type);

Exec SQL
Declare animalsCursor cursor for
Select * from ANIMALS where type = :type;

Exec SQL
Open animalsCursor;

Exec SQL
Fetch from animalsCursor for 1000 rows into :results;

Dsply ( 'Found ' + %Char( %Elem( results ) ) + ' matching animals' );

For-Each animal in results;
Dsply ( 'Id: ' + %Char(animal.Id) + ' - Name: ' + animal.name );
EndFor;

Exec SQL
Close animalsCursor;

In fact you don't even need to reset the element count before the next
select - the SQL preprocessor seems to do that for you.


Jon P.


On Feb 8, 2024, at 7:35 PM, Thomas Burrows <
thomas.burrows.1957@xxxxxxxxx> wrote:

Is it possible to dynamically set the number of OCCURRENCES "DIM(##)" on
a
dynamically created Data Structure?

dcl-ds EmpFile_ds extname('EMPPF')
qualified dim(10) ;

What I am wanting to do is load the contents of a SQL CURSOR which could
be
1 to N something. Taking the number of rows in the CURSOR to dynamically
create the Data Structure.

Thomas
mobile 469 693 2533
--
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.