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



From: Scott Klement

Hi Peter,

If IBM automatically determines the size of the prefix, and provides a
BIF to give us the size of the prefix, you should be able to code your
programs so they are future compatible.

Remember, I'm talking about reference parameters. All that's passed
from caller to callee is a pointer. No size, data type, etc is passed.
At least with our existing BIFs like %size(), %len(), %decpos(), the BIF
doesn't know what the caller's actual size is, it just knows what the
local definition is. If the caller's definition doesn't match that, you
have problems.

Alright, let's address this, shall we?

What you say you want is to be able to pass a VARYING field by reference to
another procedure. You want the second procedure to be able to determine
the length of the field by looking at the bytes preceding the varying field.
The reason you need to do this is so that the procedure in another
compilation unit can determine the length of the passed data. As you point
out, the BIFs that work with the VARYING field are designed to work within
the current compilation unit.

I can see a couple of ways around this without resorting to an explicit
index size, but by far the easiest is for you to pass two parameters to your
procedures, just like we used to in the olden days. Pass the address of the
buffer and the length. You have access to both in the calling procedure.

And if you absolutely require the ability to pass a single parameter, then
write one proxy procedure for each size of VARYING field. Then have the
proxy pass the address and length to the actual procedure. I know it's not
exactly what you want and it adds a second prototype (or even a third, if
you ever required gigabyte fields), but I think it's better than imposing
extra overhead on everybody for I would hope you agree is a relatively rare
requirement.

Joe



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.