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

That is what I thought but wasn't sure how to explain it, that it had to be known at compile-time - perhaps the call the the database component needs to have that set at the time, so a variable is too late.

One way to do it, that maybe the OP mentioned, is to use a SELECT block - clumsy, I know.

I ran into a similar challenge when writing up handling date and time conversion in an OAR handler using, I think, the %char() function to get the expected format that was in use in RPG - the format has to be hard-coded - it can't be a variable. I did use the brute-force, SELECT-style approach - RRRRREALLY ugly in my estimation. Bruce Vining suggested using CVTD and CVTT MI functions, and that is a bit more complicated to set up but does let me use variables.

I guess I was really turned off by the relatively huge SELECT blocks!

Cheers
Vern

On 11/17/2016 9:30 AM, Stuart Rowe wrote:
No, unfortunately there is not any way to specify a variable there. I've
always WANTED to do so, but the compiler has never allowed it. The
reference manual does not indicate this limitation, but the compiler
enforces it. The compiler gives this explanation of the error:

"The second parameter for %KDS must be a numeric value with zero decimal
positions known at compile-time. In addition, the value must not be greater
than the number of subfields in the data structure specified as the first
parameter for %KDS."




On Wed, Nov 16, 2016 at 12:07 PM, gio.cot <gio.cot@xxxxxxxxxxx> wrote:

Hi all



I try ..

is there anyway to use the second argument (subfields number to use) as
variable ?

i.e. Reade %kds(Kds: nFld ) Myrec;

Thanks





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

Please contact support@xxxxxxxxxxxx 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.