IBM Books

Application Development Guide


Creating and Preparing the Source Files

You can create the source code in a standard ASCII file, called a source file, using a text editor. The source file must have the proper extension for the host language in which you write your code. See Table 27 to find out the required file extension for the host language you are using.
Note:Not all platforms support all host languages. See the Application Building Guide for specific information.

For this discussion, assume that you have already written the source code.

If you have written your application using a compiled host language, you must follow additional steps to build your application. Along with compiling and linking your program, you must precompile and bind it.

Simply stated, precompiling converts embedded SQL statements into DB2 run-time API calls that a host compiler can process, and creates a bind file. The bind file contains information on the SQL statements in the application program. The BIND command creates a package in the database. Optionally, the precompiler can perform the bind step at precompile time.

Binding is the process of creating a package from a bind file and storing it in a database. If your application accesses more than one database, you must create a package for each database.

Figure 1 shows the order of these steps, along with the various modules of a typical compiled DB2 application. You may wish to refer to it as you read through the following sections about what happens at each stage of program preparation.

Figure 1. Preparing Programs Written in Compiled Host Languages


Preparing Programs Written in Compiled Host Languages


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]