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

Convert Negative value to Positive value

How to conver the negative sign to Positive sign.

Eg: -2.00 to become 2.00

Please guide me.

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2007 at 11:13 AM

    Hi Vamsi.

    move the amount to one charater field and use this FM

    use this FM CLOI_PUT_SIGN_IN_FRONT

    Thanks,'

    Reward If helpful.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2007 at 11:25 AM

    Hi,

    Use ABS function.

    Ex.

    DATA: T1(10),

    T2(10) VALUE '-100'.

    T1 = ABS( T2 ).

    WRITE T1.

    This produces the following output:

    100

    Two conversions are performed. First, the contents of field T2 (type C) are converted

    to type P. Then the system processes the ABS function using the results of the

    conversion. Then, during the assignment to the type C field T1, the result of the

    function is converted back to type C.

    Regards,

    Bhaskar

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2007 at 11:12 AM

    Hi

    Use ABS function or multiple it with minus 1

    f1 = ABS ( f1 ).

    f1 = f1 * -1.

    Reward points for useful Answers

    Regards

    Anji

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2007 at 11:13 AM

    Hi

    declare a variable type n.

    Then try assigning the negative value to the variable.

    Hope this helps.

    Tatvagna

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 07, 2007 at 11:19 AM

    Hi,

    Use <b>ABS</b> Function.

    a = ABS( a ).

    Regards,

    Padmam.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jun 07, 2007 at 11:20 AM

    Hi vamsi,

    simply:

    reverse the sign using

    value = - value.

    remove the sign:

    value = abs( value ).

    Regards,

    Clemens

    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.