Skip to Content
author's profile photo Former Member
Former Member

string operations

hi guys,

data field1(4) type c.

data field2(10) type c.

data field3(14) type c.

field1 = 23.

field2 = 4566789120.

I want to store like this 23<space><space>4566789120 in field3.

how can i do this?

I am doing like this concatenate field10(4) field20(10) into field3.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

10 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 08:59 AM

    Hi Hari

    Using offset is the best way to handle this.

    data field1(4) type c.
    data field2(10) type c.
    data field3(14) type c.
    
    field1 = '23'.
    field2 = '4566789120'.
    
      move field1 to field3.
      move field2 to field3+4.
      write:/ field3.

    Kind Regards

    Eswar

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 26, 2006 at 09:00 AM

    concatenate field1 field2 into field3 separated by ' '.

    ~Suresh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 26, 2006 at 09:01 AM

    Concatenate field1 field2 into field3 separated by ` `.

    Jusr copy paste.

    Note that the quotes are not normal ones. The key above the Tab in the key board.

    Regards,

    Ravi

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 09:04 AM

    Hi Hari,

    Concatenate Field1 and space into field1.

    Concatenate space and Field2 into field2.

    concatenate field1 and field2.

    Hope it helps u.

    regards

    Chandra.

    note: Please reward if helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 26, 2006 at 09:05 AM

    Hi,

    Try this.

    data field1(4) type c.

    data field2(10) type c.

    data field3(14) type c.

    field1 = 23.

    field2 = 4566789120.

    concatenate <b>field1 ' ' field2+0(10) into field3 separated by space.</b>write field3.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 09:08 AM

    USE FOLLOWING STATEMENT

    concatenate field1 field2+0(10) into field3 SEPARATED BY SPACE

    MUKESH

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 09:08 AM

    Hi Hari,

    Try follwing code.

    data field1(4) type c.

    data field2(10) type c.

    data field3(14) type c.

    data field4(1) type c.

    start-of-selection.

    field1 = 23.

    field2 = 4566789120.

    concatenate field1 field4 field2 into field3 separated by space.

    write:/ field3.

    -Anu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 09:19 AM

    U can do it in more than one ways...

    1.

    TRANSLATE field1 USING ' *'.

    CONCATENATE field1 field2 into field3.

    TRANSLATE field3 USING '* '.

    2.

    WRITE field1 to field3.

    WRITE field2 to field3+4(10).

    Regards

    Anurag

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 02:14 PM

    Hi Krishna,

    Concatenating white space can be acheived using ALT+255

    <b>

    data : white_space(1) value ' '.</b>

    here the space that is defaulted should not be created using space key of the keyboard instead use Alt+255(numbers typed from your Numkeys in your keyboard). This will include a white space into the variable white_space which can be concatenated to any string.

    Now you can do

    <b>concatenate field1 white_space field2 into field3.</b>

    Thanks,

    Prasath N

    Message was edited by: prasath natesan

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 26, 2006 at 02:25 PM

    Here's another method:

    data field1(4) type c.

    data field2(10) type c.

    data field3(14) type c.

    data begin of tmp,

    field1(4) type c,

    field2(10) type c,

    end of tmp.

    field1 = 23.

    field2 = 4566789120.

    tmp-field1 = field1.

    tmp-field2 = field2.

    field3 = tmp.

    Regards

    Sridhar

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.