Print SQL Information (PRTSQLINF)

The Print Structured Query Language Information (PRTSQLINF) command allows you to print information about the SQL statements in a program, SQL package, service program, or job. The information includes the SQL statements, the access plans used during the running of the statement, and a list of the command parameters which are defined either during the precompile of the source member for the object or when SQL statements are run.

Parameters

Keyword Description Choices Notes
OBJ Object Single values: *JOB
Other values: Qualified object name
Required, Positional 1
Qualifier 1: Object Name
Qualifier 2: Library Name, *LIBL, *CURLIB
OBJTYPE Object type *PGM, *SQLPKG, *SRVPGM Optional, Positional 2

Object (OBJ)

Specifies either the name of the object for which you want SQL information printed or *JOB indicating that the job's SQL information is to be printed. A named object can be a program, an SQL package, or a service program.

Single values

*JOB
The SQL information for the current job is to be printed. The output will only contain information for statements which have been dynamically prepared for the job. It will not contain information for SQL statements in programs, service programs, or SQL packages used by the job.

Qualifier 1: Object

name
Specify the name of the program or SQL package for which you want information printed.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the job is searched. If no library is specified as the current library for the job, the QGPL library is used.
name
Specify the name of the library to be searched.

Object type (OBJTYPE)

Specifies the object type of the object specified for the Object (OBJ) parameter.

*PGM
The object is a program.
*SQLPKG
The object is an SQL package.
*SRVPGM
The object is a service program.

Examples

Example 1: Printing SQL Information

PRTSQLINF   PAYROLL

This command will print information about the SQL statements contained in program PAYROLL.

Error messages

*ESCAPE Messages

SQL9011
Print of SQL information failed.