Input to the Db2 precompiler

The primary input for the precompiler consists of statements in the host programming language and embedded SQL statements.

You can use the SQL INCLUDE statement to get secondary input from the include library, SYSLIB. The SQL INCLUDE statement reads input from the specified member of SYSLIB until it reaches the end of the member.

Another preprocessor, such as the PL/I macro preprocessor, can generate source statements for the precompiler. Any preprocessor that runs before the precompiler must be able to pass on SQL statements. Similarly, other preprocessors can process the source code, after you precompile and before you compile or assemble.

Input to the Db2 precompiler has the following restrictions:
  • The size of a source program that Db2 can precompile is limited by the region size and the virtual memory available to the precompiler. These amounts vary with each system installation.
  • The forms of source statements that can pass through the precompiler are limited. For example, constants, comments, and other source syntax that are not accepted by the host compilers (such as a missing right brace in C) can interfere with precompiler source scanning and cause errors. To check for such unacceptable source statements, run the host compiler before the precompiler. You can ignore the compiler error messages for SQL statements or comment out the SQL statements. After the source statements are free of unacceptable compiler errors, you can then uncomment any SQL statements that you previously commented out and continue with the normal Db2 program preparation process for that host language.
  • You must write host language statements and SQL statements using the same margins, as specified in the precompiler option MARGINS.
  • The input data set, SYSIN, must have the attributes RECFM F or FB, LRECL 80.
  • SYSLIB must be a partitioned data set, with attributes RECFM F or FB, LRECL 80.
  • Input from the INCLUDE library cannot contain other precompiler INCLUDE statements.