Preparing and running a program with SQL statements
This topic describes some of the tasks for preparing and running an application program.
- Basic processes of the SQL precompiler
You must precompile and compile an application program containing embedded SQL statements before you can run it. - Non-ILE SQL precompiler commands
The IBM® DB2 Query Manager and SQL Development Kit for i licensed program includes non-ILE precompiler commands for the following host languages: CRTSQLCBL (for OPM COBOL), CRTSQLPLI (for PL/I PRPQ), and CRTSQLRPG (for RPG III, which is part of RPG/400®). - ILE SQL precompiler commands
In the IBM DB2 Query Manager and SQL Development Kit for i licensed program, these ILE precompiler commands exist: CRTSQLCI, CRTSQLCPPI, CRTSQLCBLI, and CRTSQLRPGI. - Setting compiler options using the precompiler commands
The COMPILEOPT string is available on the precompiler command and on the SET OPTION statement to allow additional parameters to be used on the compiler command. - Interpreting compile errors in applications that use SQL
Sometimes you will encounter compile errors. Use the following information to interpret these errors. - Binding an application that uses SQL
Before you can run your application program, a relationship between the program and any specified tables and views must be established. This process is called binding. The result of binding is an access plan. - Displaying SQL precompiler options
When the SQL application program is successfully compiled, the Display Module (DSPMOD), the Display Program (DSPPGM), or the Display Service Program (DSPSRVPGM) command can be used to determine some of the options that were specified on the SQL precompile. - Running a program with embedded SQL
Running a host language program with embedded SQL statements, after the precompile and compile have been successfully done, is the same as running any host program.
Parent topic: Embedded SQL programming
Related concepts: