Using [NOT] RECORD filename EXISTS

Whittall, Conrad Conrad.Whittall@Cognos.COM
Mon, 17 Jul 2000 17:52:17 -0400


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.