Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

A question aboud edit code in RPG program

882 views
Skip to first unread message

AMOS

unread,
Apr 2, 2009, 12:20:06 AM4/2/09
to
Hello everybody,

When I print a decimal number by using edtcde 1-4 in a
RPG program, all numbers that are less then 1, are displayed
without leading zero. For example: I specify in the output
form edtcde(1) for a certain decimal variable. If it euals
to 1.5 "1.5" is printed, but if it equals to 0.5 ".5" is
printed.


I've tried all the edit codes 1-4 and j-m. All of them
yield the same result. Is there any way to display the leading
zero when the number is a fraction?

Thank you for your answers. Even an appropriate reference
is good enough.

Amos

jb

unread,
Apr 2, 2009, 10:26:04 AM4/2/09
to

You could try editmasks IIRC " 00.00" or maybe " ##.##" The mask is
a bit stupid as the 1st (leftmost) # or 0 is the place where the last
digit will be changed from zero to blank as opposed to the 1st
character where a leading zero is allowed.
If you need editcodes then there are userdefinable ones which I may
have tried in the past & will require you to write & register a
program to do the editing for oyu.

HTH
Jonathan

CRPence

unread,
Apr 2, 2009, 12:01:19 PM4/2/09
to

I do not recall if\what edit codes enable a /leading zero/ to be
included in that case, but the EDTWRD() of DDS [which I believe has an
equivalent in RPG as %edtwrd()] can enable forcing a leading zero using
a /stop zero suppress/ character. To get a P(3,1) numeric to appear as
described, with one leading zero for a value smaller than the absolute
value of one, then the following Edit Word definition suffices:
EDTWRD('0 . ')

For a value of 1.5 or -1.5, the value ' 1.5' will be the result of
the function. For a value of .5 or -0.5, the value of ' 0.5' will be
the result of the function.

In the help text of Query/400, having navigated to the /Edit Code/
screen via the F16=Define Numeric Editing from the Report Column
Formatting screen, there is a good table describing the edit code
capabilities.

Regards, Chuck

J.T.F.

unread,
Apr 2, 2009, 1:44:38 PM4/2/09
to
%editw('---0.--') where the '-' are representing spaces, will give you
the leading zero....Where ever you put the '0' (zero) will be where
the first leading zero starts..

%editc(YourVar:'X') - 'X' will keep ALL leading zeros - Particularly
useful for shoving a numeric into a character field and keeping all
numeric positions....this editc evaluates out as a character....

AMOS

unread,
Apr 5, 2009, 1:25:43 AM4/5/09
to
> > Regards, Chuck- Hide quoted text -
>
> - Show quoted text -

Thank you all,
I'll try in my program and if the are still questions. I'll submit
a message again

Ace

unread,
Apr 6, 2009, 7:49:42 AM4/6/09
to
Just write an 'J' in column 21 of the control specifications of the program
or enter a 2 into the system value QDECFMT.

Ace


"AMOS" <am1...@walla.com> schreef in bericht
news:d1b87f1a-1496-4842...@j8g2000yql.googlegroups.com...

0 new messages