In fact, there are many tiny differences between the created SQL indexes / views and the logical files created using DDS (the way you write the source files for your logical files (LF) and compile them into LF objects).
So they are the same ? It is definitely not . But there are very similar things, and in most cases you can use them. You may never experience any difference, but it is also possible that one day you will face an inexplicable situation due to differences. Here are some of the differences that I have learned so far (and I remember right now). (Here I will talk about LFs - these logical files and PF (physical files). PF is more or less what you would call a table in SQL, but as with LF and indexes / views, I would not call them the same )
- LFs can have select / omit commands that filter PF strings. Be careful with these! Not only are they often confused, but they can also have a significant impact on your SQL queries. Such LFs are ignored by the modern query optimizer (SQE) and can even lead to the fact that SQE is not used at all, only because they exist (depending on your SQL configuration). You can usually get the same behavior with the sort index and selection.
- LFs can exchange data (LF A with index col1, col2, col3 and LF B with index col1, col2, col4 should share indexing afaik), sql indexes do not do this (but this advantage is supposed not as important as the next disadvantage)
- Indexes may have a larger page size. From what I know, this can make a difference on huge tables).
- Indexes and LFs can act differently when you rename PF and return it from your DDS source. Indexes must remain on the renamed object, while LF must refer to the new object with the old name
These differences are due to the fact that the IBM DB2 / 400 system was created long ago when no one talked about SQL and has not been developed since. But as SQL became important, IBM also introduced SQL support for its well-used database. Thus, indexes / views must support the material SQL requires. LF, on the other hand, should remain compatible with the history of AS / 400. They are different. And thus, they cannot be the same without giving up support. But they are trying to get closer.
source share