<html><body>
<p><font size="2" face="sans-serif">I couldn't resist responding to this, even though I haven't used PowerHouse in 10 years (at least).</font><br>
<br>
<font size="2" face="sans-serif">First, always use Choose if you can. &nbsp;That limits the number of rows read from your source. &nbsp;All forms of Select only are checked after the data has been read (although it may not have been added to the record complex yet). &nbsp;Now... </font><br>
<br>
<font size="2" face="sans-serif">Select If and Select &lt;file&gt; If are similar but slightly different commands. &nbsp;</font><br>
<font size="2" face="sans-serif">* You can use Select &lt;file&gt; If when all the selection criteria are related to items in that single file. </font><br>
<font size="2" face="sans-serif">* You have to use Select If when you compare items in separate files. &nbsp;</font><br>
<font size="2" face="sans-serif">Also, you can have one Select &lt;file&gt; If statement for EACH file in your Access statement but ONLY ONE Select If statement. </font><br>
<br>
<font size="2" face="sans-serif">Access Employees link to Dependants</font><br>
<font size="2" face="sans-serif">Select Employees If Employees.Birth_Date &gt; '1950-01-01' </font><br>
<font size="2" face="sans-serif">Select If Employees.Hire_Date &gt; Dependants.Birth_Date</font><br>
<br>
<font size="2" face="sans-serif">This is essentially the same as:</font><br>
<font size="2" face="sans-serif">Access Employees link to Dependants</font><br>
<font size="2" face="sans-serif">Select If Employees.Birth_Date &gt; '1950-01-01' AND Employees.Hire_Date &gt; Dependants.Birth_Date</font><br>
<br>
<font size="2" face="sans-serif">Mostly, I used both versions; to make it easier to read and understand. &nbsp;</font><br>
<br>
<font size="2" face="sans-serif">HOWEVER... &nbsp;Select If and Select &lt;file&gt; If are only identical if your Access statement is the basic form ( &quot;Access A link to B link to C&quot;). If you are constructing a &quot;parallel&quot; Access statement (Access A link to B AND to C), there is a BIG difference between the two Select forms. &nbsp;Essentially you can't guarantee you'll get the record records from files B and C if you don't use Select &lt;file&gt; If.</font><br>
<br>
<font size="2" face="sans-serif">I had some good examples in papers I wrote 20 years ago that are somewhere on backup CDs. &nbsp;I'll try to recreate one:</font><br>
<br>
<font size="2" face="sans-serif">Access Employees link to Dependants AND to Payroll</font><br>
<br>
<font size="2" face="sans-serif">Dependants and Payroll records have nothing directly to do with one another; they are only related through Employees. &nbsp;Say I have 2 dependants and 3 payroll records.</font><br>
<font size="2" face="sans-serif">Employee &nbsp;Dependant &nbsp;Payroll</font><br>
<font size="2" face="sans-serif">&nbsp; 1 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Spouse &nbsp; &nbsp; &nbsp; &nbsp;2013-01-01</font><br>
<font size="2" face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Child &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2013-01-15</font><br>
<font size="2" face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 2013-02-01</font><br>
<br>
<font size="2" face="sans-serif">If you use &quot;Access Employees link to Dependants LINK to Payroll&quot;, you would get 6 record complexes (1:n:n)</font><br>
<font size="2" face="sans-serif">1 &nbsp; Spouse &nbsp;2013-01-01</font><br>
<font size="2" face="sans-serif">1 &nbsp; Spouse &nbsp;2013-01-15</font><br>
<font size="2" face="sans-serif">1 &nbsp; Spouse &nbsp;2013-02-01</font><br>
<font size="2" face="sans-serif">1 &nbsp; Child &nbsp; &nbsp; &nbsp; 2013-01-01</font><br>
<font size="2" face="sans-serif">1 &nbsp; Child &nbsp; &nbsp; &nbsp; 2013-01-15</font><br>
<font size="2" face="sans-serif">1 &nbsp; Child &nbsp; &nbsp; &nbsp; 2013-02-01</font><br>
<font size="2" face="sans-serif">This is probably not what you wanted.</font><br>
<br>
<font size="2" face="sans-serif">&nbsp;If you use &quot;Access Employees link to Dependants AND to Payroll&quot; you only get 3; &nbsp;Dependants and Payroll are read in parallel.</font><br>
<font size="2" face="sans-serif">1 &nbsp; Spouse &nbsp;2013-01-01</font><br>
<font size="2" face="sans-serif">1 &nbsp; Child &nbsp; &nbsp; &nbsp; &nbsp;2013-01-15</font><br>
<font size="2" face="sans-serif">1 &nbsp; &lt;blank&gt; &nbsp;2013-02-01</font><br>
<font size="2" face="sans-serif">This is probably closer to what you want.</font><br>
<br>
<font size="2" face="sans-serif">Now, what if you only wanted to see payroll records after the first of 2013 but you still wanted to see all the employee's dependants?</font><br>
<br>
<font size="2" face="sans-serif">On the parallel linkage, if you used &quot;Select If &nbsp;Payroll.pay_date &gt; '2013-01-02'&quot; &nbsp;then the first record COMPLEX would be rejected (first payroll record AND the first dependant record) and you would get </font><br>
<font size="2" face="sans-serif">1 &nbsp; Child &nbsp; &nbsp; &nbsp; &nbsp;2013-01-15</font><br>
<font size="2" face="sans-serif">1 &nbsp; &lt;blank&gt; &nbsp;2013-02-01</font><br>
<font size="2" face="sans-serif">You just lost one of the dependants.</font><br>
<br>
<font size="2" face="sans-serif">If you used &quot;Select Payroll If Payroll.pay_date &gt; '2013-01-02'&quot; then the payroll record would be discarded before it reached the record complex and your first dependant would be preserved.</font><br>
<font size="2" face="sans-serif">1 &nbsp; Spouse &nbsp;2013-01-15</font><br>
<font size="2" face="sans-serif">1 &nbsp; Child &nbsp; &nbsp; &nbsp; &nbsp;2013-02-01</font><br>
<br>
<font size="2" face="sans-serif">And that is WHY there is a Select &lt;file&gt; If statement in the first place. :-)</font><br>
<br>
<font size="2" face="sans-serif">Anyway, hardly anyone uses Parallel Access statements, so it's probably not relevant. </font><br>
<br>
<font size="2" face="sans-serif">Just remembering the 'good old days'.</font><br>
<font size="2" face="sans-serif">Matt :-)</font><br>
<br>
<img width="16" height="16" src="cid:1__=09BBF162DFCF302D8f9e8a93df938@us.ibm.com" border="0" alt="Inactive hide details for ---09/25/2013 08:53:14 AM---(Had to trim most of the history, size of this message thread of was  get"><font size="2" color="#424282" face="sans-serif">---09/25/2013 08:53:14 AM---(Had to trim most of the history, size of this message thread of was &nbsp;getting too big for this list.</font><br>
<br>
<font size="1" color="#5F5F5F" face="sans-serif">From:        </font><font size="1" face="sans-serif">&lt;Herald.Kaffka@westfraser.com&gt;</font><br>
<font size="1" color="#5F5F5F" face="sans-serif">To:        </font><font size="1" face="sans-serif">&lt;powerh-l@lists.sowder.com&gt;, </font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Date:        </font><font size="1" face="sans-serif">09/25/2013 08:53 AM</font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Subject:        </font><font size="1" face="sans-serif">Re: QTP reads every row instead of using index?</font><br>
<font size="1" color="#5F5F5F" face="sans-serif">Sent by:        </font><font size="1" face="sans-serif">powerh-l-bounces+mohmes=us.ibm.com@lists.sowder.com</font><br>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<font size="2" face="sans-serif">(Had to trim most of the history, size of this message thread of was getting too big for this list...).</font><font size="3" face="serif">&nbsp;<br>
</font><font size="2" face="sans-serif"><br>
========================================================================</font><font size="3" face="serif">&nbsp;<br>
</font><font size="2" face="sans-serif"><br>
I also seem to remember something about &quot;select file if&quot; conditions short circuiting the build of a record complex,</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
(Select File if was supposed to kick in as soon as the file entered the record complex, and would prevent PH from</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
growing the record complex with unneeded records, while select &nbsp;was evaluated &quot;after all records were retreived&quot;).</font><font size="3" face="serif">&nbsp;<br>
</font><font size="2" face="sans-serif"><br>
Don't know if &nbsp;this is an urban legend, an relic of an early PH version, or if there some truth to it...</font><font size="3" face="serif">&nbsp;<br>
</font><font size="2" face="sans-serif"><br>
To this day, (If I'm not working with a cursor), I still tend to <br>
&quot;Choose&quot; on the primary file, <br>
select file if as soon as possible on the other files in the access list (esp if selecting on some field condition in just that file such as &quot;select inventory_balance if status of inventory_balance = &quot;A&quot;).</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
and run a final select on cross table fields at the bottom. &nbsp; </font><font size="3" face="serif"><br>
</font><font size="2" face="sans-serif"><br>
Don't know if really more efficient or not (at one time I was told it was), &nbsp;but it does tend to make the logic on a large ugly join a little clearer (at least to me).</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
I'm not likely to change my style at this point, but I do idly wonder if &quot;I'm right&quot; or if it's just a &quot;Crusty Old Guy&quot; thing... </font><font size="3" face="serif"><br>
</font><font size="2" face="sans-serif"><br>
(Or if the answer is like all good fairy tales and begins &quot;once upon a time&quot; this was correct, but after version x it doesn't matter any more...).</font><font size="3" face="serif">&nbsp;<br>
</font><font size="2" face="sans-serif"><br>
===========================================================================</font><font size="3" face="serif">&nbsp;<br>
<br>
<br>
Thanks! <br>
<br>
A+ <br>
<br>
Etienne <br>
</font><font size="2" face="sans-serif"><br>
============================================================================</font><font size="3" face="serif">&nbsp;<br>
</font><font size="2" face="sans-serif"><br>
Think first, reply later. &nbsp;(gotta remember that rule).</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
<br>
There is/was an advantage to using Choose (or choose with select) on RMS/ISAM.</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
<br>
The choose (which can only operate on the initial file on the access statement), can limit the size of the data set which <br>
is processed. &nbsp;(You have to be choosing an indexed item, only items which match the choose criteria are driven down</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
into the link x of table a to y of table b logic). &nbsp;With just a select, all of table A will be read, POWERHOUSE will apply the</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
select, and then use that to drive out the the other tables in the Join. &nbsp;If table A is very big, and the select is very selective,</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
this can be a big difference, (read a million records, throw out the ones before yesterday, link the remaining 2000 records</font><font size="3" face="serif">&nbsp;</font><font size="2" face="sans-serif"><br>
into a results set, as opposed to reading 2000 rows since yesterday (choose date(days(sysdate)-1)) and building the complex...</font><font size="3" face="serif">&nbsp;<br>
<br>
<br>
<br>
<br>
---------------------------- <br>
This e-mail message and any attachments are confidential. Any dissemination or use of this information by a person other than the intended recipient is unauthorized. If you are not the intended recipient, please notify me by return e-mail, do not open any attachment and delete this communication and any copy. Thank you </font><tt><font size="2">--<br>
= = = = = = = = = = = = = = = = = = = = = = = = = = = =<br>
Mailing list: powerh-l@lists.sowder.com<br>
Subscribe: 'subscribe' in message body to powerh-l-request@lists.sowder.com<br>
Unsubscribe: 'unsubscribe &amp;lt;password&amp;gt;' in message body to powerh-l-request@lists.sowder.com<br>
</font></tt><tt><font size="2"><a href="http://lists.sowder.com/mailman/listinfo/powerh-l">http://lists.sowder.com/mailman/listinfo/powerh-l</a></font></tt><tt><font size="2"><br>
This list is closed, thus to post to the list you must be a subscriber.<br>
Add 'site:lists.sowder.com powerh-l' to your search terms to search the list archive at Google.</font></tt><br>
</body></html>