IBM SC41-5210-04 manual Column headings in Query for iSeries

Models: SC41-5210-04

1 294
Download 294 pages 6.42 Kb
Page 97
Image 97

Column headings in Query for iSeries

If you want to specify a column heading to be used for a result field, type the heading you want on the three lines (up to 20 characters each) of the display that correspond to your result field. The heading will appear in your query output exactly as you enter it on the three lines.

If you do not want any heading for a result field, type *NONE in the first five positions on the first line for that field. (You must use all capital letters, and the remainder of the line and the next two lines must be blank.) If you do not specify either a heading or *NONE, Query uses the result field name as the column heading.

Length and decimal positions in Query for iSeries

For character (SBCS and DBCS), date, time, and timestamp result fields, you must leave the Len and Dec values blank. If you do not specify anything in the Len and Dec columns when you define a result field, Query determines the length of the result field. When Query determines these values, you have fewer things to consider when changing expressions. If you want to know the length of the result field, press F13 to see the layout of the report and count the number of 9s (numeric fields) and Xs (SBCS character fields). If you are using a DBCS-capable display and have DBCS data, count the number of:

Double-byte Js, which represent DBCS-only data

Double-byte Os, which represent DBCS-open (mixed) data

Double-byte Es, which represent DBCS-either data

Double-byte Gs, which represent DBCS-graphic data

For date, time, or timestamp fields, look at the length of the current date, time, or timestamp in the result field.

For numeric result fields, length is the total number of digits in the field. It includes the number of digits to the left and right of the decimal point but not the decimal point itself. Decimal is the number of decimal positions to the right of the decimal point. If you want to type your own value for the length, to prevent unexpected results, you should first read “Length and decimal positions in Query for iSeries reports” on page 120 and “Result field length and decimal positions in Query for iSeries” on page 188. Also, observe the following:

vIf you specify a value for Len, you must also specify a value for Dec (decimal positions).

vIf you increase or decrease the value in Dec, you should increase or decrease the value in Len the same amount. Also, you may need to change these values later if you make changes to the numeric expression.

vIf you leave Len and Dec blank, Query changes the value if the expression changes.

If you are creating result fields by using multiplication and division operations, you may be able to reduce the length value if the actual data in your files will not require the maximum field size as established by Query. For example, an inventory master file would typically have a PRICE field and a QUANTITY field. Both fields would have to have sufficient length to handle the largest value possible. When these two fields are multiplied to create a result field called AMOUNT, the maximum length would be the sum of the sizes of both fields. Since items with high prices are usually stocked in low quantities, the maximum field size for AMOUNT would probably be too large for practical use (for example, in a report).

Note: If you want to decrease the field length because you only want a certain number of positions shown on a report, you should not change the field length on the Define Result Fields display. Change the field length on the Specify Report Column Formatting display instead. If you specify a field length on the Define Result Fields display, the result of an numeric expression may be truncated or rounded, depending on what you specify on the Specify Processing Options display.

Chapter 5. Defining result fields in Query for iSeries 85

Page 97
Image 97
IBM SC41-5210-04 manual Column headings in Query for iSeries, Length and decimal positions in Query for iSeries