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



JCarreras@xxxxxxxxxx wrote:
Hi,

Does someone know how I can insert string data into pointer's field with
ILE RPG language?

I need to insert an string data into Pointer field, so I should change
size's field, but I don't knows how do it.

Questions like this are best asked in the RPG400-L mailing list.


But to get to your question, I'm not really sure what you're asking, so I might not have the answer you're looking for. Clearly, you can't put string data into a pointer variable. So I assume you have a pointer to some string data and you want to insert into that area.

*If* you know the full extent of the particular storage pointed at by the pointer, you can define a BASED character variable based on that pointer, and then you can manipulate that BASED variable. You can use the %REPLACE built-in function to insert text into some string by specifying 0 as the 4th argument.

That is, if you know your pointer points at an area of, say, 100 bytes:

D bstr        s              100a   based(ptr)
 /free
     bstr = %replace('char to insert':bstr:startpos:0);
 /end-free

But I'm not sure if that really does what you want. If not, please provide more detail of what you're trying to do and follow up on RPG400-L.

Cheers! Hans



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.