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 the field must be within the range of two values (greater than or equal to the first value but less than or equal to the second) for the record to be selected. On the Select Records display, you must specify two values in the Value column, and you must separate them by a blank. If the first value is greater than the second value for a record, that record will not be selected.

For example, you want to select records only for the months of February through August. The field named MONTH is a numeric field, and it contains a 1 to represent January, a 2 to represent February, a 3 to represent March, and so on. On the Select Records display, you would specify:

Select Records

Type comparisons, press Enter. Specify OR to start each new group.

Tests: EQ, NE, LE, GE, LT, GT, RANGE, LIST, LIKE, IS, ISNOT...

AND/OR

Field

Test

Value (Field, Number, or ’Characters’)

 

MONTH_________

RANGE

2 8___________________________

____

______________

_____

______________________________

____

______________

_____

______________________________

To use the GT, GE, LT, LE, and RANGE tests for SBCS character fields and values, you may need to know the collating sequence. The collating sequence determines what characters are greater than or less than others. If you do not select a different one, the hexadecimal collating sequence is used and:

vMost special characters are less than letters.

vLowercase letters are less than uppercase.

vLetters are less than numbers.

For example, the characters A, 8, &, and b would sort from low to high as follows:

&

b

A 8

For more information about selecting or defining a collating sequence, see Chapter 9, “Selecting a collating sequence in Query for iSeries”.

Testing for values in a list (LIST NLIST) in Query for iSeries

Use the LIST, NLIST tests to determine if the content of a field is equal or not to one of the values that you list in the Value column on the Select Records display.

Note: See “CCSID and record selection tests in Query for iSeries” on page 253 for information on CCSIDs and how they affect the Select Records display.

When you compare a field with a list, the record is selected if the contents of the field exactly match one of the values you specify. The values you specify in the list:

vMust be numeric constants if you are comparing a numeric field with them.

vMust be SBCS character constants if you are comparing an SBCS character field with them.

vMust be SBCS, DBCS-only, or DBCS-open character constants if you are comparing a bracketed-DBCS field with them. (If the field being tested is a DBCS-only field, the constant can only be a DBCS-only constant.)

vMust be DBCS-graphic character constants if you are comparing a DBCS-graphic character field with them.

vMust be separated by blanks.

vCannot be field names.

Chapter 7. Selecting records in Query for iSeries 97

Page 109
Image 109
IBM SC41-5210-04 manual Testing for values in a list List Nlist in Query for iSeries