IBM ISERIES SC41-5210-04 User Manual

Page 98

Advertising
background image

Example of defining a result field in Query for iSeries

An example of how you would create a numeric result field called

DAYS using the expression WEEKS * 7

and using the report column heading

Total Days is shown on the following display. The second input area

shows how you would define a character result field called

GREETING with a value of ‘Have a nice day‘

and no column heading.

Define Result Fields

Type definitions using field names or constants and operators, press Enter.

Operators: +, -, *, /, SUBSTR, ||, DATE...

Field

Expression

Column Heading

Len Dec

DAYS

WEEKS * 7

Total

_____ __

Days

GREETING

’Have a nice day’

*NONE

_____ __

Bottom

_________________________________________________________________________

Field

MONTHS

WEEKS

YEAR

Bottom

F3=Exit

F5=Report

F9=Insert

F11=Display text

F12=Cancel

F13=Layout

F20=Reorganize

F24=More keys

Note: See “CCSID and result field expressions in Query for iSeries” on page 252 for information on how

CCSIDs affect result fields.

Adding or removing result fields in Query for iSeries

Adding a result field to your query definition requires positioning the cursor to the top half of the display
and using F9 to insert a blank set of result field definition lines. After you have entered the information
necessary to define your new result field or fields, they are inserted after the set where the cursor was
positioned when you pressed F9. Note that a result field must be defined before it can be used as part of
an expression to create another result field.

Once you have positioned the cursor in the top half of the display, the page down key will continue to
show you the next two field definitions until you reach the last nonblank definition in the list. Page up
shows you the previous two definitions until you reach the beginning of the list.

To remove a result field, blank out all references to the field and its definition on the Define Result Fields
display. You must remove all other occurrences of it from your query, but Query leads you to any
occurrence of that result field in other expressions or in other parts of the query definition.

86

Query for iSeries Use V5R2

Advertising