Db2 call trace listing
When the Db2® call trace option is used, IMS Batch Terminal Simulator prints the call trace information for Db2 SQL and IFI calls that were issued by the application.
Db2 SQL call trace information consists of the following information:
- Statement type
- Program or DBRM name
- PLAN name (only in a BTS batch environment)
- Statement number
- Section number
- Error status in the SQL communication area (SQLCA)
- IFI SQL statement information (see notes)
- Input and output variables
- When the IFI call trace option is used, only the IFI call trace is available; the statistics report is not printed.
- To obtain IFI SQL statement information, Db2 monitor trace class 1 must be active for IFCID 124, and your Db2 authorization ID must have MONITOR2 privilege or SYSADM authority.
- If the thread is not currently executing an SQL statement in Db2, IMS Batch Terminal Simulator might not be able to obtain SQL
statement data from Db2 IFI. In this case, IMS Batch Terminal Simulator issues the following information as IFI SQL statement
information:
IFI INFORMATION: SQL STATEMENT INFORMATION UNAVAILABLE
- If ./O SQL=ALL or TSOSQL=ALL is specified, host variable values
are printed on BTSOUT or displayed on the TSO terminal in the following
cases:
- SQL STATEMENT VARS (values from the applications) and VARS FROM DB2 (values from Db2) when the SQL call ends normally.
- SQL STATEMENT VARS when the SQL call ends abnormally.
- If you use the LOB (large objects) data type, and you specify
./O SQLOBLN=, IMS Batch Terminal Simulator puts
the LOB data type and the length on the BTSOUT or the TSO terminal
display as follows:
- LEN= shows the actual data length
- DATA= shows the LOB data
Db2 call trace options for printing Db2 call trace listing
To manage the Db2 call trace listing, specify the following options:
- ./O SQL= to print SQL call traces
- ./T SQLTRACE= to print a SQL call trace for each SQL call that is issued by the application program
Examples of the Db2 SQL call trace listing
The following example shows the SQL call trace in the default format.
The following example shows the SQL call trace in the single-line message format. This format is helpful in identifying each call. You can display the call trace in this format by specifying ./O SQL=YES and ELAPTIME=YES.
Description of the Db2 SQL call trace
The following table summarizes the information that is available for each SQL statement.
Field | Description |
---|---|
TYPE= | The type of the SQL statement. |
PROGRAM= | The program or DBRM name. This information is available for each call. |
PLAN= | The plan name. This information is available only in BTS batch environment. |
STATEMENT= | The statement number generated by the precompiler. |
SECTION= | The internally used identifier for SQL statements. |
RC= | The return code that is returned from Db2. |
Error Status | The error status returned from Db2 in the SQL communication area (SQLCA). This includes a message giving the type of error, if any, and specific names and codes when present. Error Status also includes the number of rows inserted, updated, or deleted after a multi-row operation. |
ELAPSED SEC= | The elapsed seconds of the SQL statement. This information is available only when ./O ELAPTIME=Y is specified. |
In addition, the following information is provided for each type of SQL statement.
SQL statement | Information provided |
---|---|
OPEN |
|
FETCH |
|
SELECT |
|
INSERT |
|
DELETE |
|
UPDATE |
|
PREPARE |
|
EXECUTE |
|
EXECUTE IMMEDIATE |
|
DESCRIBE |
|
Related reading: For information about the SQL statements, see the Db2 for z/OS® SQL Reference.
Example of the IFI call trace listing
Description of the IFI call trace fields
The following table summarizes the information that is available for each IFI statement.
Field | Description |
---|---|
FUNC= | The function of the IFI statement. |
IFI RETURN CODE= | The return code is returned from Db2 in the IFI communication area (IFCA), and is displayed in decimal notation. |
IFI REASON CODE= | The reason code is returned from Db2 in the IFI communication area (IFCA), and is displayed in hexadecimal notation. |
ELAPSED SEC= | The elapsed seconds of the IFI statement. This information is available only when ./O ELAPTIME=Y is specified. |