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



On 2014-09-29 07:00, Wilson, Jonathan wrote:

I'm curious, how does it determine if it should be 2 or 4 bytes? Is it
based on the data type, ie DBCS, SBCS, etc also what is to stop a single
procedure being called by 2 programs with differing length of data (2v4)
bytes or does the prototyping prevent that so if it, the prototype,
knows it should be 4 bytes it enforces the caller to encode 4 bytes?


If the defined length is 65535 or less, it defaults to 2 bytes. Otherwise it defaults to 4 bytes. It doesn't matter whether it's SBCS or DBCS, since the length is measured in characters, not bytes.

Or you can specify the size on the prototype by coding a parameter for the VARYING keyword, VARYING(4), or by coding a second parameter for the VARCHAR/VARGRAPH/VARUCS2 keyword in free-form, VARCHAR(25:4).

If the passed parameter has a different varying-prefix size: if the parameter is defined as CONST or VALUE, the RPG compiler will pass a temporary with the correct size. Otherwise, the RPG compiler will give a compile-time error.


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.