(IBM i fans only) Retrieving Files Used in Queries of an IBM i Library
A colleague of mine left me a real treasure trove of queries, accumulated over many years of work. It’s an endless list: over 1000 queries, all well cataloged and described. Recently, I needed to find a query related to customer orders. Knowing that the order file is called OTORD, the customer file CLCLI, and the sample file CMCMP, I started opening the most likely queries. The process was long and frustrating: Open Query > Specify file selections > View the files used > Close Query. Stressful, right? So, I thought I’d let our trusty IBM i do some work for me. I created a procedure to retrieve the list of files used by all the queries in a specific library, with the ability to add some filters to answer more specific questions. For example: Which queries use the files OTORD00F, CLCLI00F, and CMCMP00F? The result? A clean and well-organized subfile: Don't forget to set the screen to 132 columns! The source code follows: FQRCL ...