<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Testing RPGSQL for the number of records.</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/testing-rpgsql-for-the-number-of-records/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/testing-rpgsql-for-the-number-of-records/</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 19:19:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: slateken</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/testing-rpgsql-for-the-number-of-records/#comment-81642</link>
		<dc:creator>slateken</dc:creator>
		<pubDate>Mon, 20 Sep 2010 13:39:07 +0000</pubDate>
		<guid isPermaLink="false">#comment-81642</guid>
		<description><![CDATA[I&#039;ve used Tom&#039;s approach and it works well. The following method also works for checking that a record exists without performing the &quot;count&quot;. 

&lt;pre&gt;
D RecFound s 1a inz(&#039;N&#039;) 

/free 

reset RecFound; 

Exec SQL set :RecFound = (select &#039;Y&#039; from sysibm/sysdummy1 
where exists (select zip1 from MyZips where zip1 = 15205));&lt;/pre&gt;]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve used Tom&#8217;s approach and it works well. The following method also works for checking that a record exists without performing the &#8220;count&#8221;. </p>
<pre>
D RecFound s 1a inz('N') 

/free 

reset RecFound; 

Exec SQL set :RecFound = (select 'Y' from sysibm/sysdummy1 
where exists (select zip1 from MyZips where zip1 = 15205));</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/testing-rpgsql-for-the-number-of-records/#comment-81613</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Sat, 18 Sep 2010 01:36:51 +0000</pubDate>
		<guid isPermaLink="false">#comment-81613</guid>
		<description><![CDATA[I was wondering about indexing because I was hoping DB2 would be smart enough to check index-entry counts for an indexed column. IMO, that ought to make any physical I/O be a minimum. Just the page(s) with appropriate index tree elements should ever be hit.

Maybe a SET :var statement:&lt;pre&gt;
exec sql set :RcdCnt = ( select count(*) from MYFILE ) ; &lt;/pre&gt;

Tom]]></description>
		<content:encoded><![CDATA[<p>I was wondering about indexing because I was hoping DB2 would be smart enough to check index-entry counts for an indexed column. IMO, that ought to make any physical I/O be a minimum. Just the page(s) with appropriate index tree elements should ever be hit.</p>
<p>Maybe a SET :var statement:
<pre>
exec sql set :RcdCnt = ( select count(*) from MYFILE ) ; </pre>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: murrayinfosys</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/testing-rpgsql-for-the-number-of-records/#comment-81609</link>
		<dc:creator>murrayinfosys</dc:creator>
		<pubDate>Fri, 17 Sep 2010 22:52:36 +0000</pubDate>
		<guid isPermaLink="false">#comment-81609</guid>
		<description><![CDATA[Tom -
Slap-me-up-side-of-head!  SMACK!

&gt; SELECT COUNT(*)

Why didn&#039;t I think of that.

Thanks

Phil]]></description>
		<content:encoded><![CDATA[<p>Tom -<br />
Slap-me-up-side-of-head!  SMACK!</p>
<p>&gt; SELECT COUNT(*)</p>
<p>Why didn&#8217;t I think of that.</p>
<p>Thanks</p>
<p>Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/testing-rpgsql-for-the-number-of-records/#comment-81584</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 16 Sep 2010 22:31:43 +0000</pubDate>
		<guid isPermaLink="false">#comment-81584</guid>
		<description><![CDATA[&lt;i&gt;I need to update file A...&lt;/i&gt;

But not with SQL?

That is, a SQL UPDATE statement could restrict itself only to rows in A that had a match in B. But it seems that that isn&#039;t exactly what you&#039;re after. You want to &quot;select&quot; the number of matching rows in B, and, &lt;i&gt;if not zero&lt;/i&gt;, then you want to move on to some later code that will eventually result in an update to A after some preparation is done over the values.

If that&#039;s reasonably accurate, then a &lt;i&gt;potential&lt;/i&gt; solution could be SELECT COUNT(*) FROM FILEB WHERE {fileb=filea}. In there, COUNT(*) would be selected into a host variable that could be tested for zero.

Of course, that&#039;s different from SETLL since multiple possible I/Os could take place and you are trying to avoid that... assuming I&#039;m understanding what you want.

Is the matching column indexed?

Tom]]></description>
		<content:encoded><![CDATA[<p><i>I need to update file A&#8230;</i></p>
<p>But not with SQL?</p>
<p>That is, a SQL UPDATE statement could restrict itself only to rows in A that had a match in B. But it seems that that isn&#8217;t exactly what you&#8217;re after. You want to &#8220;select&#8221; the number of matching rows in B, and, <i>if not zero</i>, then you want to move on to some later code that will eventually result in an update to A after some preparation is done over the values.</p>
<p>If that&#8217;s reasonably accurate, then a <i>potential</i> solution could be SELECT COUNT(*) FROM FILEB WHERE {fileb=filea}. In there, COUNT(*) would be selected into a host variable that could be tested for zero.</p>
<p>Of course, that&#8217;s different from SETLL since multiple possible I/Os could take place and you are trying to avoid that&#8230; assuming I&#8217;m understanding what you want.</p>
<p>Is the matching column indexed?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/8 queries in 0.010 seconds using memcached
Object Caching 311/312 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-06-19 22:37:57 -->