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



I did some testing...

Unfortunately, it seems my simple test programs all ended up with the
same program size and static storage size. So I still don't know what's
going on.

But, I did confirm that if you passed a varying(10) variable containing
more than 5 characters to a procedure with a parm defined CONST
varying(5) options(*varsize); the procedure only sees 5 chars and %len
returns 5.

I was concerned that %len() would return 10 as CONST OPTIONS(*VARSIZE)
usually mean the address of the variable is passed directly; but for a
varying field, the first 2 bytes contain the current length.  The
compiler is obviousily smart enough to handle what I was trying
correctly, but I don't know if it is doing some sort of a substr or if
it is moving the varying(10) data to a varying(5) temporarily.

I suppose it's also possible that %len() doesn't look at the current
length value of a varying field, or the compiler is doing something when
it is used with a CONST VARYING OPTIONS(*VARSIZE) field.

I'm hoping Barbara or another IBM'er will chime in on this thread.



Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
  

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx 
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bob Cozzi
> Sent: Friday, May 05, 2006 4:59 PM
> To: 'RPG programming on the AS400 / iSeries'
> Subject: RE: CONST Parameter passing, varying and *varsize
> 
> Temp variables are declared in the program/module at 
> compile-time. They aren't
> dynamically created at run time.
> 
> I think I had that CONST OPTIONS(*VARSIZE) thing wrong.
> But it is confusion.
> %SUBST-like functionality is used sometimes. Sometimes the 
> data is copied to a
> temp variable.
> I'll have to dig in my email to figure out what the specifics are.
> 
> In the case of different size VARYING parameter values, remember, in a
> subprocedure, you can change the content of a CONST 
> parameter, this includes
> restricting use of %LEN() to change the current length. 
> -Bob Cozzi
> www.RPGxTools.com
> RPG xTools - Enjoy programming again.
> 
> 


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.