Precompiling programs with SQL statements

You must precompile and compile an application program containing embedded SQL statements before you can run it. Precompiling such programs is done by an SQL precompiler.

The SQL precompiler scans each statement of the application program source and does the following things:

  • Looks for SQL statements and for the definition of host variable names
  • Verifies that each SQL statement is valid and free of syntax errors
  • Validates the SQL statements using the description in the database
  • Prepares each SQL statement for compilation in the host language
  • Produces information about each precompiled SQL statement

Application programming statements and embedded SQL statements are the primary input to the SQL precompiler. The SQL precompiler assumes that the host language statements are syntactically correct. If the host language statements are not syntactically correct, the precompiler might not correctly identify SQL statements and host variable declarations.

The SQL precompile process produces a listing and a temporary source file member. It can also produce the SQL package depending on what is specified for the OPTION and RDB parameters of the precompiler command.