Preparing distributed relational database programs
When you write a program using SQL, you can embed the SQL statements in a host program.
The host program is the program that contains the SQL statements, written in one of the host languages: PL/I PRPQ, ILE C, COBOL/400®, ILE COBOL, FORTRAN/400, RPG/400®, or ILE RPG programming language. In a host program, you use variables referred to as host variables. These are variables used in SQL statements that are identifiable to the host program. In RPG, this is called a field name; in FORTRAN, PL/I, and C, this is known as a variable; in COBOL, this is called a data item.
You can code your distributed DB2 Universal Database™ for iSeries™ programs in a way similar to the coding for a DB2® UDB for iSeries program that is not distributed. You use the host language to embed the SQL statements with the host variables. Also, like a DB2 UDB for iSeries program that is not distributed, a distributed DB2 UDB for iSeries program is prepared using the certain processes.
However, a distributed DB2 UDB for iSeries program also requires that an SQL package is created on the application server (AS) to access data.
This topic collection discusses these steps in the process, outlining the differences for a distributed DB2 UDB for iSeries program.
- 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.
- Compiling an application program
The DB2 Universal Database for iSeries precompiler automatically calls the host language compiler after successfully precompiling the program, unless the *NOGEN precompiler option is specified.
- Binding an application
Before you can run your application program, a relationship between the program and any referred-to tables and views must be established. This process is called binding.
- Testing and debugging
Testing and debugging distributed SQL programs is similar to testing and debugging local SQL programs, but certain aspects of the process are different.
Parent topic:
Application development