Midrange News for the IBM i Community


Posted by: renojim
Credit balance in parens
has no ratings.
Published: 26 Jan 2012
Revised: 23 Jan 2013 - 2185 days ago
Last viewed on: 14 Jan 2019 (4141 views) 

Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.

Credit balance in parens Published by: renojim on 26 Jan 2012 view comments(4)

Return to midrangenews.com home page.
Sort Ascend | Descend

COMMENTS

(Sign in to Post a Comment)
Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Credit balance in parens
Posted: 6 years 11 months 22 days 10 hours 18 minutes ago

I'm tending more towards using character fields for output (both display and printer), then use %editc in program to perform the dec->char conversion.  This makes it easy to add fancy stuff like parentheses to negative displays.

Posted by: DaleB
Premium member *
Reading, PA
Comment on: Credit balance in parens
Posted: 6 years 11 months 21 days 17 hours 58 minutes ago

Like Neil hinted, you edit codes and edit words don't support what you're trying to do. Use an appropriate edit code or edit word on your numeric, then if it was negative, add the parentheses afterwards.

Posted by: renojim
Premium member *
Comment on: Credit balance in parens
Posted: 6 years 11 months 21 days 16 hours 26 minutes ago

Thanks - there's so many ways to skin a cat in this language I can't keep track of 'em all.

Posted by: neilrh
Premium member *
Jackson, MI
Comment on: Credit balance in parens
Posted: 6 years 11 months 21 days 15 hours 16 minutes ago

I write a lot of numeric edit functions.  My most recent was a procedure to take DimensionX (9p4), DimensionY (9p4, optional) and UnitOfMeasure (2a).  The character output is totally stripped numerics and something like: 30 X 36 IN, or 42.5 IN.  %editc is a rocking little built in function.