On 2020-03-02 3:19 p.m., dlclark@xxxxxxxxxxxxxxxx wrote:
Can anybody tell me why the following retains the decimal place in
the returned data:

t_number = packed_data / d_shift;
return %char(t_number);

...but this does not?

return %char(packed_data / d_shift);



This is due to the DECPREC keyword.

https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzasd/hdecprec.htm

"Keyword DECPREC is used to specify the decimal precision of decimal (packed, zoned, or binary) intermediate values in arithmetic operations in expressions. Decimal intermediate values are always maintained in the proper precision, but this keyword affects how decimal expressions are presented when used in %EDITC, %EDITW, %CHAR, %LEN, and %DECPOS."

If you code DECPREC(63) in your CTL-OPT, you'll get the decimal positions in the output of %CHAR.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.