AS/400: Editing a field

25 pts.
Tags:
AS/400
Trying to edit a numeric field that can contain a negative number. As an example -0000017098 wanting to format as 170.98-. I can't seem to get it correct. %editc(chold:'L')  doesn't keep the negative sign.
1

Answer Wiki

Thanks. We'll let you know when a new response is added.

Deleting System 32 helps a lot.

Discuss This Question: 8  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • philpl1jb

    'L' format should show -0000017098

    as 'bbbbb170.98-'

    where b is blank.  

    Subsequent processes or output fields might put a blank from the next field to the right over that last space.  Perhaps you could show us some of the output code. 

    54,090 pointsBadges:
    report
  • kennazac
    With CHOLD = -000000130639

    eval      cam01 = %editc(chold:'L')  produces

    CAM01 = '      130639'
    25 pointsBadges:
    report
  • kennazac
    The field is coming in character at first with a length of 12, the last position could be the negative sign or not if positive.. I've got a %xlate to get to numeric, prior to the above code.
    25 pointsBadges:
    report
  • philpl1jb

    Perhaps ..

    MyDec11Dot2 = %Dec(%substr( MyChar12 : 1 : 11))/100

    if %substr( MyChar12:12:1) = '-'

      MyDec11Dot2 = MyDec11Dot2 * -1

    endif

    cam01 = %editc(MyDec11Dot2 : 'L') 

    54,090 pointsBadges:
    report
  • WoodEngineer
    Edit codes work on numeric fields.  Try converting CHOLD to an 11,2 field, then apply %editc to that field.  You could probably use %dec BIF in your %editc BIF to get the results you need.
    8,225 pointsBadges:
    report
  • Splat
    Wrap a %trim() around the %editc(chold:'L').
    12,915 pointsBadges:
    report
  • WilsonAlano
    How long is CAM01?  It must be 12 at least!
    2,710 pointsBadges:
    report
  • WilsonAlano
    Sorry, it must be size of CHOLD + 1
    2,710 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: