Chapter 5. Defining result fields in Query for iSeries
This chapter describes how you define result fields. They need to be defined in your query if the
information that you want to present in your report does not exist as a field in your selected file(s). For
example, you want your report to show the number of days, but your database file only has a field
containing the number of weeks. You can define a result field that contains the number of days by creating
an expression that performs a calculation on the number of weeks.
After you have defined a result field, you can use it like any other field that exists in your selected file(s).
You can include the result field in your output, you can use it to define another result field, you can use it
as a sort field, and so on.
While you are defining result fields, a list in the lower part of the display assists you by showing the names
of fields in the files selected for your query. If you want to see additional information about each field such
as descriptive text, length, and decimal positions, use F11 (Display text) to switch between the
multiple-column list and the single-column list. This information is very useful when you are deciding on a
result field name and when you are building your expressions. The page keys will present all the fields
available, four at a time. For more information on using F11, see “Using F11 to display additional
information about Query for iSeries queries” on page 15.
In most cases, the result fields that you define appear in your query output, but selecting them for output is
optional since some result fields are only needed as an intermediate step to obtain a final result. For
example, you might define a result field only for the purpose of selecting records, and you do not want the
result field to appear on the report.
Creating results fields in Query for iSeries
The Define Result Fields display appears if you typed a 1 next to the
Define result fields
option on the
Define the Query display. You use the Define Result Fields display to create the result fields that you need
for your query. (The following display has some sample fields listed in the bottom part.)
Define Result Fields
Type definitions using field names or constants and operators, press Enter.
Operators: +, -, *, /, SUBSTR, ||, DATE...
Field
Expression
Column Heading
Len Dec
__________ _________________________________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
__________ _________________________________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
Bottom
_________________________________________________________________________
Field
Field
Field
Field
ACCTNUMBER
STREETADDR
TELENUMBER
DATELASTPD
LASTNAME
CITY
CRLIMIT
INIT
STATE
BALDUE
COMPANY
ZIPCODE
PASTDUE
Bottom
F3=Exit
F5=Report
F9=Insert
F11=Display text
F12=Cancel
F13=Layout
F20=Reorganize
F24=More keys
To define a result field, you specify a unique name for the result field by entering a name in the
Field
column on the Define Result Fields display. You
cannot
specify the name of a field that exists in your
selected file(s)—the list in the lower part of the display shows you these field names. To page through the
field list, position the cursor in the list part of the display and use the page keys. (A one-word indicator
© Copyright IBM Corp. 2000, 2002
57
Summary of Contents for @server iSeries
Page 1: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Page 2: ......
Page 3: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Page 12: ...x Query for iSeries Use V5R2 ...
Page 14: ...2 Query for iSeries Use V5R2 ...
Page 32: ...20 Query for iSeries Use V5R2 ...
Page 38: ...26 Query for iSeries Use V5R2 ...
Page 44: ...32 Query for iSeries Use V5R2 ...
Page 116: ...104 Query for iSeries Use V5R2 ...
Page 122: ...110 Query for iSeries Use V5R2 ...
Page 146: ...134 Query for iSeries Use V5R2 ...
Page 150: ...138 Query for iSeries Use V5R2 ...
Page 174: ...162 Query for iSeries Use V5R2 ...
Page 178: ...166 Query for iSeries Use V5R2 ...
Page 196: ...184 Query for iSeries Use V5R2 ...
Page 198: ...186 Query for iSeries Use V5R2 ...
Page 204: ...192 Query for iSeries Use V5R2 ...
Page 205: ...Part 4 Appendixes Copyright IBM Corp 2000 2002 193 ...
Page 206: ...194 Query for iSeries Use V5R2 ...
Page 210: ...198 Query for iSeries Use V5R2 ...
Page 242: ...230 Query for iSeries Use V5R2 ...
Page 256: ...244 Query for iSeries Use V5R2 ...
Page 270: ...258 Query for iSeries Use V5R2 ...
Page 272: ...260 Query for iSeries Use V5R2 ...
Page 292: ...280 Query for iSeries Use V5R2 ...
Page 293: ......
Page 294: ... Printed in U S A SC41 5210 04 ...