Using [NOT] RECORD filename EXISTS

Deskin, Bob Bob.Deskin@Cognos.COM
Tue, 18 Jul 2000 06:18:07 -0400


Ah John, the voice of reason. Unless we're doing something funny in the
code, you're right of course. Serves us all right. They say it's good to be
brought back to earth every now and then.

So Blue, it was really a trick right? You just wanted to see if we were
still thinking up here?

Bob Deskin              
PowerHouse Web Product Manager and Senior Product Advisor
Application Development Tools, Cognos Inc.
bob.deskin@cognos.com
(613) 738-1338 ext 4205  FAX: (613) 228-3149
3755 Riverside Drive P.O. Box 9707 Stn. T, Ottawa ON K1G 4K9 CANADA


-----Original Message-----
From: John Webster [mailto:john.webster@cdp.co.nz]
Sent: July 17, 2000 6:39 PM
To: powerh-l@sphere.swau.edu
Subject: Using [NOT] RECORD filename EXISTS


I think Conrad Bob and Matt have got over complicated. While what they're
saying is undoubtedly true, doesn't the rule about "most likely condition
first" only apply when there is more than one condition?

In this case there's only one condition to be tested and it's either TRUE or
FALSE, so it shouldn't make any difference which way round you test it?

John W
--------
From:	Whittall, Conrad
Sent:	July 18, 2000 10:03 AM
To:	'POWERH-L@lists.swau.edu'
Cc:
Subject:	RE: Using [NOT] RECORD filename EXISTS


Where did all of these PowerHouse "experts" come from???

Thanks Matt and Bob...just beat me to it with my two-cents worth!

When setting up conditional defined expressions or item statements it is
preferable (I believe) to make the condition that is most likely to be true
the one that you test for first. In this case, if you expect the record to
exist more often than it will not then use the first form. If you expect the
record not to exist more often than it will, then use the second form.

Why? Because PowerHouse, like any good programming language, will stop
evaluating the statement as soon as a TRUE condition is found and the value
of the expression can be determined. In such a simple case as the one you
give the performance difference will be marginal. However, if you have a
case where you have multiple conditional tests nested one inside the other,
e.g.

   IF <condition1>
   THEN <expression1>
   ELSE IF <condition2>
        THEN <expression2>
        ELSE IF <condition3>
        .
        .
        .
        (you get the idea)

...then the further down into the nesting PowerHouse has to go to find
something that evaluates to TRUE then longer it will take to process.

Best regards,
Conrad


-----Original Message-----
From: Robert J.M. Edis [mailto:robert.edis@creatcomp.com]
Sent: Monday 17 July 2000 17:37
To: 'powerh-l@list.swau.edu'
Subject: Using [NOT] RECORD filename EXISTS


G'day all

Can anyone tell me which is more efficient and results in better
performance, if at all, of the following syntax options please?


DEFINE d_xyz CHAR*1 = "Y" IF RECORD abc EXISTS ELSE "N"

Vs.

DEFINE d_xyz CHAR*1 = "N" IF NOT RECORD abc EXISTS ELSE "Y"

Regards,

Blue

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.