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

right justify character

hi All,

I am having a requirement. client wants to download a record into a .txt file. now the record is AAAASPACEBBBBBDDDD.

now the problem is DDDD is decimal value and i m converting it to character. however though now the client wants the record such as the field DDDD should be right justfied. now i can right justify if decimal value but since i have converted it to character so that i can use concatenate and write to a file on Pc, i am not able to right justify it.

can someone give me some suggestions,

thanks,

gaurav

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 07:34 PM

    When you write the decimasl to the character field:

    WRITE f_d to itab-f_c RIGHT-JUSTIFIED.
    

    Rob

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 07:16 PM

    Hi,

    Try with this code.

    Data: v_string type string.

    Data: v_len type i.

    Data: v_int(10) type n.

    Data: v_char(10) type c.

    CONSTANTS c_six(6) type c value ' '.

    v_string = 'Amandeep Sharma1981'.

    v_len = strlen( v_string ).

    v_len = v_len - 4.

    v_int = v_string+v_len(4).

    v_char = v_int.

    v_char+0(6) = c_six.

    Concatenate v_string+0(v_len) v_char into v_string.

    I have taken your numerical value as 4 characters. you can modify as and how you want.

    Regards,

    Aman

    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.