Command reference / db

CRTSQLPKG

Create SQL Package

The Create Structured Query Language Package (CRTSQLPKG) command allows you to create (or re-create) an SQL package on a relational database from an existing distributed SQL program. A distributed SQL program is a program created by specifying the Relational database (RDB) parameter on a CRTSQLxxx (where xxx = CBL, CBLI, CI, CPPI, PLI, RPG or RPGI) command. More information is in the DB2 for i SQL programming topic collection in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.

Allowed environments: *ALL. Positional parameters: 2.

Parameters

PGM Program

Specifies the name of the program for which the SQL package is being created. The program must be a distributed SQL program that was created using one of the CRTSQLxxx (where xxx = CBL, CBLI, CI, CPPI, PLI, RPG or RPGI) commands.

Type
*QUAL
Required
Yes
Case
Uppercase
name (Program)
Specify the name of the program for which the SQL package is to be created.
*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 used to locate the program. If no current library is specified as the current library for the job, QGPL is used.
name (Library)
Specify the name of the library where the program is located.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Program Program

Type
*NAME
Required
No
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

RDB Relational database

Specifies the relational database where the SQL package is being created.

Type
*NAME
Required
No
Default
*PGM
Length
18
Case
Uppercase

Suggested / special values: *PGM

*PGM
The relational database name specified for the Relational database (RDB) parameter of the CRTSQLxxx (where xxx = CBL, CBLI, CI, CPPI, PLI, RPG or RPGI) command that originally created the program is used.
name
Specify the name of the relational database where the SQL package is to be created. Use the Work with Relational Database Directory Entry (WRKRDBDIRE) command to show the relational database names that are valid for this parameter.

USER RDB user

Specifies the user name sent to the remote system when starting the conversation.

Type
*NAME
Required
No
Default
*CURRENT
Length
10
Case
Uppercase

Suggested / special values: *CURRENT

*CURRENT
The user name associated with the current job is used.
name
Specify the user name being used for the application requester job.

PASSWORD RDB user password

Specifies the password to be used on the remote system.

Type
*CHAR
Required
No
Default
*NONE
Length
128
Case
Mixed case

Suggested / special values: *NONE

*NONE
No password is sent. The user name specified for the RDB user (USER) parameter is not valid if this value is specified.
character-value
Specify the password of the user name specified for the USER parameter. A password value of a blank is treated the same as specifying *NONE.

DFTRDBCOL Default collection

Specifies the schema name to be used for unqualified names of tables, views, indexes, SQL packages, aliases, constraints, external programs, node groups, and triggers. This parameter applies only to static SQL statements in the package.

Type
*NAME
Required
No
Default
*PGM
Length
10
Case
Uppercase

Suggested / special values: *PGM, *NONE

*PGM
The schema name specified for the Default collection (DFTRDBCOL) parameter of the CRTSQLxxx (where xxx = CBL, CBLI, CI, CPPI, PLI, RPG or RPGI) command used to create the program for which an SQL package is being created is used.
*NONE
The Naming convention option specified for the Precompiler options (OPTION) parameter of the CRTSQLxxx (where xxx = CBL, CBLI, CI, CPPI, PLI, RPG or RPGI) command used to precompile the program is used to determine the schema name.
name
Specify the schema name that is used for unqualified tables, views, indexes, SQL packages, aliases, constraints, external programs, node groups, and triggers.

OBJTYPE Object type

Specifies the type of program for which an SQL package is created.

Type
*CHAR
Required
No
Default
*PGM
Length
7
Case
Uppercase

Allowed values: *PGM, *SRVPGM

*PGM
Create an SQL package from the program specified for the Program (PGM) parameter.
*SRVPGM
Create an SQL package from the service program specified for the PGM parameter.

MODULE Module list

Specifies a list of modules in a bound program.

Type
*NAME
Required
No
Default
*ALL
Length
10
List limit
256
Case
Uppercase

Suggested / special values: *ALL

*ALL
An SQL package is created for all modules in the program. An error message is sent if none of the modules in the program contain SQL statements or none of the modules is a distributed program.
name
Specify the modules in the program for which an SQL package is to be created. If more than 256 modules exist that need to be packaged, multiple CRTSQLPKG commands must be used. A maximum of 1024 modules can be in a program that has at least one module containing an SQL statement. Duplicate module names in the same program are allowed. This command looks at each module in the program and if *ALL or the module name is specified for the MODULE parameter, processing continues to determine whether an SQL package should be created. If the module is created using SQL and the Relational database (RDB) parameter is specified on the precompile command, an SQL package is created for the module. The SQL package is associated with the module of the bound program.

TEXT Text 'description'

Specifies text that briefly describes the SQL package and its function.

Type
*CHAR
Required
No
Default
*PGMTXT
Length
50
Case
Mixed case

Suggested / special values: *PGMTXT, *BLANK

*PGMTXT
The text from the program for which the SQL package is being created is used.
*BLANK
No text is specified.
'description'
Specify no more than 50 characters of text, enclosed in apostrophes.

GENLVL Severity level

Specifies the maximum severity level allowed for errors detected during SQL package creation. If errors occur at a level that exceeds the level you specify, the SQL package is not created.

Type
*UINT2
Required
No
Default
10
Range
0 to 40
Case
Uppercase
10
The maximum severity level is 10.
0-40
Specify the maximum severity level.

REPLACE Replace

Specifies whether an existing SQL package of the same name in the specified library is replaced by the new SQL package.

Type
*CHAR
Required
No
Default
*YES
Length
4
Case
Uppercase

Allowed values: *YES, *NO

*YES
An existing SQL package of the same name is replaced by the new SQL package.
*NO
An existing SQL package of the same name is not replaced; a new SQL package is not created if the package already exists.

OPTION Source listing options

Specifies the option for the listing generated by the command.

Type
*CHAR
Required
No
Default
*LIST
Length
8
Case
Uppercase

Allowed values: *LIST, *ERRLIST

*LIST
A complete listing with the contents of the source and all errors is generated. If no errors are detected during the creation of the SQL package, no listing is produced.
*ERRLIST
A complete listing is generated only if errors greater than the GENLVL parameter are encountered during processing.

PRTFILE Print file

Specifies the printer device file to which the create SQL package error listing is directed. If no errors are detected during the creation of the SQL package, no listing is produced.

Type
*QUAL
Required
No
Case
Uppercase
QSYSPRT
The create SQL package error listing is directed to the IBM-supplied printer file, QSYSPRT.
name (Print file)
Specify the name of the printer device file to which the create SQL package error listing is directed.
*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 used to locate the printer file. If no library is specified as the current library for the job, QGPL is used.
name (Library)
Specify the name of the library where the printer file is located.
Qualified parts (object, then library; write LIBRARY/OBJECT)

Print file Print file

Type
*NAME
Required
No
Default
QSYSPRT
Length
10
Case
Uppercase

Library Library

Type
*NAME
Required
No
Default
*LIBL
Length
10
Case
Uppercase

Suggested / special values: *LIBL, *CURLIB

Examples

CRTSQLPKG PGM(PAYROLL) RDB(SYSTEMA) TEXT('Payroll Program')

This command creates an SQL package from the distributed SQL program PAYROLL on relational database SYSTEMA.

IBM command documentation

Generated from os/cl/catalog/CRTSQLPKG.json and os/cl/help/CRTSQLPKG.json.