In my opinion, sometimes, when maintaining "legacy" code, it is better or easier to just continue to use a LF ...
A DDS-based Logical File combines both an "index" and a "view" in SQL terms, into a single "composite" IBM_i object.
In SQL, when you create an INDEX, they never "share" access paths, in the OS sense of that term. This is dictated by the ANSI Standards for SQL, apparently.
Recall that with DDS LFs, they will share the underlying "access paths" whenever possible. If you have older "legacy" applications with PFs with many LFs over them, with different key sequences, this can become important to reduce the total "access path maintenance" the system must perform each time the application updates or inserts or deletes a row in the underlying PFs.
Suppose you create LFs as below:
PF (in the old S/38 style, PFs often had no "keys" ... just arrival sequence)
LF1 (keys: A, B, C, D, E) LF2 (keys: A, B, C, D) LF3 (keys: A, B, C) LF4 (keys: A, B) LF5 (keys: A)
They will all "share" a single access path (index) "under the covers".
But, if you create them in the opposite order, (worst case), they will not share any access paths, and each will have its own, just like SQL indexes. And, creating them in different sequences will result in varying amounts of "access path sharing."
Also, I believe that if you create that SQL index first, even though SQL will not "share" access paths, if you were to subsequently create that DDS LF, it will share that new SQL index as its "access path" if it is defined with the correct (same) keys. This allows you to take advantage of some of the benefits provided by the newer SQL indexes over DDS-created LFs, such as larger buffer sizes, etc.
Hope this helps,
Mark S. Waterbury
On Wednesday, November 6, 2019, 12:52:15 PM EST, Justin Taylor <justin@xxxxxxxxxxxxx> wrote:
I need a keyed LF that can be used in RPG RLA, QRY/400, and SQL. If I use a SQL view, I'm afraid I'll lose my keyed sequence.
Does that mean I have to use a DDS LF?
From: Birgitta Hauser [mailto:Hauser@xxxxxxxxxxxxxxx]
Sent: Wednesday, November 06, 2019 11:42 AM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: Alt index to SQL keyed view
You cannot access an SQL Index with SQL. You only can access views. It it the query optimizer which decides if or whether and which indexes are used.
If you created an index with enhanced indexing technologies (such as additionally generated key fields or where conditions) and you want to access these data, you either have to build the additional fields you need in the SELECT statement and/or add the where conditions to the SELECT statement.
Much better however is to create a view with the appropriate information (additional key fields and where conditions) and access the view.
Mit freundlichen Grüßen / Best regards
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
"If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!"
"Train people well enough so they can leave, treat them well enough so they don't want to." (Richard Branson)
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.