× 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.



That looks promising, and this might be an alternative (making no claim for performance):

D FieldBMax S like( FieldB ) inz( *Hival )

FieldB = %Rem( FieldA / (%int( FieldBMax + 1 )))

--Alan



On 1/10/13 6:31 PM, Booth Martin wrote:
Something like this should work, I believe.

// Define wField as 29A
wField = %char(%int(FieldA));
if %len(wField) > 9;
wField = %subst(wField: (%len(wField) - 9 + 1);
endif;
FieldB = %dec(wField);

There are probably typos in there since I didn't test it. Also it can
be shortened, but this illustrates a process that I believe will give
the desired results.





On 1/10/2013 5:45 PM, sjl wrote:
FieldA is defined as 29.4 and FieldB is defined as 9.0. The following
calculation bombs on "Receiver value too small to hold the result."

Eval FieldB = FieldA;

I know that I can switch back into fixed format and use:
Z-ADD FIeldA FieldB

and the value of FieldB will contain a truncated value if FieldA is too
large to fit in FieldB. However, is there a way to accomplish this in
free-form RPG?

I know that this sounds stupid, and please do NOT ask me why I need to do
this.

I was told that if the value won't fit, truncate it, and I just don't want
to junk up my pretty free-form program with fixed-form code.

- sjl




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.