Problem is... %EDITC does return leading blanks if an edit code was used
to suppress zeros.
%EDITC (Edit Value Using an Editcode) %EDITC(numeric : editcode {: *ASTFILL
| *CURSYM | currency-symbol}) This function returns a character result
representing the numeric value edited according to the edit code. In
general, the rules for the numeric value and edit code are identical to
those for editing numeric values in output specifications. The third
parameter is optional, and if specified, must be one of: *ASTFILL Indicates
that asterisk protection is to be used. This means that leading zeros are
replaced with asterisks in the returned value. For example, %EDITC(-0012.5
: ’K’ : *ASTFILL) returns ’***12.5-’. *CURSYM Indicates that a floating
currency symbol is to be used. The actual symbol will be the one specified
on the control specification in the CURSYM keyword, or the default, ’$’.
When *CURSYM is specified, the currency symbol is placed in the the result
just before the first significant digit. For example, %EDITC(0012.5 : ’K’ :
*CURSYM) returns ’ $12.5 ’. currency-symbol Indicates that floating
currency is to be used with the provided currency symbol. It must be a
1-byte character constant (literal, named constant or expression that can
be evaluated at compile time). For example, %EDITC(0012.5 : ’K’ : ’X’)
returns ’ X12.5 ’.
<LOOKIE HERE>
The result of %EDITC is always the same length, and may contain leading and
trailing blanks.
</LOOKIE HERE>
For example, %EDITC(NUM : ’A’ : ’$’) might return ’$1,234.56CR’ for one
value of NUM and ’ $4.56 ’ for another value.
Float expressions are not allowed in the first parameter (you can use %DEC
to convert a float to an editable format). In the second parameter, the
edit code is specified as a character constant; supported edit codes are:
’A’ - ’D’, ’J’ - ’Q’, ’X’ - ’Z’, ’1’ - ’9’. The constant can be a literal,
named constant or an expression whose value can be determined at compile
time. For more information, see “Conversion Operations” on page 410 or
“Built-in Functions” on page 394. %EDITC (Edit Value Using an Editcode)
Chapter 22. Built-in Functions 483
Michael Schutte
Admin Professional
rpg400-l-bounces@xxxxxxxxxxxx wrote on 10/31/2008 01:23:21 PM:
:) Habit.
Now I am glad I posted. I learned something new.
Thanks.
rob@xxxxxxxxx wrote:
What makes you think that %editc returns a fixed length string?
Rob Berendt
--
---------------------------------
Booth Martin
http://www.Martinvt.com
---------------------------------
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.