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



Yes.  If +, -, decimal point is allow, then I use the second method.
See original reply. 

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Holden Tommy
Sent: Tuesday, December 12, 2006 3:23 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Does anyone use indicators anymore?

In your first example:
 //If ony 0 to 9 is allow, I do below
if %check('1234567890' :charFld) > 0;
  // not a number;
Else;
  // is a number             
endif;                              

Some actual numerics may fall out since some characters can be part of
the field...for instance - or + signs.

Thanks,
Tommy Holden


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Lim Hock-Chai
Sent: Tuesday, December 12, 2006 1:36 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Does anyone use indicators anymore?

I hate TESTN:
- Not supported in Free.
- As far as I can remember, it does not recognize decimal point, + and -
sign.
- Worst of all, you got three different indicator that tells you three
different conditions.


I usually do one of these two:

//If ony 0 to 9 is allow, I do below
if %check('1234567890' :charFld) > 0;
  // not a number;
Else;
  // is a number             
endif;                              

or

//if any numeric notation is allow, I do below:
Monitor;
 dummyInt = %int(%trim(charFld));

 on-error;
   // not a number
Endmon;


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Buck

In the end, I took the path that was easiest for me to write.  If
another programmer needs to maintain this one-timer (they never really
are just one-timers, are they?) then I'm not at all sorry that he might
have to read up on

* report fields that should be numbers but aren't
* note that empty (blank) fields are OK
    TESTN charfld 2020
n20 EXCEPT badCharfld

In the end, my comfort with indicators in this context outweighed the
distaste for global variables.

   --buck

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.