<?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: Using Number range on an AS/400 file with Char type field index</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 04:33:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: panpanky</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85228</link>
		<dc:creator>panpanky</dc:creator>
		<pubDate>Sat, 11 Dec 2010 20:40:15 +0000</pubDate>
		<guid isPermaLink="false">#comment-85228</guid>
		<description><![CDATA[I have opted for data storage cleanup....In meantime user void the range function on screen and go with specific number.

Thanks you all....]]></description>
		<content:encoded><![CDATA[<p>I have opted for data storage cleanup&#8230;.In meantime user void the range function on screen and go with specific number.</p>
<p>Thanks you all&#8230;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85223</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Sat, 11 Dec 2010 13:24:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-85223</guid>
		<description><![CDATA[Summery
in v6.1 SQL indexes can include derived columns.  These Indexes probably will be used by the SQL optimizer when the order by list is the same as the index. 

This opens up a wide range of options for solving complex problems with good performance.

 Please let us know when you find exciting ways to use this feature.  
Phil]]></description>
		<content:encoded><![CDATA[<p>Summery<br />
in v6.1 SQL indexes can include derived columns.  These Indexes probably will be used by the SQL optimizer when the order by list is the same as the index. </p>
<p>This opens up a wide range of options for solving complex problems with good performance.</p>
<p> Please let us know when you find exciting ways to use this feature.<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85174</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 10 Dec 2010 19:27:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-85174</guid>
		<description><![CDATA[&lt;i&gt;I would use a view of...&lt;/i&gt;

I&#039;d try the same and it &lt;i&gt;should&lt;/i&gt; work -- at least at i 6.1 and later, which might not be feasible for this question.

Visual Explain should tell all quickly.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>I would use a view of&#8230;</i></p>
<p>I&#8217;d try the same and it <i>should</i> work &#8212; at least at i 6.1 and later, which might not be feasible for this question.</p>
<p>Visual Explain should tell all quickly.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85146</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Fri, 10 Dec 2010 09:47:59 +0000</pubDate>
		<guid isPermaLink="false">#comment-85146</guid>
		<description><![CDATA[Tom:
Cleaning up the data would be optiomal.  

But, if that&#039;s impossible, I would use a view of the physical including this &quot;Field&quot; definition or a select in RPG including the &quot;Field&quot; definition using the physical file or the view.
,
In either case the &quot;Field&quot; is used in the select , where, and order by clauses.  with the index matching the order by rules with this &quot;Field&quot; first .. then I would hope the optimizer would choose the indexed path.

Phil]]></description>
		<content:encoded><![CDATA[<p>Tom:<br />
Cleaning up the data would be optiomal.  </p>
<p>But, if that&#8217;s impossible, I would use a view of the physical including this &#8220;Field&#8221; definition or a select in RPG including the &#8220;Field&#8221; definition using the physical file or the view.<br />
,<br />
In either case the &#8220;Field&#8221; is used in the select , where, and order by clauses.  with the index matching the order by rules with this &#8220;Field&#8221; first .. then I would hope the optimizer would choose the indexed path.</p>
<p>Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85133</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 10 Dec 2010 06:27:29 +0000</pubDate>
		<guid isPermaLink="false">#comment-85133</guid>
		<description><![CDATA[&lt;i&gt;So with an index over this “field” then you could use a Select statement and a fetch loop...&lt;/i&gt;

I can imagine an index, but I&#039;m not clear how to use it. The CURSOR SELECT would access either the base table or the view.

The ORDER BY could specify the derived column of the view, but that might not be seen as matching the index. I&#039;d like to think that the optimizer is smart enough.

Or it could specify an expression that matched the index. That might mean that the base table would need to be in the SELECT, but then the view wouldn&#039;t be useful. Or I suppose that the view could present both the base column and the derived column value -- except then the view wouldn&#039;t be needed at all because the SELECT could have the same items in its column list.

Maybe not a bad thought at all. It&#039;d be worth it just to see how it needed to be done.

I&#039;d probably still put more effort into correcting the troublesome database design so that none of this would even be needed. But it&#039;s interesting looking at how to make it work.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>So with an index over this “field” then you could use a Select statement and a fetch loop&#8230;</i></p>
<p>I can imagine an index, but I&#8217;m not clear how to use it. The CURSOR SELECT would access either the base table or the view.</p>
<p>The ORDER BY could specify the derived column of the view, but that might not be seen as matching the index. I&#8217;d like to think that the optimizer is smart enough.</p>
<p>Or it could specify an expression that matched the index. That might mean that the base table would need to be in the SELECT, but then the view wouldn&#8217;t be useful. Or I suppose that the view could present both the base column and the derived column value &#8212; except then the view wouldn&#8217;t be needed at all because the SELECT could have the same items in its column list.</p>
<p>Maybe not a bad thought at all. It&#8217;d be worth it just to see how it needed to be done.</p>
<p>I&#8217;d probably still put more effort into correcting the troublesome database design so that none of this would even be needed. But it&#8217;s interesting looking at how to make it work.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85122</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Thu, 09 Dec 2010 23:33:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-85122</guid>
		<description><![CDATA[So with an index over this &quot;field&quot; then you could use a Select statement and a fetch loop to work with the records that you want and expect good performance.
Phil]]></description>
		<content:encoded><![CDATA[<p>So with an index over this &#8220;field&#8221; then you could use a Select statement and a fetch loop to work with the records that you want and expect good performance.<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85114</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 09 Dec 2010 22:41:37 +0000</pubDate>
		<guid isPermaLink="false">#comment-85114</guid>
		<description><![CDATA[&lt;i&gt;If you can create a view, can you also create an index?&lt;/i&gt;

In V6R1, it&#039;s documented as possible. You can specify an &lt;i&gt;expression&lt;/i&gt; in place of a &lt;i&gt;column name&lt;/i&gt;. The list of excluded builtin functions does not include DEC() nor TRIM(), so I&#039;d expect it to work.

Before 6.1, you must reference a column name from the base table (according to the SQL Reference).

Tom]]></description>
		<content:encoded><![CDATA[<p><i>If you can create a view, can you also create an index?</i></p>
<p>In V6R1, it&#8217;s documented as possible. You can specify an <i>expression</i> in place of a <i>column name</i>. The list of excluded builtin functions does not include DEC() nor TRIM(), so I&#8217;d expect it to work.</p>
<p>Before 6.1, you must reference a column name from the base table (according to the SQL Reference).</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85071</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Thu, 09 Dec 2010 10:49:41 +0000</pubDate>
		<guid isPermaLink="false">#comment-85071</guid>
		<description><![CDATA[Tom
If you can create a view, can you also create an index?
Phil]]></description>
		<content:encoded><![CDATA[<p>Tom<br />
If you can create a view, can you also create an index?<br />
Phil</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85060</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Thu, 09 Dec 2010 08:40:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-85060</guid>
		<description><![CDATA[&lt;pre&gt;
1000054
167018&lt;/pre&gt;
The first value has seven characters, and the second one has only six characters. Unless this is a variable length field, the second value is padded with a blank on the right.

But you can create a SQL VIEW over the columns to interpret the character values as numeric:&lt;pre&gt;
dec(trim(charval),10,0) as NumVal &lt;/pre&gt;
That converts the &#039;charval&#039; column to a &#039;NumVal&#039; column for presentation. You can specify an ORDER By to read the view. With multiple columns, though, and with a few million records, it&#039;s going to cost a lot of processing time unless this is a one-time run or it&#039;s very infrequent.

Personally, I would probably push forcefully to correct the data. If the user wants it ordered numerically, then the data should be numeric.]]></description>
		<content:encoded><![CDATA[<pre>
1000054
167018</pre>
<p>The first value has seven characters, and the second one has only six characters. Unless this is a variable length field, the second value is padded with a blank on the right.</p>
<p>But you can create a SQL VIEW over the columns to interpret the character values as numeric:
<pre>
dec(trim(charval),10,0) as NumVal </pre>
<p>That converts the &#8216;charval&#8217; column to a &#8216;NumVal&#8217; column for presentation. You can specify an ORDER By to read the view. With multiple columns, though, and with a few million records, it&#8217;s going to cost a lot of processing time unless this is a one-time run or it&#8217;s very infrequent.</p>
<p>Personally, I would probably push forcefully to correct the data. If the user wants it ordered numerically, then the data should be numeric.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: philpl1jb</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/using-number-range-on-a-file-with-char-type-field-index/#comment-85033</link>
		<dc:creator>philpl1jb</dc:creator>
		<pubDate>Wed, 08 Dec 2010 23:48:11 +0000</pubDate>
		<guid isPermaLink="false">#comment-85033</guid>
		<description><![CDATA[Could an SQL index be created on the dec(myChar)? field?
Phil]]></description>
		<content:encoded><![CDATA[<p>Could an SQL index be created on the dec(myChar)? field?<br />
Phil</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 3/8 queries in 0.037 seconds using memcached
Object Caching 395/396 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-06-19 07:09:30 -->