Filter predicate

A filter predicate defines one condition that Log Master uses to select log records.

You can combine a filter predicate with additional filter predicates to form a Search condition definition. For more information, see LOGSCAN search condition definition.

The following figure shows the filter predicate syntax used in the WHERE clause of the LOGSCAN statement.


OptionDescription
Selectable field definition

Specifies the field of a log record that Log Master compares against the value variable to select log records during the log scan. For more information about the fields that you can select, see Selectable field definition. For more information about abbreviating items, see Synonyms.

operator

Defines the operator that Log Master uses to compare a selectable field against a specified value. Match the type of the operator to the type of the field that you select. The available operators are as follows:

Numeric operators in filters

Operator symbol

Operation

=

Equal

<>

Not equal

¬=

Not equal

*=

Not equal

>

Greater than

¬>

Not greater than

*>

not greater than

>=

Greater than or equal to

<

Less than

¬<

Not less than

*<

Not less than

<=

Less than or equal to

value

For each log record, Log Master compares the value of the selectable field against the constant entered as value to determine whether to select the log record. For more information about the selectable field, see Selectable field definition. For value, you can enter

  • Character constants (EBCDIC or Unicode)(for Unicode, use hexadecimal representation of UTF-8 values)

  • Graphic (double-byte) constants (EBCDIC)

  • Decimal numeric constants

  • Hexadecimal numeric constants

For each filter predicate, match the type of the constant in value to the type of the selectable field. As you enter constant values, be aware of the following points:

  • Enter EBCDIC character constants and decimal numeric constants using standard EBCDIC characters. If required, Log Master supports delimited Db2 object names. For more information about delimited names, see Defining a log scan step.

  • Enter hexadecimal numeric constants as you do in SQL statements (for example, X'D3D6C1C4C7C5D5').

  • Enter graphic constants (double-byte character set) as you do in SQL statements.

  • For Unicode character constants (such as Db2 object names or column values)

    • If the constant contains only translatable characters, enter it using standard EBCDIC characters.

    • If the constant contains any untranslatable characters, use hexadecimal representation of the Unicode UTF-8 characters for the whole constant (for example, for a Unicode string of 'A B C', enter X'4120422043').

Log Master distinguishes between hexadecimal numeric constants and hexadecimal representation of Unicode characters based on the data type of the selectable field.

PART nnnn

Selects log records that reflect activity in a given partition of a table space. The nnnn represents the partition number within the table space. To use this keyword, the following conditions must be true:

  • The value of the Selectable field definition must be either TABLESPACE NAME or PSID. For more information about the selectable field, see Selectable field definition.

  • The operator must be either equal or not equal (=, <>, ¬=, or *=).

For example, to select only the log records in one partition, use a search condition such as TABLESPACE NAME = ACCOUNTDB.TS01 PART 1. To select all of the log records in a table space except for the third partition, use a condition like PSID = 505.007 AND PSID <> 505.007 PART 3.

You can also use the PART keyword as you define a set of multiple table spaces (using the IN or NOT IN keywords).

LIKE stringPattern

Log Master can compare a string item (for example, a table name or the content of a column) against a string pattern to determine whether to select log records during the log scan. This operation is similar to the LIKE predicate in SQL syntax. If the string item meets the requirements specified by the string pattern, Log Master selects the log record.

To specify a string pattern for selecting log records, use the wildcard characters listed in the following table. The characters can be included at the beginning of, in the middle of, or at the end of the string pattern. You can include more than one occurrence or more than one type of wildcard character in the string pattern.

Wildcard characters for string comparisons

Character

Represents

For string comparisons:

*

Any string of zero or more characters (Unicode UTF-8 value: x'2A')

?

Any single character (Unicode UTF-8 value: x'3F')

%

Any string of zero or more characters (Unicode UTF-8 value: x'25')

_

Any single character (Unicode UTF-8 value: x'5F')

Warning

Exercise caution using this wildcard character because the underscore (_) is valid in many Db2 contexts, such as a table name.

For graphic or vargraphic data: Using GX'...' or UX'...', the following wildcard characters can be embedded in the string patterns:

*

Any string of zero or more characters

(EBCDIC X'425C')

*

(Unicode X'002A')

%

Any string of zero or more characters

(EBCDIC X'426C')

%

Any string of zero or more characters

(Unicode X'0025')

?

Any single character

(EBCDIC X'426F')

?

Any single character

(Unicode X'003F')

The following examples illustrate some common uses of wildcard characters in a string pattern:

String pattern

Selects log records if a string

LIKE 'ACCOUNT*'

Begins with the characters ACCOUNT

LIKE '%MANAGER'

Ends with the characters MANAGER

LIKE '*X*'

Includes the character X in any position within the string

LIKE x'25C39C25'

Includes the Unicode character X'C39C' in any position within the string (25 is the hexadecimal representation of the UTF-8 value for the % character)

LIKE '*ITEM?'

Ends with the characters ITEM, followed by any single character

LIKE 'NUM=???NAME=A*'

Begins with the characters NUM=, followed by any three characters, followed by the characters NAME=A, followed by any number of characters

IN (value, value)

Log Master can compare data from log records against a single value or a set of values separated by commas. The IN keyword indicates a set of multiple values.

NOT

Specifies that log records are selected when the value of a field does not meet the requirements that you specify. This keyword can select log records when

  • A column value does not match a string pattern value

  • A column value does not match any member of a set of multiple values

  • A column value is not changed

  • A column value is not null

  • A record’s update type does not match any member of a set of multiple update types

owner.tableName.columnName CHANGED | NULL

Selects log records based on the content of a specific column in a specific table. The CHANGED keyword enables you to select log records if the content of the column is changed in any way. The NULL keyword enables you to select log records if the content of the column is a null value.

Log Master can also compare the value in a specific table and column against a constant value or a set of constant values. For more information, see owner.tableName.columnName.

To fully qualify a specific column in a specific table, enter the user ID of the owner of the table. If you do not specify a value, Log Master uses a default value. The default value of owner is the user ID of the batch job that runs Log Master.

Do not confuse this type of filter predicate with the Column include/exclude definition that selects table columns in certain types of output. The differences are as follows:

  • A filter predicate based on a column’s status affects log records in the output. If a filter excludes records based on a column’s status, the output still contains the specified column, only certain log records are missing.

  • A Column include/exclude definition affects the entire column in the output (regardless of the column’s status). If a column is excluded, the output does not contain the specified column at all. For more information, see LOGSCAN column include/exclude definition.

UPDATE TYPE

Selects log records based on what type of action was performed on a table row (the update type). The valid values are INSERT, UPDATE, DELETE, and EXCHANGE.

IN (INSERT | UPDATE | DELETE | EXCHANGE)

Log Master can compare the update type of log records against a single update type or a set of update types separated by commas. The IN keyword indicates a set of multiple update types. The valid update types are INSERT, UPDATE, DELETE, and EXCHANGE.

Catalog activity definition

Selects log records based on the type of Db2 catalog activity that they reflect (what type of data definition language (DDL) statement resulted in the log record). Use the Catalog activity definition when you are generating a DDL output file; it is not valid if your job specifies any other type of output. For more information about the types of Db2 catalog activity that you can select, see Catalog activity definition.

Catalog object definition

Selects log records based on the type of Db2 catalog object that the log record relates to (for example, records relating to indexes or records relating to views). Use the Catalog object definition when you are generating a DDL output file; it is not valid if your job specifies any other type of output. For more information about the types of Db2 catalog objects that you can select, see Catalog object definition.

Db2 command definition

Selects log records based on the Db2 command that the log record relates to (for example, records relating to a TRACE). The Db2 Command definition is not valid if your job specifies any other type of output. For more information about the Db2 commands that you can select, see Db2 command definition.


Was this page helpful? Yes No Submitting... Thank you

Comments