Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to use %edtcde in rpg4

Status
Not open for further replies.

jadec

MIS
Jan 22, 2004
87
US
Hi Guys,

I want to convert a number 00.2100 to char. The result should be exact like : '00.2100'. What function should I use? How do I code them? Anyone can help me please !

Thank You !
 
Code:
/free

evalr charfield = %editw(00.2100:'0  .    ')

/end-free

(The evalr is needed if you want the field to be right justified).

De mortuis nihil nisi bonum.

 
I meant to add - what you need to do requires an edit word; there is no edit code (unless you have defined one system-wide) that will do what you want. You need to use an edit word (%EDITW instead of %EDITC).

De mortuis nihil nisi bonum.

 
Hi flapeyre,

I tried your code. It gave me '00.002'. Any idea?

Thanks!
 
Do you have four spaces to the right of the decimal point, and two spaces to the left of it? And is your result character field at least 7 bytes long?

De mortuis nihil nisi bonum.

 
Got it. flapeyre. Thank you very much!
 
Another option to try is
Code:
charfield = %editc(00.2100:'X')
I don't know if this works with decimals, but I know it works with whole numbers.

iSeriesCodePoet
iSeries Programmer/Lawson Software Administrator
[pc2]
 
Thanks guys! I used edit word. It works fine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top