This does not match my experience. My experience is that the data at the end of the string is not cleared when the string is made shorter -- but is cleared when the string is made larger.

Let's try it:

D String s 50a varying
D p_View s *
D View s 50a based(p_View)

/free
String = 'Hello World';
%len(string) = 5;
p_View = %addr(String:*data);

dsply String;
dsply View;

*inlr = *on;


CALL PGM(LEN_TEST)

DSPLY Hello
DSPLY Hello World


As you can see, even though I shortened string to len=5, the word 'World' is still in memory.

-SK


On 5/21/2012 4:22 PM, Jon Paris wrote:

I think Chuck is wrong about the varying in that I'm fairly certain
that it actually places blanks in the back end of the field even
though (because of the length) it doesn't need to. It certainly pads
when you use %Len to increase the field length. I seem to recall a
conversation with Barbara where she told me that they had decided
that setting the back end of a varying to blanks was probably a waste
of time but by then couldn't change the behaviour because undoubtedly
someone had decided it was a "feature" by then.


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.