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



We have this report program with so much data on it that the real fields
don't fit on the report. So, we create print only fields that are smaller
and fit the report. To avoid errors in the program and because the actual
value of the fields doesn't matter when they get so big (or so small), I've
been using this code:

C EVAL bigdec = onhand * pm_stdc1
C EVAL onhanddol = *hival
C IF bigdec < onhanddol
C EVAL onhanddol = *loval
C IF bigdec > onhanddol
C EVAL onhanddol = bigdec
C ENDIF
C ENDIF

The bigdec is 30,9, the onhanddol field is the one printed. It is much
smaller (in this case 9,2). The result of this code is onhanddol set to
either 9999999.99, the value it actually is, or -9999999.99. This code is
scattered across this report in at least 20 places. The fields used have
variable sizes and decimal positions.

I decided to try to write a procedure to GetPrintVal. I can't rap my brain
around the needed code. I think I have to pass in length and decimal
positions. Then build max and min values and do the comparison. My thinking
code goes something like this:

Onhanddol = GetPrintVal(onhand*pm_stdc1:%len(onhanddol):%decpos(onhanddol));

P GetPrintVal

// make max value
maxValue = (length-decpos)('9').decpos('9');
// make min value
minValue = 0 - maxValue;

If inValue > maxValue;
return maxValue;
Endif;
If inValue < minValue;
return minValue;
Endif;

Return inValue;

The biggest problem I am having is finding an "elegant" way to do the
maxvalue. Anyone with suggestions?

Also, what is your opinion about the inValue and return value? I am thinking
that packed 60,10 would cover 99.999999% of the values we'd ever use (we do
have errors in costs sometimes!). If I use that, then I need to limit length
to 50 and decpos to 10 or is that just a built-in "feature" of the function?

Mike Krebs



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