Booth Martin | 11 Mar 22:30 2005

Re: Convert QUERY record select to RPG

A useful trick that was passed onto me for these sorts of things is to use
the if/else.

The idea is to select all of the records you don't want with the if
statement, then immediately have an Else line.  It simplifies many filters.

For instance, an if statement listing all of the States excepting Oregon
could as easily be an if Oregon, Else.

I am not sure if that is a relevent solution though.

Also, you could have a file as output from the query and then process the
new file with your new RPG program.
 
---------------------------------
Booth Martin
http://www.martinvt.com

---------------------------------
-------Original Message-------
 
From: RPG programming on the AS400 / iSeries
Date: 03/11/05 15:07:07
To: rpg400-l@...
Subject: Convert QUERY record select to RPG
 
We have a query that has the following record select tests:
AND/OR   Field             Test     Value
           SIZE              GE       cotsz1
  AND     COTSZ1        GE       '0'
  AND     COAT1          NLIKE     '%AN%'
(Continue reading)

Tony Carolla | 11 Mar 23:57 2005
Picon

Re: Convert QUERY record select to RPG

<snip>
> The idea is to select all of the records you don't want with the if
> statement, then immediately have an Else line.  It simplifies many filters.
> 
> For instance, an if statement listing all of the States excepting Oregon
> could as easily be an if Oregon, Else.
</snip>

Why not simply use 

If Not Oregon;
   // Stuff;
EndIf;

???
-- 
"Enter any 11-digit prime number to continue..."
--

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

Booth Martin | 12 Mar 00:10 2005

Re: Convert QUERY record select to RPG

wellll....  yeah....  that too.    :) 
 
---------------------------------
Booth Martin
http://www.martinvt.com

---------------------------------
-------Original Message-------
 
From: RPG programming on the AS400 / iSeries
Date: 03/11/05 16:59:10
To: RPG programming on the AS400 / iSeries
Subject: Re: Convert QUERY record select to RPG
 
<snip>
> The idea is to select all of the records you don't want with the if
> statement, then immediately have an Else line.  It simplifies many filters

>
> For instance, an if statement listing all of the States excepting Oregon
> could as easily be an if Oregon, Else.
</snip>
 
Why not simply use
 
If Not Oregon;
   // Stuff;
EndIf;
 
???
--
(Continue reading)

Bob Cozzi | 12 Mar 00:11 2005

RE: Convert QUERY record select to RPG

I used to use the following example in my RPG IV classes back when OS/400
V3R1 was about to ship:

RPG III Style: 
      C           STATE    IFEQ 'OREGON'
      C           STATE    OREQ 'WASHINGTON"
      C           STAET    OREQ 'IDAHO'
      C                    ELSE
      C                    MOVE  '0'          NWSTATE
      C                    ENDIF

In RPG IV you'd can simply code the word "NOT" in front of the conditional
expression and avoid the ELSE statement altogether.

-Bob Cozzi
www.RPGxTools.com
If everything is under control, you are going too slow.
- Mario Andretti

-----Original Message-----
From: rpg400-l-bounces@... [mailto:rpg400-l-bounces@...]
On Behalf Of Tony Carolla
Sent: Friday, March 11, 2005 4:58 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Convert QUERY record select to RPG

<snip>
> The idea is to select all of the records you don't want with the if
> statement, then immediately have an Else line.  It simplifies many
filters.
(Continue reading)


Gmane