Skip to Content
avatar image
Former Member

To delete minus(-) sign

Hi Experts,

i am calling 'fm' to convert digit amount to words but in print its contains minus(-) sign and because of

that its giving wrong value. the amount is 57,387,916.20- and i have to delete - from this amount.

i am using the syntax :SHIFT AMT RIGHT DELETING TRAILING '-'. but its not working.so please tell me

how to do this.

Thanks.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    May 30, 2009 at 04:50 AM

    Hi,

    Whats the data type of the variable AMT? If its Curr then u can use the below code to remove (-).

    AMT = AMT * -1.

    Else if the variable is char or string just try out the below code.

    SHIFT AMT RIGHT DELETING TRAILING '- '

    Regards,

    Nikhil

    Edited by: Nikhil Kayal on May 30, 2009 10:21 AM

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2009 at 04:55 AM

    hi,

    use

    data : a type p decimals 2 value '13245.56-',

    b type p decimals 2.

    b = abs( a ).

    write : b.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2009 at 06:57 AM

    Hi,

    Multiply -1.

    data : l_amount type PAD_AMT7S,

    l_value type i value '-1'.

    l_amount = '57387916.20-'.

    l_amount = l_amount * l_value.

    Output:- '57387916.20'.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2009 at 07:28 AM

    Dear Saalim,

    Best way to change the - ve is multiply by -1if it is Numeric type. Other wise please convert the -ve sign into + ve sign after getting the value before move to text type.

    With Regards,

    Selvan.M

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2009 at 11:32 AM

    answered

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 30, 2009 at 11:46 AM

    this is simple

    before passing it to fm,

    use an if statement and modify the value to positive and send to fm

    as follows

    if amt < 0.

    amt = - amt.

    endif.

    call 'Fm(what u need).

    in that send your variable

    Add comment
    10|10000 characters needed characters exceeded