Is it possible to have a Search with expanding SubFile?
Yes. Go and do it.
Actually, I am assuming you mean to add records that satisfy the search criteria to the expanding subfile. This is a very common requirement. Just code the expanding subfile fill routine and add the search into the loop, with an ITER if the search fails to find a hit in the current record.
Things to think about: On large files, searches can take a long time. Especially if there is no matching data in the record, so the whole file is read.
Also, think about the limit of 9,999 records in a subfile.
Look at filling one page of the subfile (or to end of data), then displaying that. If the user pages the subfile to the NEXT page, then receive control in your program and load that next page, and so on. Rolling to the PREVIOUS page can be handled by the system.
Lastly, do the simplest and fastest and most certain selections first (like date ranges, code matches etc.) and the scan afterwards -- there is no point scanning text in a record if it will only be rejected afterwards because it is not for currency = USD. And use different access paths depending on selections entered - don't read data you KNOW you do not want.
MORE INFORMATION ON THIS TOPIC
The Best Web Links: tips, tutorials and more.
Ask your programming questions--or help out your peers by answering them--in our live discussion forums.
Ask the Experts yourself: Our application development gurus are waiting to answer your programming questions.
Dig Deeper on iSeries ILE programming
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ... Continue Reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ... Continue Reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record... 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.