Chapter 17. Additional information about Query for iSeries for programmers

This chapter provides additional information which may be of interest to programmers.

Files with different record formats in Query for iSeries

You can use a file that has more than one record format; however, you can use only one record format at a time. If an application you are designing requires processing of different record formats in the same file at the same time, you should consider using the RPG/400 or COBOL/400* programming language.

For example, if customer names are in one record format and the amount each customer owes is in a different record format in the same file, a single query cannot print the names of all customers who owe more than $500. For Query to select records from both record formats, the selection values—customer name and amount owed—must exist in one record format (that is, the physical disk record must reflect both customer name and amount owed fields).

Note: This could be accomplished in a single query by joining the file to itself. However, the record formats must all contain a common field. For more information on joining files, see “Joining files in a Query for iSeries query” on page 42

File sharing considerations in Query for iSeries

Other application programs can read and update a file at the same time Query is creating a report from the file, and two or more Query definitions can refer to the same file at the same time.

Overriding database files in Query for iSeries

Your query run results cannot be predicted if you use the Override with Database File (OVRDBF) command to override a database file. Query allows you to use the OVRDBF command, but problems may occur because record formats and file members selected for the overridden file may not correspond to the new file.

DBCS considerations when defining result fields in Query for iSeries

If you use the SUBSTR function on a DBCS-only or DBCS-either field, the result field is an SBCS character field. If you use the SUBSTR function on a DBCS-graphic field, the result field is a DBCS-graphic field. With a DBCS-open field, the result is a DBCS-open field.

If you concatenate DBCS-only fields or DBCS-only constants (or both), the result field is a variable-length DBCS-only field.

If you concatenate DBCS-open fields, the result field is a variable-length DBCS-open field.

If you concatenate a DBCS-only, DBCS-open, or DBCS-either field or constant (or both) with an SBCS character field or constant, the result field is a variable-length DBCS-open field.

If you use DBCS-graphic fields or constants in a concatenation operation, all fields and constants must be DBCS-graphic.

If you use UCS2-graphic fields in a concatenation operation, all fields must be UCS2-graphic.

© Copyright IBM Corp. 2000, 2002

187

Page 199
Image 199
IBM SC41-5210-04 Files with different record formats in Query for iSeries, Overriding database files in Query for iSeries