If you display a query and decide you want to change it, you have to return to the Work with Queries
display and use option 2 (Change). You can print the information you see when you display a query,
although the information will be in a different form. See “Printing a Query for iSeries query definition”.You
may be able to print the definition of a query that you cannot change or display.
You can display a previously saved query by using option 5 (Display) on the Work with Queries display.
You can type the name of the query (and its library) on the display, or you can, from a list of queries, type
a 5 next to the query that you want to display. (For more information about using lists, see “Using lists in
Query for iSeries” on page 9.)
After you press the Enter key, the Define the Query display appears. All the options that were defined for
the query are shown witha>totheleft of the option. To look at how the options are defined, you can
either:
1. Use F21 to look at displays for all the options (even those that are not defined for this query).
2. Type a 1 in the Opt column beside the options you want to look at.
You can press F5 while displaying a query to see how a report would look if you ran the query and
displayed or printed a report.
Note: There are circumstances under which the display you see when you press F5 may differ from the
display you would see during a normal running of the query. For example, if the collating table
selected for option 4 has been changed since the query was saved, the F5 display will show the
change, but the RUNQRY display will not.
When you have finished looking at a display for an option and are ready to look at the displays for the
next option, press the Enter key. When you have seen displays for all the options you selected, you return
to the Define the Query display. You can look at the same options again, or choose to display different
options. Whenever you decide you are finished displaying this query definition, you can either:
1. Press F12 as many times as necessary to return to the Work with Queries display.
2. Press F3 to work with any remaining queries, if you selected more than one query from a list on the
Work with Queries display. You return to the Work with Queries display if you were finished working
with all the queries you selected on that display.
Note: You may not be able to display a query if the file definition has been changed since the query was
last used or displayed. Changing the query or the file definition may make it possible to display the
query. You also may not be able to use certain command and function keys while you are
displaying because they are available only when you create or change a query.
Printing a Query for iSeries query definition
You can print the query definition. The printout tells you what information the query uses to prepare a
report or create a file. You can see the same information on your display by selecting option 5 (Display) on
the Work with Queries display, but the information will be in a different form.
You can print the query definition using any of the following methods:
v Use option 6 (Print definition) on the Work with Queries display. You can type the name of the query
(and its library) on the display, or you can, from a list of queries, type a 6 next to the query name that
you want to print the definition for. (For more information about using lists, see “Using lists in Query for
iSeries” on page 9.)
v Specify to print the definition on either the Define Printer Output display or the Define Database File
Output display and then run the query. These displays are described in Chapter 13.
v Specify to print the definition when you use the Run Query (RUNQRY) command to run the query. For
more information on the RUNQRY command, see “Running a Query for iSeries query using the
RUNQRY command” on page 171.
180 Query for iSeries Use V5R2