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



Don Wereschuk wrote:
I'm not passing the value in the data file field. I'm passing a pointer to the address of the variable that contains the data. The variable gets updated in the called procedure by reading the records in the data file. On one call I use Field1 from the file which is 1A but on another call I want to use Field2 which could be 10A. I set the length of the variable to 50A which should cover the maximum length of any fields I'm interested in. The problem is that using the Based(pointer) and the field is only 1A the system tries to put 50 chars into a 1 char size field.

Don:

As you say, you're not passing the field; you're passing an address to some field. (I suppose; I don't see the code from the calling proc here.)

The VARYING is not adjusting the length to correspond to the actual Field length which is what the help says should happen.

AFAIK, that's because you've set a maximum length of 1. Set the definition to allow the maximum length that you expect ever to receive.

Because you limited the definition to 1 in the called proc, the called proc can't (won't?) go past the limit that you set. You told the proc that the field can only access up to a maximum of [1A] and that's what you're getting. From the manual -- "The current length may be any value from 0 to the maximum declared length for the field."

And because it's a BASED field in your proc, it doesn't actually take up its own memory. It simply overlays the address from the calling proc with a local definition of that memory.

You might as well define it as length 65535.

Actually, I'm not at all clear on what's going on behind the scenes when you _try_ to access it as a length 10 field. I'd expect some kind of run-time error that says the length is invalid.

Tom Liotta



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.