When you use the PL/I SQL Preprocessor, the PL/I compiler handles your source program containing embedded SQL statements at compile time, without your having to use a separate precompile step. Although the use of a separate precompile step continues to be supported, use of the PL/I SQL Preprocessor is recommended. Interactive debugging with Debug Tool is enhanced when you use the PL/I SQL Preprocessor because you see only the SQL statements while debugging (and not the generated PL/I source). However, you must have DB2 for z/OS Version 7 Release 1 or later to use the SQL preprocessor.
In addition, using the PL/I SQL Preprocessor lifts some of the DB2 precompiler's restrictions on SQL programs. When you process SQL statements with the PL/I SQL Preprocessor, you can now
Compiling with the PL/I SQL Preprocessor option generates a DB2 database request module (DBRM) along with the usual PL/I compiler outputs such as object module and listing. As input to the DB2 bind process, the DBRM data set contains information about the SQL statements and host variables in the program. Not all of the information in the DBRM is important in terms of the bind or runtime processing, however. For example, if the HOST value in the DBRM specifies a language other than PL/I, there is no reason to be concerned. All this means is that the other language is selected as the installation default for the HOST value, which does not effect the bind or runtime processing of your program.
The PL/I compiler listing includes the error diagnostics (such as syntax errors in the SQL statements) that the PL/I SQL Preprocessor generates.
To use the PL/I SQL Preprocessor, you need to do the following things:
PP(SQL('options'))
This compiler option indicates that you want the compiler to invoke the integrated PL/I SQL preprocessor. Specify a list of SQL processing options in the parenthesis after the SQL keyword. The options can be separated by a comma or by a space and the list of options must be enclosed in quotes (single or double, as long as they match).
For example, PP(SQL('DATE(USA),TIME(USA)') tells the preprocessor to use the USA format for both DATE and TIME data types.
In addition, for LOB support you must specify the option
LIMITS( FIXEDBIN(31,63) FIXEDDEC(31) )
The PL/I SQL preprocessor calls DB2 modules to do the SQL statement processing. You therefore need to include the name of the DB2 load library data set in the STEPLIB concatenation for the compile step.
If your program contains SQL INCLUDE member-name statements that specify secondary input to the source program, you need to include the name of the data set that contains member-name in the SYSLIB concatenation for the compile step.
The compilation of the PL/I program generates a DB2 database request module (DBRM) and the DBRMLIB DD statement is required to designate the data set to which the DBRM is written.
//STEPLIB DD DSN=DSN710.SDSNLOAD,DISP=SHR //SYSLIB DD DSN=PAYROLL.MONTHLY.INCLUDE,DISP=SHR //DBRMLIB DD DSN=PAYROLL.MONTHLY.DBRMLIB.DATA(MASTER),DISP=SHR