By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
Create Index mydate_ix on pf1 (date( case when substr(digits(jdatcol),1,2) > '39' then '19' else '20' end concat digits(jdatcol)) )
However, the SQL standard prevents indexes from being referenced on an SQL query. So it would be better to move this derivation to an SQL view and then write your queries against the SQL view. Here's an example SQL view and a sample SELECT statement demonstrating how to query the view.
Create View myview as (select col1, date( case when substr(digits(jdatcol),1,2) > '39' then '19' else '20' end concat digits(jdatcol)) as datcol, col3 from pf1) SELECT col1 FROM myview where jdatcol >= CURRENT DATE
Another alternative would be changing your physical file definition to change the Julian date column to a real date column. Then, you could create a LF that maps the date column back to it's original form. Existing applications could be changed to use the logical file and not have to be modified to support the date data type. All of your queries would then just reference the date field in the physical file.
Dig Deeper on iSeries database management
Related Q&A from Kent Milligan
When working with DB2 files with columns that have both short and long names, there is no option choose which column names are returned via ODBC ...continue reading
When developing tables in a parent-child relationship, use a primary key and a foreign key along with a unique ID to make your database easier to ...continue reading
IBM did not change the default of the reuse deleted files function to YES for physical files in order to minimize the impact on any existing ...continue reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.