IBM SC41-5210-04 Server User Manual


 
Rounding numeric field values during Query for iSeries processing
You can control whether the result of numeric field calculations or field length changes should be rounded
or truncated when your query is run. By typing a Y in the Rounding prompt on the Specify Processing
Options display, all of your numeric field calculation results are rounded (if necessary) when your query is
run. By typing an N in the prompt, all of your numeric field calculation results are truncated (if necessary)
when your query is run.
Note: If your query was created on an iSeries system, a Blank is shown as the default. If Query
determines that your query was migrated from System/36, an N is used so that the query can be
processed as it was on System/36.
Whether you choose to have numeric field calculations rounded depends on how precise you require your
results to be. Initially, you need to determine how rounding or truncation will affect your results. If your
query uses several multiplication or division operations, the result of a numeric field calculation may differ
significantly whether your results are rounded or truncated. This is because rounding or truncation could
occur more than once for the field as the calculations are performed. For example, multiplying a
customers balance due times an interest rate may supply a result with more decimal positions than you
need or are allowed to have. If necessary, the result is rounded or truncated thus introducing a small error
in the result. Suppose that this result is then added to similar calculations for other customers. Then all of
the small errors begin to add up to a larger error. This error may or may not be significant, but it will
probably be different depending on whether you have selected rounding or truncation.
Note: If you created a result field for a numeric expression that is too small to hold the integer portion (the
numbers to the left of the decimal point) of the result, the result cannot be calculated and a decimal
data error occurs. Even if you specify N in the Rounding prompt and Y in the Ignore decimal data
errors prompt, Query stops processing if it encounters a decimal data error. The rounding option
and the ignore decimal data errors option function only for numeric data that can be calculated. See
Specify processing options in Query for iSerieson page 238 for a more detailed description of the
ignore decimal data errors option.
Rounding and truncation are not done just on result fields, they are also done on the average and total
summary functions on the Select Report Summary Functions display and when overriding the numeric field
length on the Specify Report Column Formatting display (such as changing from five decimal positions to
three decimal positions).
You can let Query decide whether the result of numeric field calculations or field length changes will be
rounded or truncated when your query is run. If you leave the Rounding prompt blank on the Specify
Processing Options display, Query decides whether to round or truncate the calculations based on the
environment in which the query is run. If the query is run in the OS/400 environment, the results are
rounded. If the query is run in the System/36 environment, the results are truncated.
Ignoring decimal data errors during Query for iSeries processing
By typing a Y or an N after the Ignore decimal data errors prompt, you can indicate whether you want
Query to ignore any errors it finds in numeric fields when your query is being run. For example, an A (hex
C1) in a zoned or packed-decimal numeric field is an error. If you have chosen that errors in numeric fields
be ignored, the A is changed to a 1 (hex F1). If you have chosen that errors in numeric fields not be
ignored, either an error message is displayed or the field value is shown in the output as plus signs
(++++). The error you get depends on how the field is used.
You can let Query decide whether to ignore any errors it finds in numeric fields when your query is run. If
you leave the Ignore decimal data errors prompt blank on the Specify Processing Options display, Query
decides whether to ignore decimal data errors based on the environment in which the query is run. If the
query is run in the OS/400 environment, errors are not ignored. If the query is run in the System/36
environment, errors are ignored.
164 Query for iSeries Use V5R2