Precompiler commands

 

The DB2® UDB Query Manager and SQL Development Kit licensed program has seven precompiler commands, one for each of the host languages.


Host language Command
PL/I PRPQ CRTSQLPLI
ILE C language CRTSQLCI
COBOL/400® language CRTSQLCBL
ILE COBOL language CRTSQLCBLI
FORTRAN/400 language CRTSQLFTN
RPG III (part of RPG/400® language) CRTSQLRPG
ILE RPG language CRTSQLRPGI

A separate command for each language exists so each language can have parameters that apply only to that language. For example, the options *APOST and *QUOTE are unique to COBOL. They are not included in the commands for the other languages. The precompiler is controlled by parameters specified when it is called by one of the SQL precompiler commands. The parameters specify how the input is processed and how the output is presented.

You can precompile a program without specifying anything more than the name of the member containing the program source statements as the PGM parameter (for non-ILE precompiles) or the OBJ parameter (for ILE precompiles) of the CRTSQLxxx command. SQL assigns default values for all precompiler parameters (which might, however, be overridden by any that you explicitly specify). The following list briefly describes parameters common to all the CRTSQLxxx commands that are used to support distributed relational database.

RDB

Specifies the name of the relational database where the SQL package option is to be created. If *NONE is specified, then the program or module is not a distributed object and the Create Structured Query Language Package (CRTSQLPKG) command cannot be used. The relational database name can be the name of the local database.

RDBCNNMTH

Specifies the type of semantics to be used for CONNECT statements: remote unit of work (RUW) or distributed unit of work (DUW) semantics.

SQLPKG

Specifies the name and library of the SQL package.

USER

Specifies the user name sent to the remote system when starting the conversation. This parameter is used only if a conversation is started as part of the precompile process.

PASSWORD

Specifies the password to be used on the remote system when starting the conversation. This parameter is used only if a conversation is started as part of the precompile process.

REPLACE

Specifies if any objects created as part of the precompile process should be able to replace an existing object.

The following example creates a COBOL program named INVENT and stores it in a library named SPIFFY. The SQL naming convention is selected, and every row selected from a specified table is locked until the end of the unit of recovery. An SQL package with the same name as the program is created on the remote relational database named KC000.

CRTSQLCBL PGM(SPIFFY/INVENT) OPTION(*SRC *XREF *SQL)
          COMMIT(*ALL) RDB(KC000)
 

 

Parent topic:

Precompiling programs with SQL statements

 

Related reference


Create Structured Query Language Package (CRTSQLPKG) command