IBM i Global

IBM i 

A space for professionals working with IBM’s integrated OS for Power systems to exchange ideas, ask questions, and share expertise on topics like RPG and COBOL development, application modernization, open source integration, system administration, and business continuity.


#Power


#IBMi
#Power
 View Only
  • 1.  Searching or scanning Queries

    Posted Mon February 13, 2023 09:41 AM

    Hi I have thousand of query,  A lot of them output directly to printers,  now my problem is that a printer will be removed and I need to search all query definition to find out the queries that need to be modified.   Is there a way to search all queries in a Library like fndstrpdm is used for files.



    ------------------------------
    Sylvain Amyot
    ------------------------------


  • 2.  RE: Searching or scanning Queries

    Posted Mon February 13, 2023 07:29 PM
    Edited by Satid Singkorapoom Mon February 13, 2023 08:35 PM

    Dear Sylvain

    You can use the command FNDSTRPDM2 but it needs a bit more manual work and you need to be at release 7.4 or later. So, this excellent blog post should be the best answer you are looking for: Searching for strings in source files.

    When you refer to "printers", are they actually output queues?  If so and you have only a few output queues involved, another choice for you is to create a new printer writer that serves the same output queue while removing the old writer. This Technote explains this: Using Multiple Printer Writer Support.

    ------------------------------
    Education is not the learning of facts but the training of the mind to think. -- Albert Einstein.
    ------------------------------
    Satid S.
    ------------------------------



  • 3.  RE: Searching or scanning Queries

    Posted Tue February 14, 2023 02:24 AM

    Hi
    I use the tool from https://code400.com/forum/forum/iseries-programming-languages/clp-clle/6478-query-problem
    I works fine and I am able to find all information about each query defination.



    ------------------------------
    Poul Thomsen
    ------------------------------



  • 4.  RE: Searching or scanning Queries

    Posted Tue February 14, 2023 04:35 AM

    As far as I know there is no particual API for *QRYDFN meta manipulation.

    But - there is a stored procedure called QSYS2.Print_Query_Definition

    it will print the query definition, including the printer name, and with some basic SQL you can iterate it and spot the query you need without external tools.

    with a reasonably recent IBMi you can even search with a regex thousand of spool files content with a regex just with SQL

    here some hints:

    https://www.ibm.com/support/pages/extract-information-qrydfn-object-types

    ciao



    ------------------------------
    --ft
    ------------------------------



  • 5.  RE: Searching or scanning Queries

    Posted Tue February 14, 2023 09:14 AM

    I'm assuming you're talking about Query/400 queries? If you are interested, my team built a Query/400 "discovery" tool which can plow through your queries and provide a lot of information about them in a set of output files which you can then query to see that info (and lots more about the queries). It was built more to provide info on which queries you might consider modernizing into Db2 Web Query, but you can run it for any purpose. If interested, send an email to Qu2@us.ibm.com. There is a specific output table generated for all the queries with print as it's output: 

    QD_PRINTER_OUTPUT (QD_PRTOUT)

    If the output type for the query is option 2 (printer file), this table contains information such as the printer device, length and width of the report, and the form type.



    ------------------------------
    Doug Mack
    mackd@us.ibm.com
    ------------------------------