×
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.
Lurton wrote:
> Does anyone have an elagant way to do TESTN in /free?
rob@xxxxxxxxx replied:
Monitor;
MyNbr=%dec(MyChar); // requires 5.2
On-Error;
// oh crud, not numeric
EndMon;
Rob Berendt
No, that doesn't do exactly what TESTN does. For example, the input
'123.45' is accepted by %DEC as a valid number but TESTN doesn't.
Likewise, with input '1234J', %DEC throws up but TESTN likes it.
I can't think of any elegant way to replace TESTN within free-form
calcs. You could check for digits 0-9 for the all the characters except
the last, then check for 0-9, x'C0'-x'C9, and x'D0'-x'D9' as the last
character. That is, you could do
%CHECK('0123456789':%SUBST(STR:1:%LEN(STR)-1) AND
%CHECK(x'C0C1C2C3C4C5C6C7C8C9D0D1D2D3D4D5D6D7D8D9F0F1F2F3F4F5F6F7F8F9':%SUBST(STR:%LEN(STR)))
But that's not very elegant. Probably better to code a fixed-form TESTN
in a procedure, and call that from within your free-form calcs.
Alternatively, you could assign the character string to a character
subfield overlaying a zoned decimal subfield, and then monitor for an
error trying to use the zoned subfield.
On the other hand, is TESTN *really* what you think you want?
Cheers! Hans
As an Amazon Associate we earn from qualifying purchases.
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.