IBM ISERIES SC41-5210-04 User Manual

Browse online or download User Manual for Software manuals IBM ISERIES SC41-5210-04. IBM ISERIES SC41-5210-04 User's Manual

  • Download
  • Add to my manuals
  • Print
  • Page
    / 294
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews

Summary of Contents

Page 1 - ERserver

iSeriesQuery for iSeries UseVersion 5SC41-5210-04ERserver

Page 2

Running a Query for iSeries query...251Running a default query in Query for iSeries ...251Selecting records at

Page 3 - ER s e r v e r

After making new selections or changing old ones, press the Enter key to rearrange them on the display inthe new sequence. You can then renumber them

Page 4 - “Notices” on page 261

Select and Sequence FieldsType sequence number (0-9999) for the names of up to 500 fields toappear in the report, press Enter.Seq Field Seq Field10 CO

Page 5 - Contents

After you have confirmed the fields you want by pressing the Enter key a second time without making anychanges to your sequence choices, Query complet

Page 6

Chapter 7. Selecting records in Query for iSeriesThis chapter describes how you can perform record selection tests so that your query output contains

Page 7 - Contents v

Select RecordsType comparisons, press Enter. Specify OR to start each new group.Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...AND/OR F

Page 8

Comparison values in Query for iSeriesThe value you compare the field with can be:v Another fieldv A numeric constantv A character constant (SBCS or D

Page 9 - Contents vii

SBCS characterTimestampDBCS-eitherDBCS-openv Any field can be compared to the keyword NULL using the IS or ISNOT test to determine if a field valueis

Page 10 - Query for iSeries Use V5R2

Note: If you are sending queries between countries that use the comma for a decimal separator, put ablank after each comma separating the offset and l

Page 11 - About Query for iSeries Use

Date, time, or timestamp comparisons in Query for iSeriesA date, time, or timestamp value may be compared either with another value of the same data t

Page 12

Records are selected if the data in the field BALDUE is less than or equal to the data in the field CRLIMIT.When you test for RANGE, the contents of t

Page 13

About Query for iSeries UseQuery for iSeries is a decision support utility you can use to obtain information from the DB2 UDB foriSeries. This book de

Page 14 - 2 Query for iSeries Use V5R2

v Must be date constants if comparing to a date field. If the list contains correct representations of a datebut in other than SAA format, you may get

Page 15

You can use some special characters to represent the positions in the field that you do not care about:v An underscore (_) means skip one character at

Page 16 - 4 Query for iSeries Use V5R2

DBCS-only LIKE, NLIKE (not like) pattern in Query for iSeries: This pattern, which contains onlydouble-byte characters, can be used for any bracketed-

Page 17 - Query for iSeries definitions

If the test pattern consists of two apostrophes alone (’’ or G’’) or two apostrophes enclosing only DBCSshift-out and shift-in characters (’s/os/i’ or

Page 18 - 6 Query for iSeries Use V5R2

Select RecordsType comparisons, press Enter. Specify OR to start each new group.Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...AND/OR F

Page 19

Select RecordsType comparisons, press Enter. Specify OR to start each new group.Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...AND/OR F

Page 20 - 8 Query for iSeries Use V5R2

104 Query for iSeries Use V5R2

Page 21

Chapter 8. Selecting sort fields in Query for iSeriesThis chapter describes how you can select sort fields to control the arrangement of the data in y

Page 22 - 10 Query for iSeries Use V5R2

Select Sort FieldsType sort priority (0-999) and A (Ascending) or D (Descending) forthe names of up to 32 fields, press Enter.SortPrty A/D Field___ _

Page 23

v The states, and the customers listed for each state, should appear alphabetically.In order to obtain the order you want, your first sort field is cr

Page 24 - 12 Query for iSeries Use V5R2

x Query for iSeries Use V5R2

Page 25

Select Sort FieldsType sort priority (0-999) and A (Ascending) or D (Descending) for thenames of up to 32 fields, press Enter.SortPrty A/D Field Text

Page 26 - 14 Query for iSeries Use V5R2

SBCS character data in SBCS, DBCS-open, and DBCS-either fields are sorted in the order of thehexadecimal representation of the characters or an order

Page 27

110 Query for iSeries Use V5R2

Page 28 - 16 Query for iSeries Use V5R2

Chapter 9. Selecting a collating sequence in Query for iSeriesThis chapter describes how you select the collating sequence for your query. The collati

Page 29

To collate means to place items in proper sequence or to check that items are in proper sequence. ForQuery for iSeries purposes, collating sequences a

Page 30 - 18 Query for iSeries Use V5R2

Selecting a Query for iSeries collating sequenceTo select a collating sequence, you have to understand how the data exists in your files. For example,

Page 31

Table 3. Example of How a Code Table Works (continued). The value in the left column is the first half of thehexadecimal value. The value at the top o

Page 32 - 20 Query for iSeries Use V5R2

as in most Query for iSeries language sequences, each pair of uppercase and lowercase letters (such asA and a) sort together because they share a coll

Page 33

The CCSID of the sequence is shown at the top and is always your job CCSID. If the collating sequenceCCSID does not match your job CCSID, the previous

Page 34 - 22 Query for iSeries Use V5R2

Select Translation TableLibrary ... *LIBL Name, *LIBL, F4 for listSubset ... __________ Name, generic*Position to ... __________ Starting

Page 35

Part 1. Introduction to Query for iSeriesChapter 1. What is Query for iSeries? ...3Query for iSeries fundamentals ...

Page 36 - 24 Query for iSeries Use V5R2

Select System Sort SequenceType choices, press Enter.Sort Sequence...1 1=Job run2=Unique3=SharedLanguage id...*JOBRUN *JOBRUN, language id, F4 fo

Page 37

Chapter 10. Specifying report column formatting in Query foriSeriesThe first part of this chapter describes how you control the format of your query o

Page 38 - 26 Query for iSeries Use V5R2

Each column heading appears in the report exactly as you type it. Each heading can be up to three20-character lines, and you can use any characters yo

Page 39

v 0 through 9 (single-precision) or 0 through 17 (double-precision) for floating-point fieldsFor date, time, timestamp and DBCS fields, you cannot cha

Page 40 - 28 Query for iSeries Use V5R2

Note: You cannot change the order of the fields on your report during the formatting process. If youdetermine that you need to change the order of the

Page 41

The Define Numeric Field Editing display allows you to specify the type of editing you want to use to edit anumeric field. The editing determines how

Page 42 - 30 Query for iSeries Use V5R2

v The Edit option value is the value last specified in the query definition, the value associated with thefield definition in the file definition (if

Page 43

Decimal point in Query for iSeries reportsType the option number of the character that you want used as the decimal point in this field. The optionnum

Page 44 - 32 Query for iSeries Use V5R2

v If you specify option 3 (Floating currency symbol), then the negative sign moves (or floats), dependingon how many leading zeros it replaces, so tha

Page 45

The right currency symbol is always in a fixed position.Print zero value in Query for iSeries reportsWhen this field contains a numeric value of zero,

Page 46 - 34 Query for iSeries Use V5R2

2 Query for iSeries Use V5R2

Page 47

The Describe Date/Time Field Editing display allows you to specify the type of separator character thatyou want used for a numeric field that contains

Page 48 - 36 Query for iSeries Use V5R2

Specifying an edit code in Query for iSeries reportsThe Specify Edit Code display allows you to specify which edit code or user-defined edit descripti

Page 49

Note: For all these edit codes, decimal points are always shown, and leading zeros are alwayssuppressed.Query uses the J edit code as the default edit

Page 50 - 38 Query for iSeries Use V5R2

Optional edit code modifier in Query for iSeries reportsType the character that you want used as the optional modifier for the specified edit code. If

Page 51

Specify Edit WordField...: Heading1...:Length ...: Heading2...:Decimal...: Heading3...:Type information, press Enter. (Put quotes around edit w

Page 52 - Format display

v An edit word does not have to have a decimal digit position (to the right of the decimal point) for eachdecimal digit in the field; only the total l

Page 53 - Selections display

134 Query for iSeries Use V5R2

Page 54 - 42 Query for iSeries Use V5R2

Chapter 11. Specifying report summary functions in Query foriSeries reportsThis chapter describes how to specify the summary functions for each of the

Page 55

2=AverageShows the average of the values in the field for the break level or for the whole column (numeric fieldsonly). The average is the total divid

Page 56 - 44 Query for iSeries Use V5R2

Summary functions can be specified for as many of these fields as you want, as long as that type offunction is valid for that type of field.Summarizin

Page 57

Chapter 1. What is Query for iSeries?Query for iSeries is an IBM®licensed program and a decision support utility that can be used to obtaininformation

Page 58 - 46 Query for iSeries Use V5R2

138 Query for iSeries Use V5R2

Page 59

Chapter 12. Defining Query for iSeries report breaksThis chapter describes how you define the report breaks that you want to occur in your query repor

Page 60 - 48 Query for iSeries Use V5R2

Define Report BreaksType break level (1-6) for up to 9 field names, press Enter.(Use as many fields as needed for each break level.)Break SortLevel Pr

Page 61

v If no break fields are selected, no summary functions are selected and final summaries are suppressed.Only a count of the records is produced.In a n

Page 62 - 50 Query for iSeries Use V5R2

You can exclude break fields from showing in the report in column format and still use their values in thereport’s break text. That is, if you specify

Page 63

Defining report break formatting in Query for iSeries reportsThe Format Report Break display is used to format each of the break levels (1 through 6)

Page 64 - 52 Query for iSeries Use V5R2

N=NoAny summary values are not to be suppressed. They are to be included each time that a report breakoccurs at this break level.Y=YesAll summary valu

Page 65

Chapter 13. Selecting output type and output form in Queryfor iSeries reportsThis chapter describes how you select where you want your query output to

Page 66 - 54 Query for iSeries Use V5R2

output definition information. If no field selections are made, Query produces all fields for a databasefile. Result fields are ordered last instead o

Page 67

N=NoThe data for each output record is not to be wrapped when the length of the output record exceedsthe width of the report line. Instead, any extra

Page 68 - 56 Query for iSeries Use V5R2

Another record format, named ZIPADDRESS, might be defined for a file that might be location-oriented andcontain only the ZIPCODE, STATE, CITY, and STR

Page 69

Original report:Position to line ... Shift to column . . .Line ...+...1...+...2...+...3...+...4...+...5...+..INTEGER CHAR DECIMAL NUMERIC

Page 70 - Query for iSeries expressions

Define Printer OutputType choices, press Enter.Printer device... *PRINT *PRINT, nameForm sizeLength... ___ Blank, 1-255Width ... 132 Blank, 1

Page 71 - 5 + QUANTITY

If you want to increase the left margin of the report (with the left edge being print position 1), go to theSpecify Report Column Formatting display a

Page 72 - 60 Query for iSeries Use V5R2

Completing this display does not cause the query to immediately run and print a report. You must still usethe Exit This Query display (see Chapter 15,

Page 73

v If you type *STD, the system assumes that the standard forms are already in the printer, and nomessage is sent to the system operator.Copies in Quer

Page 74 - 62 Query for iSeries Use V5R2

N=NoNo cover page is to be printed for your report. If you specify text on the Cover page title prompt, it issaved for future use.Cover page title of

Page 75 - DEFAULT , ccsid

Print standard page headings in Query for iSeries reports: Type a Y or N to indicate whether thesystem’s standard headings are to be printed on each p

Page 76 - 64 Query for iSeries Use V5R2

For database file output, some report characteristics (although they may be defined in this query definition)are ignored. If you later change the outp

Page 77

Note: This can cause an unwanted result if a date value outside the range 1940 through 2039 is put intoa file field that has a two-digit year format.

Page 78 - 66 Query for iSeries Use V5R2

definition is the only way to determine some of the assigned attributes, such as the allocated length forvariable length fields. Changing the format d

Page 79 - Query for iSeries time

v CL and DDS use the same terms and descriptions as IDDU, but they provide additional support for files.Using DDS and CL commands, you can define and

Page 80 - Query for iSeries timestamp

If you specify *FILE, *FIRST, or *LAST in this prompt, a member is created with the same name as the fileif the file is created or replaced or has no

Page 81

For all options, if the file does not exist in the specified library, Query tries to create that file.Authority in Query for iSeries reports: Type the

Page 82 - 70 Query for iSeries Use V5R2

Summary-only output of a Query for iSeries report to a database fileThe data sent to a database file, when summary-only output is selected, is one of

Page 83

Break level ID (1) | | | ||||| ||Overflow indicator (1) Total salary (11.2) ||| ||County (11) | Average salary (8.2)||City (10) Count (7.0)The number

Page 84 - 72 Query for iSeries Use V5R2

162 Query for iSeries Use V5R2

Page 85 - HIREDATE - BIRTHDATE

Chapter 14. Specifying Query for iSeries processing optionsThis chapter describes how you specify processing options for running a query. The processi

Page 86 - 74 Query for iSeries Use V5R2

Rounding numeric field values during Query for iSeries processingYou can control whether the result of numeric field calculations or field length chan

Page 87 -  DAY ( expression ) 

Whether you choose to have decimal data errors ignored depends on whether your data contains valuesthat cause decimal data errors. You may want to def

Page 88 - 76 Query for iSeries Use V5R2

166 Query for iSeries Use V5R2

Page 89 -  MINUTE ( expression ) 

Chapter 15. Exiting and running a Query for iSeries queryThis chapter describes how to exit query definition and the different ways you can run your q

Page 90 - 78 Query for iSeries Use V5R2

Figure 3. Major Tasks on the Query Menu and the Work with Queries Display6 Query for iSeries Use V5R2

Page 91 -  TIMESTAMP ( expression )

Describing the Query for iSeries query definitionYou can also type some descriptive text about the query. The text reminds you what the query is for w

Page 92 - 80 Query for iSeries Use V5R2

Running a Query for iSeries queryRunning a query consists of telling Query for iSeries to use the query definition to acquire the data youwant from se

Page 93

You can run a query and get the report without saving the definition of the query only if you are runninginteractively. (The query must be saved to ru

Page 94 - 82 Query for iSeries Use V5R2

Work with QueriesType choices, press Enter.Option ... _ 1=Create 2=Change 3=Copy 4=Delete5=Display 6=Print definition8=Run in batch 9=RunQuery ...

Page 95

Following are some suggestions for using the RUNQRY command:v If you want to use an existing query without changing the file or files to query, specif

Page 96 - 84 Query for iSeries Use V5R2

Chapter 16. Working with Query for iSeries query definitionsThis chapter describes the ways you can work with your query once it has been created and

Page 97

Define the QueryQuery...: QRY1 Option ...: ChangeLibrary...: QGPL CCSID ...: 37Type options, press Enter. Press F21 to select all.1=SelectOpt

Page 98 - 86 Query for iSeries Use V5R2

When you finish making changes on all the displays you want to change, Query returns you to the Definethe Query display, where the options now defined

Page 99

Considerations for changing Query for iSeries queriesTo make changes to your query, choose the correct options on the Define the Query display. Refer

Page 100 - 88 Query for iSeries Use V5R2

Table 8. Effect of Collating Sequence and Processing Option on Selection. Either or both NAME1 and NAME2 areDBCS data. Yes means the record under test

Page 101

Chapter 2. General operating information for Query for iSeriesThis chapter describes the general operating information for Query, such as getting star

Page 102 - 90 Query for iSeries Use V5R2

To place the copy in the same library as the original, do not type anything in the To library prompt.Then select a choice in the Replace query prompt:

Page 103

delete. (For more information about using lists, see “Using lists in Query for iSeries” on page 9.) Thenpress the Enter key. The Confirm Delete of Que

Page 104 - 92 Query for iSeries Use V5R2

If you display a query and decide you want to change it, you have to return to the Work with Queriesdisplay and use option 2 (Change). You can print t

Page 105

When you select option 6 (Print definition) on the Work with Queries display and press the Enter key, thequery definition is printed immediately.Infor

Page 106 - 94 Query for iSeries Use V5R2

Example of printed record format information for a Query for iSeriesquery definitionThe following is an example of one particular part of the query de

Page 107

E means DBCS-eitherG means DBCS-graphicL means DateT means TimeZ means Timestampv The Null column shows whether the field is null capable (Y) or not (

Page 108 - 96 Query for iSeries Use V5R2

184 Query for iSeries Use V5R2

Page 109

Part 3. Advanced information about Query for iSeriesChapter 17. Additional information about Query for iSeries for programmers ...187Files with d

Page 110 - 98 Query for iSeries Use V5R2

186 Query for iSeries Use V5R2

Page 111

Chapter 17. Additional information about Query for iSeries forprogrammersThis chapter provides additional information which may be of interest to prog

Page 113

Using Query for iSeries function keysFunction keys like Enter, Help, and Print can be used at any time with any query display. However, not allthe fun

Page 114 - (MONTH EQ 1 AND YEAR EQ 87)

Joining files in Query for iSeriesFor joining files (type of join):v Type 1 join is the same as for Query/36 (on System/36).v Type 2 join selects all

Page 115

In calculations involving many large fields, you can control your results better by breaking the expressioninto parts, calculating each part as a sepa

Page 116

Example: Increasing the decimal precision for result fields in Query foriSeriesFigure 5 has a result field with a current maximum precision of 31 (len

Page 117

Selecting records (ignoring field case) in Query for iSeriesTo select records ignoring the case, do one of the following:v Define your own collating s

Page 118

192 Query for iSeries Use V5R2

Page 119

Part 4. Appendixes© Copyright IBM Corp. 2000, 2002 193

Page 120

194 Query for iSeries Use V5R2

Page 121

Appendix A. Differences between Query for iSeries andQuery/36This appendix describes the differences between Query for iSeries and Query/36. The Query

Page 122

spacing. In Query for iSeries, the report skips an extra line for report breaks unless it is defined toskip to a new page. This means the first detail

Page 123

Command differences between System/36 and Query for iSeriescommandsThe following table lists the System/36 Query commands and the equivalent OS/400 sy

Page 124

DBCS characters take twice the amount of space of SBCS characters. In addition, a shift-out characterprecedes DBCS data, and a shift-in character foll

Page 125

198 Query for iSeries Use V5R2

Page 126

Appendix B. Practice exercise for Query for iSeries queryTo do an exercise using query, you must first have a file set up with some data. This exercis

Page 127

7. You will name the file definition first, so select option 3 (File). (The name SYSDIC appears in the Datadictionary prompt on the following display;

Page 128

Create and Select Field DefinitionsDefinition...: NAMEADDRR Dictionary...: SYSDICPosition to... .__________ Field, sequence (0-99999)Type seq

Page 129

Create Field DefinitionsType information, press Enter to create.Field type (size)..: 1=Character (1-32766)2=Numeric (1-31, decimal positions 0-31)3=DB

Page 130

you press F3 (Exit) without making any changes to the display.You are finished creating the definitions describing a database file. The instructions t

Page 131

1. Choose option 3 (Work with database files) from the IDDU menu (or type WRKDBFIDD on a commandline).2. On the Work with Database Files display, spec

Page 132

WORK WITH DATA IN A FILE Mode...: ENTRYFormat...: NAMEADDR File...: NAMEADDRLASTNAME: SIMPSONFIRSTNAME: FRANKADDRESS1: 1722 ORANGE STREETADDRESS2:C

Page 133

End Data EntryNumber of records processedAdded ...: 10Changed ...: 0Deleted ...: 0Type choice, press Enter.End data entry ... Y Y=Yes, N=NoYou

Page 134

v AmountAfter you create and save the query, you run it as it exists and then change the query and run it again.Query for iSeries query exercise: Crea

Page 135

The number of items shown in the list part of the display varies, depending on what form the list is in andthe amount of space used by the prompt part

Page 136

Notice that Query has already supplied a 1 for the Specify file selections option on this display. Thisis because whenever you create a query, you mus

Page 137

Specify File SelectionsType choices, press Enter. Press F9 to specify an additionalfile selection.File... NAMEADDR Name, F4 for listLibrary ...

Page 138

Exit This QueryType choices, press Enter.Save definition . . . Y Y=Yes, N=NoRun option... 1 1=Run interactively2=Run in batch3=Do not runFor a save

Page 139

Work with QueriesType choices, press Enter.Option ... _ 1=Create, 2=Change, 3=Copy, 4=Delete5=Display, 6=Print definition8=Run in batch 9=RunQuery

Page 140

Define the QueryQuery...: KJOQRY Option ...: CHANGELibrary...: YOURLIB CCSID...: 37Type options, press Enter. Press F21 to select all.1=Sele

Page 141

Select RecordsType comparisons, press Enter. Specify OR to start each new group.Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...AND/OR F

Page 142

Display ReportReport width...: 117Position to line ... ______ Shift to column ... _____Line ...+...1...+...2...+...3...+...4...+...5.

Page 143 - Specifying edit words

Exit This QueryType choices, press Enter.Save definition . . . N Y=Yes, N=NoRun option... 3 1=Run interactively2=Run in batch3=Do not runFor a save

Page 144

1. On the command line of the OS/400 Main Menu, type the DSPOBJD command as shown on thefollowing display and press the Enter key. This creates the fi

Page 145

Work with QueriesType choices, press Enter.Option ... 1 1=Create, 2=Change, 3=Copy, 4=Delete5=Display, 6=Print definition8=Run in batch 9=RunQuery

Page 146

Using Query for iSeries commandsA command is a statement used to request a function of the system. This means you need onlyremember a command that is

Page 147

Specify File SelectionsType choices, press Enter. Press F9 to specify an additionalfile selection.File... QRYFILE Name, F4 for listLibrary ...

Page 148

Select and Sequence FieldsType sequence number (0-9999) for the names of up to 500 fields toappear in the report, press Enter.Seq Field Seq Field Seq

Page 149

Select and Sequence FieldsType sequence number (0-9999) for the names of up to 500 fields toappear in the report, press Enter.Seq Field Text Len Dec1

Page 150

Select RecordsType comparisons, press Enter. Specify OR to start each new group.Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...AND/OR F

Page 151

Select RecordsType comparisons, press Enter. Specify OR to start each new group.Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...AND/OR F

Page 152

Select Sort FieldsType sort priority (0-999) and A (Ascending) or D (Descending) forthe names of up to 32 fields, press Enter.SortPrty A/D Field Text

Page 153

Specify Report Column FormattingType information, press Enter.Column headings: *NONE, aligned text linesColumnField Spacing Column Headings Len Dec Ed

Page 154

Select Report Summary FunctionsType options, press Enter.1=Total 2=Average 3=Minimum 4=Maximum 5=Count---Options--- Field Text Len DecODLBNM LIBRARY 1

Page 155

Define Report BreaksType break level (1-6) for up to 9 field names, press Enter.(Use as many fields as needed for each break level.)Break SortLevel Pr

Page 156 - JY Clarke

Format Report BreakBreak level ...: 1Type choices, press Enter.(Type &field in text to have break values inserted.)Skip to new page... N Y=Y

Page 157

If you select option 3 (Delete a query) on the Query Utilities menu, you are shown the prompt display forthe Delete Query (DLTQRY) command. You can us

Page 158

Display ReportReport width...: 104Position to line ... Shift to column ...Line ...+...1...+...2...+...3...+...4...+...5...+...6...

Page 159

Exit This QueryType choices, press Enter.Save definition . . . N Y=Yes, N=NoRun option... 3 1=Run interactively2=Run in batch3=Do not runFor a save

Page 160

230 Query for iSeries Use V5R2

Page 161

Appendix C. Query for iSeries performance tips andtechniquesThis appendix provides guidelines for improving the performance of the Query for iSeries p

Page 162

Note: Having existing access paths is important because a temporary access path created by Query isnot saved. It must be created each time that partic

Page 163

Each time you run a saved query, Query validates the access plan by checking that the files and accesspaths named in the plan still exist.If it is val

Page 164

stored in the low-order four bits of each byte. The high-order four bits of the low-order byte contain thesign. The high-order four bits of all other

Page 165

retrieve the text for each field. Also, showing the text for each field results in fewer fields being shown oneach display so you have to page through

Page 166

Note: If there is no existing access path matching some of the record selection tests, Query does notbuild an access path solely for purposes of selec

Page 167

input or original file name. This produces a new database file containing the sorted records. The timerequired to produce the sorted records may vary,

Page 168

9=Run Runs a query. Query displays a report, prints a report, or puts the data into a databasefile, depending on what is specified in the query defini

Page 169

However, if the data you want to view is at the end of the searched records, it may take longer thananticipated to display those records. This may als

Page 170

Option 2—Matched records with primary fileA record from the primary file is selected regardless of whether there is a match with any of thesecondary f

Page 171

Be careful with using the “NE” comparison between fields from different files on the Specify How to JoinFiles display. This could result in a large nu

Page 172

Query for iSeries performance tuningA properly tuned system provides much better overall performance than one in which performance tuninghas not been

Page 173

display and also the total amount of time it takes the query to run. If a significant portion of thequery run time is spent building an access path, a

Page 174

Appendix D. Preventing users from running Query for iSeriesqueries interactivelyThe system administrator can restrict users from running queries inter

Page 175

244 Query for iSeries Use V5R2

Page 176

Appendix E. Coded character set identifiers (CCSIDs) inQuery for iSeriesThis appendix contains information about coded character set identifiers or CC

Page 177

Query for iSeries recognizes when conversion of data, collating sequences, and text is needed, andperforms the conversion. The system notifies you if

Page 178

CCSID marking in Query for iSeriesThe following bulleted objects contain CCSID tags used by query processing. Each item inherits its CCSIDfrom the con

Page 179

You can select as many as 30 queries from the list, as well as type a query name and option in the firstlist position of this display. Query processes

Page 180

- Text about the member *- Data (the CCSID tag or tags are in the format definition)Notes:1. The CCSID of the query definition is shown on displays th

Page 181

Note: The query profile, user-defined collating sequence default, and CCSID are only updated if youpress F23 from the Define Collating Sequence displa

Page 182

Table 10. How CCSIDs Affect Displaying a QueryJob CCSID Query CCSIDConstants Processed as Markedwith CCSID37 37 3765535 37 3737 65535 6553565535 No ta

Page 183

For example, the language sequence is used to initialize the Define Collating Sequence display if there isno previously defined sequence for the query

Page 184

Table 12. How CCSIDs Affect Run-Time Record SelectionJob CCSID Query CCSID Constants Treated as CCSID37 37 3765535 37 3737 65535 3765535 No tag 655353

Page 185

CCSID and result field column headings in Query for iSeriesA column heading in a result field definition is converted, if necessary, to the job or doc

Page 186

CCSID compatibility considerations in Query for iSeriesCCSID marking makes it possible for conversions to be performed before presentation of marked m

Page 187

Table 13. CCSIDs Not Compatible-Definition-Time Consequences (continued)Item 1 Item 2 ConsequenceCollating sequence Field Cannot perform comparison fo

Page 188

Table 14. CCSIDs Conversion Problems-Run-Time Consequences (continued)Item 1 Item 2 ConsequenceCollating sequence Job Cannot convert table for perform

Page 189

Table 16. How CCSIDs Affect Query UseJob CCSID Query CCSIDRun QueryallowedChange QueryallowedRun time recordselectionDisplay QueryallowedA A YesYesYes

Page 190

library group are shown. For example, if you typed IN* in the Subset prompt, you might see a list of querynames like: INTEREST, INTFEB, INTMARCH, INVE

Page 191

258 Query for iSeries Use V5R2

Page 192

BibliographyThe following OS/400 books contain informationyou may need. The books are listed with their fulltitle and base order number.v ADTS/400: Da

Page 193

260 Query for iSeries Use V5R2

Page 194

NoticesThis information was developed for products and services offered in the U.S.A. IBM may not offer theproducts, services, or features discussed i

Page 195

The licensed program described in this information and all licensed material available for it are provided byIBM under terms of the IBM Customer Agree

Page 196

IndexSpecial Characters*ALL authority 159, 168*ALL join 44, 188*ALL special library name 10*ALLUSR special library name 10*CHANGE authority 159, 168*C

Page 197

CCSID (coded character set identifier) (continued)definition 246displaying 17displaying query 249edit word 132file selection 252footing 253join tests

Page 198

coded character set identifier (CCSID) (continued)sort field 253summary function 253translation table 116collating sequence 87, 111, 112, 249affecting

Page 199

constant (continued)graphicmigration 241numericrecord selection test 94result field 59control language (CL) 5creating database files 5Copy Queries dis

Page 200 - RESULT10 9+9+9+9+9 999999

date, time, and timestamp field (continued)migratingNtoN-1 241date, time, and timestamp valueaverage summary function 136comparing to null 96IS, ISNOT

Page 201 - Query for iSeries

Work with QueriesLibrary... QGPL Name, *LIBL, F4 for listSubset ... __________ Name, generic*Position to... __________ Starting character

Page 202

definition (continued)changing 30, 173changing (example) 211copying 177copying before changing 173creating 27, 30creating (example) 206deleting 179dis

Page 203

dividing by zero (0)example 83DLTQRY (Delete Query) command 11, 178double-byte character set (DBCS)bracket characters 9character constantshift-in char

Page 204

field (continued)length and decimal position in report 120missing from file definitionduring file selection process 55starting to change or display a

Page 205 - Part 4. Appendixes

function (continued)HOURargument rules 76syntax diagram 76introduction 5MICROSECONDargument rules 77syntax diagram 77minimum summarynull value 135MINU

Page 206

increasing the decimal precision 190information for programmers, advanced 187interactive data definition utility (IDDU)data dictionary 4definition 199

Page 207 - Query/36

list (continued)selecting itemshow 10library name 10queries 10query name 10selecting items from 16library 14subsetWork with Queries display 14LIST (li

Page 208

OobjectDB2 UDB for iSeries program 5query definition 5omitting field from report 121OO (double-byte O) 8operatorconcatenation (||) 60null value 60nume

Page 209

query definition (continued)DLTQRY command 11, 178Query for iSeries Utilities menu 11Work with Queries display 178displaying 179exiting 167information

Page 210

report (continued)summary function 237specifying 135types 135using F13 to display layout 8using F5 to display 8, 169restrictionmigration definitions 1

Page 211 - 1. Work with data definitions

selecting (continued)items from list 10library for file selection 34matched recordsprimary file 48selected files 47members for file selectionSelect Me

Page 212

Other considerations when you are trying to locate or use a particular Query foriSeries queryYou should be aware of other considerations when you are

Page 213

symbolic characterDBCS (double-byte character set) 4system administrator guidelines 243system sort sequence 117Ttestdisplaying 53test patternDBCS LIKE

Page 214

value lengthdate 120time 120timestamp 120VARCHAR function 63VARGRAPHIC function 65variable-length fieldrelease restrictions 241verifying choicecreatin

Page 215

280 Query for iSeries Use V5R2

Page 217

Printed in U.S.A.SC41-5210-04

Page 218

iSeriesQuery for iSeries UseVersion 5SC41-5210-04ER s e r v e r

Page 219

v Change or display a query from the Work with Queries display or use the run-time record selectionoption of the RUNQRY command, and the query was def

Page 220

select only the option(s) that need to be changed and then, when you are shown the appropriate display,you need only type the new choices or change th

Page 221

20 Query for iSeries Use V5R2

Page 222

Part 2. Defining and using Query for iSeries query definitionsChapter 3. Creating a Query for iSeries query definition ...27Starting Que

Page 223

Query for iSeries date ...67Query for iSeries time ...67Query for iSeries timestamp ...

Page 224

Numeric constants as values in Query for iSeries...94Date, time, timestamp constants as values in Query for iSeries ...95Nul

Page 225

Edit code in Query for iSeries reports ...129Optional edit code modifier in Query for iSeries reports ...131Specifying

Page 226

Using function key F5 when running a Query for iSeries query ...169Running a Query for iSeries query from the Query for iSeries menu ...

Page 227

26 Query for iSeries Use V5R2

Page 228

Chapter 3. Creating a Query for iSeries query definitionThis chapter describes the process of creating a query (that is, defining a query definition o

Page 229

NoteBefore using this information and the product it supports, be sure to read the information in“Notices” on page 261.Fifth Edition (September 2002)T

Page 230 - Press the Enter key again

If you position the cursor on the Query prompt and press F4 (Prompt) to show a list, it contains the namesof all the queries that are in the library (

Page 231

Selecting options for a Query for iSeries query definitionTo select options that you want to use from those listed in the Query Definition Option colu

Page 232

You can specify one, several, or all of the options shown. To select all of them, press F21.Moving through the Query for iSeries definition displaysFo

Page 233

Suggested sequence of tasks for creating Query for iSeries queriesThe following is a suggested sequence of tasks to create queries:1. Define result fi

Page 234

32 Query for iSeries Use V5R2

Page 235

Chapter 4. Specifying and selecting files for a Query foriSeries queryThis chapter describes how you select and use one or more database files that ar

Page 236

Specify File SelectionsType choices, press Enter. Press F9 to specify an additionalfile selection.File... __________ Name, F4 for listLibrary .

Page 237

v If you type a generic library name (in the form of ABC*) or special library name in this prompt and pressthe Enter key, that library group is search

Page 238

Using file IDs for a Query for iSeries queryFile IDs are used when you select more than one file. Although Query assigns a file ID value to each files

Page 239

v If you typed a file name and left blank any of the Library, Member,orFormat prompts for the filev If there is a problem with one of the values you t

Page 240

ContentsAbout Query for iSeries Use ...ixWho should read the Query for iSeries Use book ...ixPart 1. Introd

Page 241 - Press the Enter key

Specify File Selections display, it is used as a subset value on this display, and only file names startingwith those generic characters are included

Page 242

To return to the complete list of file names, blank out this prompt (or put an * in it) and press the Enterkey.To move (position) the list of file nam

Page 243

Select MemberFile ID ...: T01File...: EXAMPFILE1Library ...: CUSTINVType option (and Member), press Enter.1=SelectOpt Member_ ___________ EXAMP

Page 244

Select Record FormatFile ID ...: T01File...: EXAMPFILE1Library ...: CUSTINVType option (and Format), press Enter.1=SelectOpt Format_ __________

Page 245

Display File SelectionsID File Library Member FormatT01 EXAMPFILE1 CUSTINV *FIRST EXAMPFILE1T02 EXAMPFILE2 CUSTINV *FIRST EXAMPFILE2BottomPress Enter

Page 246

Types of joins in a Query for iSeries querySpecify Type of JoinType choice, press Enter.Type of join... 1 1=Matched records2=Matched records with

Page 247

Note: See “CCSID and join tests in Query for iSeries” on page 252 for information on how CCSIDs canaffect your join selections.Specify How to Join Fil

Page 248

v A field name must be preceded by a 1- to 3-character file identifier if that field name is used in morethan one file selected for the query.v You ca

Page 249

- DBCS-either- DBCS-open– DBCS-either field with:- SBCS character- Date- Time- Timestamp- DBCS-either- DBCS-open- DBCS-only– DBCS-open field with:- SB

Page 250

You can obtain several different results from a file join when you use different combinations of join testsand options on the Specify How to Join File

Page 251

Selecting files on the Query for iSeries Select File display ...37Selecting file members on the Query for iSeries Select Member display

Page 252

Example: Selecting matched records using a primary file in a Query for iSeriesqueryTypea2ifyouwant to include in the query output every record in the

Page 253

In our example, the RESIDENTS file is still the primary file, so only its records that do not have a matchingsecondary record are included in the quer

Page 254

Correct method:On the Specify File Selections display, type the CUSTOMER file first, the PURCHASE file second, and the ITEMfile third. Specify the fil

Page 255

Incorrect method:On the Specify File Selections display, type the CUSTOMER file first, and specify the file ID as A. Type theITEM file second (file C)

Page 256

Query performs the file join in two steps:Step 1: Join the first two files, A and C.Query joins the files in the order listed, starting with file A (C

Page 257

every record in file C. Because there are three records in A and five records in C, the result is 15 records.The join tests are not used in this step.

Page 258

The Field columns show the fields being used to join the files. Each field name can have two parts: thefile ID and the actual name of the field, separ

Page 259

Handling missing fields during file selection process of a Query foriSeries queryWhile you were changing a query, or were defining a new query that al

Page 260

problems caused by the missing fields. You must also ensure that none of the fields were used in breaktest values on the Format Report Break display.

Page 261

Chapter 5. Defining result fields in Query for iSeriesThis chapter describes how you define result fields. They need to be defined in your query if th

Page 262

Letting Query for iSeries select records ...91Selecting the records you want in Query for iSeries ...91Compariso

Page 263

always appears below and to the right of the list to tell you where you are in the list. More... means thatthere are more items after, and possibly be

Page 264

DAYDAYSMONTHYEARv A time expression performs an operation on a time. Time expressions can contain the followingoperators or functions:+ (Addition)− (S

Page 265

When you do more than one calculation within a numeric expression, use parentheses to tell Query inwhat order to do the calculations and to make the e

Page 266

For example, if a character constant ’Dr. ’ and a character field named LASTNAME containing the valueSmith are concatenated, the result is a field con

Page 267

Example of a character field substring: If a character field named ALPHA containing the value ABCDEFGHI isused in SUBSTR(ALPHA,4,3), the result is a c

Page 268

Note: If you are sending queries between countries that use the comma for a decimal point, put a blankafter each comma separating values in a list of

Page 269

v If the first argument is UCS2 graphic data and the result is mixed data, the result length is (2.5*(n-1)) +4.The third argument, if specified, must

Page 270

VARGRAPHIC Query for iSeries functionThe VARGRAPHIC scalar function provides a way to convert:v character data (SBCS and Mixed) to DBCS graphic.v char

Page 271 - Bibliography

The actual length of the result depends on the number of characters in the argument. Each character ofthe argument determines a character of the resul

Page 272

Query for iSeries dateA date expression is a three-part value (year, month, and day) designating a point in time under theGregorian calendar, which is

Page 273

Record on one page in Query for iSeries reports ...147Displaying wrapping widths in Query for iSeries reports ...147Defi

Page 274 - Trademarks

Valid formats for times are listed in Table 2. Each format is identified by name and includes an associatedabbreviation (for use by the CHAR function)

Page 275 - Special Characters

Displaying constants format in Query for iSeriesThe Display Constants Format display shows you what date or time format you must use if you specify ad

Page 276

Subtraction rules are different from addition rules because a date, time, or timestamp value cannot besubtracted from a duration. Also, subtracting tw

Page 277 - Index 265

then MONTH(RESULT) = 12 + MONTH(DATE1) - MONTH(DATE2).YEAR(DATE2) is then incremented by 1.YEAR(RESULT) = YEAR(DATE1) - YEAR(DATE2).For example, the r

Page 278

selection on specific year, month, and day values. The marked (*) lines are necessary and a sample reportfollows. If you require rounding for fields i

Page 279 - Index 267

Time arithmetic operation in Query for iSeriesTimes can be subtracted, incremented, or decremented. The result of subtracting one time (TIME2) fromano

Page 280

Timestamp duration in Query for iSeriesA timestamp duration represents a number of years, months, days, hours, minutes, seconds, andmicroseconds expre

Page 281 - Index 269

DATE Query for iSeries functionThe DATE function returns a date from a value. The form is: DATE ( expression ) The argument must be either a:v Tim

Page 282

If the argument is a date duration or a timestamp duration, the result is the day part of the value, a binaryfield with a value between −99 and 99. A

Page 283 - Index 271

The resulting value of HOUR would equal 12.MICROSECOND Query for iSeries functionThe MICROSECOND function returns the microsecond part of a value. The

Page 284

Appendix A. Differences between Query for iSeries and Query/36 ...195Conceptual Differences ...195Operational Diff

Page 285 - Index 273

MONTH Query for iSeries functionThe MONTH function returns the month part of a value. The form is: MONTH ( expression ) The argument must be eithe

Page 286

TIME Query for iSeries functionThe TIME function returns a time from a value. The form is: TIME ( expression ) The argument must be either a:v Tim

Page 287 - Index 275

RESULT(x) = TIMESTAMP(DATEFRNK,TIMEFRNK)YEAR Query for iSeries functionThe YEAR function returns a numeric representation of the year part of a value.

Page 288

Converting date for output to a display or printer in Query for iSeriesYou can use the date functions to convert an input date field to a different fo

Page 289 - Index 277

Define Result FieldsType definitions using field names or constants and operators, press Enter.Operators: +, -, *, /, SUBSTR, ||, DATE...Field Express

Page 290

Define Result FieldsType definitions using field names or constants and operators, press Enter.Operators: +, -, *, /, SUBSTR, ||, DATE...Field Express

Page 291 - Index 279

– If your expression performs a division operation, avoid dividing by zero by defining the denominatoras the result field just before the result field

Page 292

Column headings in Query for iSeriesIf you want to specify a column heading to be used for a result field, type the heading you want on thethree lines

Page 293

Example of defining a result field in Query for iSeriesAn example of how you would create a numeric result field called DAYS using the expression WEEK

Page 294 - SC41-5210-04

Chapter 6. Selecting and sequencing fields in Query foriSeriesThis chapter describes how you select fields that you want to include in your query outp

Comments to this Manuals

No comments