IBM Books

Administration Guide


Syntax for db2expln

Figure 71. Syntax for db2expln

* Figure SQLD0XPL not displayed.


The table below summarizes the option-flags and option-parameters that may be used with the db2expln command. You can specify these options in any sequence and combination.

Table 99. db2expln Command Options
Option Flag Option Parameter Description
-c creator The user ID of the creator of the package.

If you do not specify this option you will be prompted to provide it.

You may specify the creator name using the pattern matching characters, percent sign (%) and underscore (_) that may be used in a LIKE predicate.

-d database name The name of the database which contains the packages to be explained.

If you do not specify this option you will be prompted to provide it.

-e escape character Used to specify the character which is to be interpreted as an escape character rather than a pattern matching character.

For example, the db2expln command to explain the package TESTID.CALC% is db2expln -c TESTID -p CALC%. However, this command would also explain any other plans that start with CALC. To explain just the TESTID.CALC% package, you must use an escape character. By changing the command to read: db2expln -c TESTID -e ! -p CALC!% you specify that the ! character will be used as an escape character and !% is interpreted as the % character.

-h or -? (none) Obtain help information about the input parameters. Specifying this option overrides all other options.
-i (none) Display operator IDs in the explained plan. The operator IDs allow the output from db2expln to be matched to the output from the Explain facility.
-l (none) The package name can be either lower or mixed-case if this option is specified. If this -l option is not specified, the package name is converted to uppercase
-o output file The name of the file to which db2expln will write the results.

If you specify -o without a file name, you will be prompted for a file name. The default file name is db2expln.out.

-p package name The name of the package to be explained.

If you do not specify this option you will be prompted to provide it.

You may specify the package name using the pattern matching characters, percent sign (%) and underscore (_) that can be used in a LIKE predicate.

-s section number The section number to explain within the package. The number zero (0) may be specified if you wish to have all sections in the package explained. If the package creator (-c) or package name (-p) arguments imply that multiple packages will be explained, and thus multiple sections, the section value, if provided, is overridden with a zero (0).

If you do not specify this option you will be prompted to provide it.

Section numbers can be found by querying the system catalog SYSCAT.STATEMENTS (See Appendix I. "Catalog Views" for a description of the system catalog tables.)

-t (none) The output is directed to the terminal.

If you do not specify -o or -t, you will be prompted for a file name, with the default displaying the output at the terminal.

-u user id and password When connecting to a database, use the provided user ID and password.

Both the user id and password must be valid according to naming conventions and be recognized by the database.

Some of the option flags in the above table may have special meaning to your Operating System and, as a result, may not be interpreted correctly in the db2expln command line. However, it may be possible to enter these characters by preceding them with an escape character. For more information, see your Operating System user's manual.

Help and initial status messages, produced by db2expln, are written to standard output. All prompts and other status messages produced by the explain tool are written to standard error. Explain text is written to standard output or to a file depending on the output option chosen.

With the -p and -c options, multiple plans can be explained with one invocation of explain by specifying string constants for packages and creators with LIKE patterns. That is, the underscore (_) may be used to represent a single character, and the percent sign (%) may be used to represent the occurrence of zero or more characters.

For example, to explain all sections for all packages in a database named SAMPLE, with the results being written to the file my.exp, enter

    db2expln -d SAMPLE -p % -c % -s 0 -o my.exp


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]