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


  • Subject: RE: TESTN
  • From: "Rich Duzenbury" <rduz@xxxxxxxxxxxxxxxxxxx>
  • Date: Tue, 31 Oct 2000 16:25:44 -0600
  • Importance: Normal

I don't often say ditto, but I have to agree with Dan.  

I've never seen a useful way to use TESTN until your solution, and have been 
relying on using an array and testing each byte (in RPGIII).

This is why I am a member of this list.  Thank you.

Regards,
Rich
-----Original Message-----
From: owner-rpg400-l@midrange.com [mailto:owner-rpg400-l@midrange.com]On
Behalf Of D.BALE@handleman.com
Sent: Tuesday, October 31, 2000 3:03 PM
To: RPG400-L@midrange.com
Subject: Re: TESTN


Scott, I love that idea!  Simple and elegant.  I can't tell you the number of
times I've cursed TESTN for this problem.  Heck, you could make it a lot more
universal and define WORK as a 31-byte alpha, instead of 4.  Another tip for
my toolbox!

Dan Bale
IT - AS/400
Handleman Company
248-362-4400  Ext. 4952

-------------------------- Original Message --------------------------

'12G' is a character representation of the number -127.  When you
MOVE a negative number to a character field, it changes the value of
the "zone" portion of rightmost byte to reflect that its a negative
number.  (The change will usually result in a letter from A-R or the "{"
character.)

Therefore "12G" is a valid number.

If you only want to test for valid positive numbers, do something like
this:

C                   MOVEL     '12G'         SIN               3
C                   MOVE      *zeros        WORK              4
C                   MOVEL     SIN           WORK
C                   TESTN                   WORK                  81
c                   eval       *inlr = *on

By putting that extra zero at the end, the "G" ends up in the middle
of the number, and will signal an error.


On Tue, 31 Oct 2000, Lurton Keel wrote:

> Here is a program.
> C                   MOVEL     '12G'         SIN               3
> C                   TESTN                      SIN                  81
> c                    eval          *inlr = *on
> indicator 81 is in pos 71-72.
> My problem is that in the above example, indicator 81 is on even though
> there is a "G" in the field.
> The RPG reference says.
> "Positions 71 and 72: Either the result field contains numeric characters,
> or it contains a 1-character field that consists of a letter from A to R."
> What's up
>
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

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.