Define Result Fields
Type definitions using field names or constants and operators, press Enter.
Operators: +, -, *, /, SUBSTR, ||, DATE...
Field
Expression
Column Heading
Len Dec
MMYYDD_____ DATE(YYDDD)_____________________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
__________ _________________________________ ____________________ _____ __
_________________________________ ____________________
_________________________________ ____________________
Bottom
_______________________________________________________________________________
Field
Text
Len Dec
YYDDD
Date field in YYDDD format
6
L
Bottom
F3=Exit
F5=Report
F9=Insert
F11=Display names only
F12=Cancel
F13=Layout
F20=Reorganize
F24=More keys
The commands to run the query in example 4 are:
CHGJOB DATFMT(*MDY)
RUNQRY QRY(MMDDYY)
General considerations when creating an expression in Query for
iSeries
Following are some general rules you should use when you are creating expressions:
v
Character constants that represent dates are evaluated using the date format stored in the query
definition.
v
Your expression can have a single value, or it can use as many operands and operators needed to fit in
the three lines provided on the Define Result Fields display.
v
Do not use a result field in select records tests or as a sort field if it may have a division by zero or
overflow result.
v
You can avoid dividing by zero by doing one of the following:
– When you select records, either by means of a select/omit logical file or by means of record
selection tests on fields other than the result field, select only records that will not cause a division
by zero.
– If a dividend for the definition of a result field will always be zero, try the following change to the
expression:
Original expression--> FIELD = P / X
Revised expression---> S
= .00001
FIELD = P / (X + S)
Note:
In the expression
S
, the number of zero digits before the 1 digit should be two more than the
decimal precision of the original expression.
– If a dividend for the definition of the result field will not be zero when the divisor is, the following
change to the expression prevents an overflow condition.
Original expression--> FIELD = P / X
Revised expression---> S
= .00001
FIELD = (P*X) / ((X*X) + S)
Chapter 5. Defining result fields in Query for iSeries
83
Содержание @server iSeries
Страница 1: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Страница 2: ......
Страница 3: ...iSeries Query for iSeries Use Version 5 SC41 5210 04 ERserver ...
Страница 12: ...x Query for iSeries Use V5R2 ...
Страница 14: ...2 Query for iSeries Use V5R2 ...
Страница 18: ...Figure 3 Major Tasks on the Query Menu and the Work with Queries Display 6 Query for iSeries Use V5R2 ...
Страница 32: ...20 Query for iSeries Use V5R2 ...
Страница 38: ...26 Query for iSeries Use V5R2 ...
Страница 44: ...32 Query for iSeries Use V5R2 ...
Страница 116: ...104 Query for iSeries Use V5R2 ...
Страница 122: ...110 Query for iSeries Use V5R2 ...
Страница 146: ...134 Query for iSeries Use V5R2 ...
Страница 150: ...138 Query for iSeries Use V5R2 ...
Страница 174: ...162 Query for iSeries Use V5R2 ...
Страница 178: ...166 Query for iSeries Use V5R2 ...
Страница 196: ...184 Query for iSeries Use V5R2 ...
Страница 198: ...186 Query for iSeries Use V5R2 ...
Страница 204: ...192 Query for iSeries Use V5R2 ...
Страница 205: ...Part 4 Appendixes Copyright IBM Corp 2000 2002 193 ...
Страница 206: ...194 Query for iSeries Use V5R2 ...
Страница 210: ...198 Query for iSeries Use V5R2 ...
Страница 242: ...230 Query for iSeries Use V5R2 ...
Страница 256: ...244 Query for iSeries Use V5R2 ...
Страница 270: ...258 Query for iSeries Use V5R2 ...
Страница 272: ...260 Query for iSeries Use V5R2 ...
Страница 292: ...280 Query for iSeries Use V5R2 ...
Страница 293: ......
Страница 294: ... Printed in U S A SC41 5210 04 ...