ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

%EDITC usage

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • %EDITC usage

    Hi Friends,

    I want to convert Numeric to a character, but with the following requisites

    Numeric 7s 2 . It can have value as -12.12, 12.12
    Character 8A
    When I am going to convert the same to character, i need the Decimal point to be retained,leading zeros to be retained and also the negative sign to be displayed first .

    The output for Negative value is to be -000012.12
    and positive value as 000012.12

    The %Editc(Numeric:'X') retains leading zeros value but decimal position is missing.
    Likewise the other editc keywords has one or other attribute, but all the clubbing condition fails.

    The Simpler ones was %char*Numeric) which yielded me with -12.12 without leading zeros.

    Kindly suggest me a way, by which all the three requisites can be done.

  • #2
    Re: %EDITC usage

    Assemble a %Editw BIF instead.
    d Alpha d 8a

    Alpha = %Editw(Number : '0bbbb.bb'); / b = blank
    If Number < *Zero;
    Alpha = '-' + %Trim(Alpha); // place leading - if negative
    Endif;

    This is general and may need some tweaking.
    (hope you get an A on this question).
    Bill
    "A good friend will bail you out of jail,
    A true friend would be sitting beside you saying,
    'Wow, that was fun.'"

    Comment


    • #3
      Re: %EDITC usage

      Hi Billw,

      I had tried the same.. The values after decimals aren't reflecting properly.
      Any alternate ??

      Comment


      • #4
        Re: %EDITC usage

        Remeber that the alpha field must be 2 chars longer than the numeric, because you are adding the negative sign and a decimal point.

        Comment

        Working...
        X