DB2 Version 10.1 for Linux, UNIX, and Windows

Building IBM COBOL applications on AIX®

You can use the provided build scripts for compiling and linking IBM® COBOL embedded SQL and DB2® administrative API programs. The scripts are in the sqllib/samples/cobol directory. The directories also contain sample programs that you can build with these files. You can find commands to build a DB2 application program in the bldapp build script.

About this task

The first parameter, $1, specifies the name of your source file. This is the only required parameter for programs that do not contain embedded SQL. Building embedded SQL programs requires a connection to the database so three optional parameters are also provided: the second parameter, $2, specifies the name of the database to which you want to connect; the third parameter, $3, specifies the user ID for the database, and $4 specifies the password.

For an embedded SQL program, bldapp passes the parameters to the precompile and bind script, embprep. If no database name is supplied, the default sample database is used. The user ID and password parameters are only needed if the instance where the program is built is different from the instance where the database is located.

To build the non-embedded SQL sample program client from the source file client.cbl, enter:
   bldapp client
The result is an executable file client. You can run the executable file against the sample database by entering:
   client

Procedure