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).
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
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 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 but must be enclosed in single or double quotes.
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