gnucobol-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [open-cobol-list] True concatenate.


From: Michael Anderson
Subject: Re: [open-cobol-list] True concatenate.
Date: Tue, 02 Jul 2013 16:22:26 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130623 Thunderbird/17.0.7

For results like so:
X=[My First Value] is 00000014 bytes.
Y=[More Chars] is 00000010 bytes
Now X=[My First ValueMore Chars] is 00000024 bytes.

Compile using:
cobc -x -free -ffunctions-all test.cob

The following source:
program-id. xstringy.
data division.
local-storage section.
77  x        Pic X(128).
77  y        Pic X(128).
procedure division.

Move "My First Value" To X.
Move "More Chars"     To Y.
Display "X=[" trim(X) "] is " Length(trim(X)) " bytes.".
Display "Y=[" trim(Y) "] is " Length(trim(Y)) " bytes".

Move concatenate(trim(X),trim(Y)) To X.

Display "Now X=[" trim(X) "] is " Length(trim(X)) " bytes.".
Stop Run.






On 07/02/2013 03:49 PM, Mark Perew wrote:
STRING can be an expensive operation.  If you know you're going to concatenate that way, why not do something more straightforward like:

01 X
     05 FILLER      PIC X(20).
     05 Y-PRIME     PIC X(20).


MOVE Y TO Y-PRIME.




On Tue, Jul 2, 2013 at 4:28 PM, Vincent Coen <address@hidden> wrote:

Hi;

 

On Tuesday 02 Jul 2013 14:47:32 john Culleton wrote:

> I have string x and I want to add string y to the end of it. In other

> words I want to do the equivalent of the *nix command

> cat y >> x

> I can of course use a third field z as the receptor and move it back

> into x. But is it legit to say

> STRING x y GIVING x.

> ??

 

Depends on compiler and for most answer is yes but test it should work for OC.

 

 


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list




------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev


_______________________________________________
open-cobol-list mailing list
address@hidden
https://lists.sourceforge.net/lists/listinfo/open-cobol-list


reply via email to

[Prev in Thread] Current Thread [Next in Thread]