× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> wrote on 03/09/2020
01:21:20 PM:
To make the DECH works, you need to use Constants known at compile
time, not variables

Change the:
%len(packed_data)
by:
dcl-c packed_data_size %Size(packed_data); //Prefered to use Size
over Len

Change the:
use_scale
by:
dcl-c use_scale 2; // 2 decimals wanted

then:
return %char(%dech(packed_data/d_shift:packed_data_size:use_scale));

and voilà!


You haven't been following the thread. This discussion isn't
about making %DECH work. We already know that it requires parameters
whose values are known at compile time. This discussion is for a generic
routine that has to allow for a variable number of precision and scale
values from caller to caller. Thus, a single call to %DECH can't be used
in this case.

Also, you can't say that %SIZE is preferred over %LEN, in this
case, because %SIZE is the number of bytes of storage for the packed data
and %LEN is the number of precision digits for the packed data. Thus,
%LEN might return 13 for a given packed field where %SIZE would return 7
-- which is wrong for precision, but correct for the number of bytes of
storage.


Sincerely,

Dave Clark

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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.