× 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 10/30/2012 8:34 PM, Jack Tucky wrote:
Thanks Luis and Joe. I tried the varchar thing but the data was overlapping
for some reason ( I wasn't clearing it perhaps). The %trimr worked.


If you use a varying field, you have to pass the address of the data portion of the field.

If you just code %addr(varchar), the write() API would receive the first two bytes of the varying field which contain a the current length of the field.

If VARCHAR = 'abc', the hex value is x'0003818283'. If you then coded
write(fd : %addr(varchar) : %len(varchar))
the API would write x'000381' rather than x'818283' which you want.

Coding this will work:
write(fd : %addr(varchar:*data) : %len(varchar))

I wouldn't use a varying field for this if my data was already in a fixed length field. But if your data was already in a varying length field, %addr(varfld: *data) is the way to go.

Requires v6r1 RPG. If you don't have V6R1, use
%addr(varfld) + 2


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.