Note: This can cause an unwanted result if a date value outside the range 1940 through 2039 is put into
a file field that has a two-digit year format. The value will be shown as pluses (++++++) on a report.
To avoid this result, either use the CHAR function to see the data in a four-digit year format when
you query the data, or change the attributes of the file field to a four-digit year format.
The record format printed at the end of the query definition shows the field characteristics of the existing
output file.
Building a new output file definition in Query for iSeries reports
Some format and field definition information from the input file definition is copied unchanged, some is
used in algorithms for defining parts of the output definition, and some is ignored.
Even if your query only sorts or selects records from a single file, the output file definition that Query for
iSeries creates when creating or replacing a file is likely to differ from that of the input file definition. Query
for iSeries creates only physical files, and does not use everything in each input field definition when
building the format definition. For example, a long comment is not carried over from the referenced field.
Even if the expression for a result field is a field name from a single file, the output field defined for the
result field differs from that of the referenced field. Data type, size, keyboard shift (DBCS subtype), and
null capability are considered in the algorithms used to derive the result definition. Column headings, text,
editing, null value defaults, and so on, are not carried over.
Specified formatting overrides saved in the query definition are used in summary only output definitions.
The column heading, size, and expression specified to define a result field are used for detail output
definitions and (when not overridden) for break fields in summary output definitions.
Query for iSeries creates field names to avoid duplication and to reflect the nature of the function applied
in summary output.
Text and column headings for summary-function fields are created from input field names and translatable
summary function captions. The CCSID assigned depends on where the name originated. The query
definition CCSID is used for result fields and the appropriate file format definition CCSID is used for file
fields.
For result fields and summary-function fields, assignment of attributes involves more than just copying
information from a related input file field, which is what happens for most attributes for detail and break
fields.
Some assigned attributes for result fields (type, size, editing) and defined attributes for input file fields can
be determined while you are working on the definition because they are shown in field lists or presented
as initial defaults.
The layout shown for F13 may be helpful if you keep in mind that it represents characteristics of displayed
or printed output, which shows result fields first (not last) when no fields are selected, does not have
individual columns for summary function values, and applies formatting overrides to detail as well as
summary output.
The record format printed for option 6 (Print definition) shows additional information, such as the coded
character set identifier (CCSID), null capability, and the specific data type of numeric fields. For summary
output, for example, you can see that certain fields (totals, averages, counts, nonfloating-point numeric
breaks, minimums, and maximums) are zoned decimal, even if the underlying field is binary or packed.
One way to see how the file will be created without actually running a long query is to create it using
record selections that cause no records to be added. The format definition of the new file can then be
displayed to see if it is satisfactory or changed to have the attributes that you want. Displaying the format
156 Query for iSeries Use V5R2