Re: Resulting string from concatenation operator?



On 3/29/2011 6:34 PM, Thomas David Rivers wrote:
Peter Flass wrote:

By FIXED I assume you mean nonvarying. I don't think the result is
affected by whether the result is varying or nonvarying. As far as I
know this is an implementation decision. Iron Spring creates a
nonvarying temporary and a descriptor to identify the actual length.

Unfortunately a temporary may be required in some cases or something
like 'A=B||A;' might produce strange results. Lots of optimizations
would be possible here.


Hi Peter,

Yeah - I guess the result would necessarily be the same if it were done
consistently. If the temporary were nonvarying or varying, it would need
to be converted to the result string in either case.

I was just surprised that the result type of concatenation isn't completely
defined.

By the way, what temporary would you create for a CHARACTER(*) VARYING
(e.g. from an incoming parameter value) - would that necessarily be the
size of
the largest possible nonvarying string?

Since the compiler always knows the length of a VARYING (or adjustable) operand when the concatenation is performed the temporary is always exactly long enough to hold the result.


- Dave Rivers -

(and, yeah - please excuse my poor use of FIXED - I meant NONVARYING; gotta
be careful not to mix these things.)


Terminology is pretty confusing sometimes. I think IBM now allows NONVARYING as an attribute in declarations.
.



Relevant Pages

  • Re: Resulting string from concatenation operator?
    ... |>> Peter Flass wrote: ... |>>> affected by whether the result is varying or nonvarying. ... If the temporary were nonvarying or varying, ... |>> to be converted to the result string in either case. ...
    (comp.lang.pl1)
  • Re: Resulting string from concatenation operator?
    ... nonvarying temporary and a descriptor to identify the actual length. ... If the temporary were nonvarying or varying, ... what temporary would you create for a CHARACTER(*) VARYING ... Since the compiler always knows the length of a VARYING operand when the concatenation is performed the temporary is always exactly long enough to hold the result. ...
    (comp.lang.pl1)
  • Re: Resulting string from concatenation operator?
    ... Peter Flass wrote: ... nonvarying temporary and a descriptor to identify the actual length. ... If the temporary were nonvarying or varying, ... to be converted to the result string in either case. ...
    (comp.lang.pl1)
  • Re: Resulting string from concatenation operator?
    ... |>> Peter Flass wrote: ... |>>> affected by whether the result is varying or nonvarying. ... If the temporary were nonvarying or varying, ... Maybe the thinking was that storage is cheaper than the CPU time to do run-time allocation. ...
    (comp.lang.pl1)
  • Re: Resulting string from concatenation operator?
    ... Iron Spring creates a nonvarying temporary and a descriptor to identify the actual length. ... Yeah - I guess the result would necessarily be the same if it were done ... If the temporary were nonvarying or varying, ... the largest possible nonvarying string? ...
    (comp.lang.pl1)