What is the better solution of these two ways to handle the files: Physical file keyed with unique-key and logical file to view on, or physical file without any key and the unique key is one of its logical files. From the point of view of performance.
The answer depends entirely on your system and how the files will be used. If you write to a non-unique physical that has a unique-keyed logical, the system must check the logical prior to committing the record. If you are only going to do updates to that unique logical, the system must check the physical to increment the relative record number prior to committing the record. If you have the physical as the only uniquely keyed file, the system has both unique keys at the same time, the key order, and the relative record number. My personal preference is to have the physical keyed unique and use it for writes, updates and deletes. Logicals are for accessing the physical by a different sequence, although that doesn't prevent using a logical for updates, deletes and/or writes. Although my tests have not been scientific, the differences that I found in speed are very minimal and are far outweighed by ease of use and maintenance.
Dig Deeper on RPG iSeries programming
Related Q&A from John Brandt
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.