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



Agreed on the tree-structure for sure. It's amazing how much easier free-style code can be read when it's used purposefully. Very frustrating when not used purposefully.

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Morgan, Paul
Sent: Wednesday, November 10, 2010 4:48 PM
To: RPG programming on the IBM i / System i
Subject: RE: How to read and or statement

IMHO you should use parens and make it a multi line comparison with indentation:

WHEN ( *INKF *AND
( ( COND1 = FALSE ) *OR
( COND2 = FALSE ) ) )

Also push out the logical comparisons to the right to make a tree structure with the higher precedence further to the right.

Paul Morgan

Principal Programmer Analyst
IS Supply Chain/Replenishment

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Kurt Anderson
Sent: Wednesday, November 10, 2010 5:34 PM
To: RPG programming on the IBM i / System i
Subject: RE: How to read and or statement

Personally I only use parens when required or when the condition is overly complex (which I do my best to avoid). Otherwise I view parens as a waste of eyeing-time. However we all have our own style and that's fine. Just wanted to raise my opposing voice. ;)

-Kurt Anderson

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jeff Crosby
Sent: Wednesday, November 10, 2010 3:36 PM
To: RPG programming on the IBM i / System i
Subject: Re: How to read and or statement

I ALWAYS use parens to show exactly what I want. ALWAYS.

But that's for _my_ benefit.



On Wed, Nov 10, 2010 at 2:03 PM, Mark S. Waterbury < mark.s.waterbury@xxxxxxxxxxxxx> wrote:

Hi, David:

You can always use extra parentheses, even if they are "redundant" --
to ensure the compiler knows exactly what you want.

So, for example, you could code something like this:

WHEN (*INKF *AND ((COND1 = FALSE) *OR (COND2 = FALSE)))

and that way, there should be no doubt (by the compiler or any
subsequent human readers) of what is intended.

When in doubt, parenthesize.

Hope that helps,

Mark S. Waterbury

> On 11/10/2010 12:24 PM, David FOXWELL wrote:
note to self : AND has higher precedence...AND has higher
precedence...AND has higher precedence...AND has higher
precedence...AND has higher precedence...AND has higher
precedence...AND has higher precedence...AND has higher precedence...AND has higher precedence...




-----Message d'origine-----
De :rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] De la part de Elbert Cook
Envoyà : mercredi 10 novembre 2010 14:35 à : 'RPG programming on
the IBM i / System i'
Objet : RE: How to read and or statement

Here is a clip from the V5R4 RPG Reference

Condition for the DOUxx, DOWxx, IFxx, and WHENxx operations.
The ANDxx operation has higher precedence than the ORxx operation.


-----Original Message-----
From: David FOXWELL [mailto:David.FOXWELL@xxxxxxxxx]
Sent: Wednesday, November 10, 2010 4:09 AM
To: RPG programming on the IBM i / System i
Subject: How to read and or statement

Consider this code :

C *INKF WHENEQ *ON
C CONDITION1 ANDEQ FALSE

*If I add :
C CONDITION2 OREQ FALSE


I think this now means :

IF (*INKF AND CONDITION1=FALSE) OR (CONDITION2=FALSE)

But I want :
IF *INKF AND (CONDITION1=FALSE OR CONDITION2=FALSE)

Which is right?

Thanks
--
This is the RPG programming on the IBM i / System i
(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<email%3ARPG400-L-request@midran
ge.com> Before posting, please take a moment to review the archives
athttp://archive.midrange.com/rpg400-l.



--
This is the RPG programming on the IBM i / System i
(RPG400-L) mailing list
To post a message
email:RPG400-L@xxxxxxxxxxxx<email%3ARPG400-L@xxxxxxxxxxxx>
To subscribe, unsubscribe, or change list options,
visit:http://lists.midrange.com/mailman/listinfo/rpg400-l
or
email:RPG400-L-request@xxxxxxxxxxxx<email%3ARPG400-L-request@midran
ge.com> Before posting, please take a moment to review the archives
athttp://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the IBM i / System i (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.




--
Jeff Crosby
VP Information Systems
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of my company. Unless I say so.
--
This is the RPG programming on the IBM i / System i (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.

--
This is the RPG programming on the IBM i / System i (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 ...

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.