IBM SC41-5210-04 Server User Manual


 
Work with Queries
Type choices, press Enter.
Option ....... _ 1=Create 2=Change 3=Copy 4=Delete
5=Display 6=Print definition
8=Run in batch 9=Run
Query ....... __________ Name, F4 for list
Library...... QGPL Name, *LIBL, F4 for list
F3=Exit F4=Prompt F5=Refresh F12=Cancel
Query displays a report, prints a report, or puts the data into a database file, depending on what is
specified on the Select Output Type and Output Form display. For more information on selecting an output
device, see Chapter 13, Selecting output type and output form in Query for iSeries reports.
Query uses current data each time a query is run. For example, if a customers address changes in the
file, the new address appears in the data produced when the query is run. However, if definition of data
has changed since the query was created or last changed, the report created by the query may not show
these changes. For example, assume you want to run a query that does not have column headings
specified. The query then uses column headings defined by IDDU. If the IDDU column headings have
been changed since the query was created or last changed, the query may not use the new headings.
When you change a query, Query updates the query with the current IDDU definitions. If you save the
query, any IDDU changes are saved with it. Therefore, you can make sure you have the current definitions
when you want to run the query from the Work with Queries display by selecting option 2 (Change)
instead of option 9 (Run). You can then save the query without actually making any changes by doing the
following:
v Press F3 on the Define the Query display.
v Choose to save the definition and run the query on the Exit This Query display.
IDDU definitions are explained in the IDDU online information.
Running a Query for iSeries query using the RUNQRY command
You can use the RUNQRY command to run a query. The output can be displayed, printed, or stored in
another database file. If the query contains dependent values, you must use the option for specifying run
time record selection and supply the values that would ordinarily come from a record in a different file or
query.
The RUNQRY command can be used three different ways: to run an existing query (one that has already
been created), to run an existing query with some of its definition values changed by values you specify on
this command, or to run a default query based only on the parameter values specified on this command.
(You supply parameters values to give Query information it needs, such as the query name, the library in
which the query is stored, where to send the output, and so on.)
For detailed information on the RUNQRY command, its parameters, how to use it, and some examples,
see the CL Reference information in the iSeries Information Center.
Chapter 15. Exiting and running a Query for iSeries query 171