Walden H. Leverich wrote:
CRPence wrote:
IMO the most obvious reason, is to enable ISAM versus SQL access
to the data via...
OK, but then create an LF over the table. Why take a SQL concept
(view) and try to use it in HLL-IO? If you want a LF create an LF,
complete w/the necessary DDS. I don't believe there's a restriction
to creating an LF over a PF that is a SQL table, is there?
  A DDS LF, simply put, does not support the many desirable features 
and mappings that are available via an SQL SELECT.  A DDS LF does not 
support any of, for example, HEX(), character to numeric, CASE, GROUP 
BY, AVG, date arithmetic, scalar UDF, et al.
  FWiW, given my choice, an ORDER BY in a VIEW would have more 
intuitively satisfied the concept; i.e. rather than an INDEX that is 
over a VIEW.  Regardless, my points are both that ordering the result of 
a VIEW may be desirable for ISAM and that OPNQRYF of a VIEW may be able 
to effect that in many cases, to accomplish what is desired.
  The better question I think is: Why *not* take advantage of the SQL 
concept (VIEW) and use it to remove logic from the HLL, when it can be 
replaced easily by what the database already provides?  Since CLP is 
very limited in its file I/O, it can obviously benefit significantly 
more from being able to push the logic down to the database than a 
language like RPG.  However at the same time, there is no reason RPG 
should not be able to benefit similarly.
  Oddly, I seem to have failed to paste additional text I had composed 
separately, that mentioned that DB2 for i [with IBM i 6.1] offers some 
new function for CREATE INDEX.  I will make a separate reply to the OP. 
 That new function enables an SQL INDEX to be created with some mapping 
[expressions; e.g. HEX(), etc.] and selection [WHERE clause], very 
similar to the DDS LF derived [keyed] [select/omit] indexes.  Note: the 
capability of the optimizer to use these indexes [until the next 
release] may actually be more limited than for what capabilities can be 
achieved using them with RLA.  Refer to the revised SQL syntax:
http://publib.boulder.ibm.com/infocenter/systems/topic/db2/rbafzxcindx.htm
Regards, Chuck
As an Amazon Associate we earn from qualifying purchases.