This tutorial explains how to build a local batch COBOL DB2® application.
The COBOL source code file LDB2SAMP and copybook EMPLOYEE,
available in the related topics, below, are written for use with this
scenario. Before starting this example, you need to create a local z/OS® project and add these samples
to your project. For more information about creating a local project,
see
Creating a local z/OS project.
You
also need DB2 installed on your
workstation.
Rational® Developer
for System z® does not support
local COBOL or PL/I builds on the Linux platform.
To build a local batch COBOL DB2 application:
- To modify build options for the project:
- Select the project and click Property Group
> Edit Associated Property Group.
- Select the COBOL tab and then click Local
Compiler Options.
- In the SYSLIB field, type the
path to the DB2 sqlca.cbl file
followed by any other paths that include copybooks that the program
uses, separated by semicolons. The default path is C:\Program
Files\IBM\SQLLIB\include\cobol_a. Even if the copybook
resides in the same project as the COBOL source, the project path
must be included in the SYSLIB. For example, C:\Program
Files\IBM\SQLLIB\include\cobol_a;C:\myProject\source.
- Click the Source contains EXEC SQL statements check
box.
- If a database connection is configured for the project,
click the Browse button, select the database
connection name from the list of Database Connections, and click OK.
- If a database connection is not configured for the project,
follow these steps:
- Click New. The Database Connection window
opens.
- On the Database Connection window, click New.
- On the Connection Profile window, select
the database manager to be used for development from the Connection
Profile Types list and click Next.
For example, DB2 for Linux, UNIX, and Windows.
- From the Drivers drop-down list, select
the JDBC driver to use. For example, IBM Data Server Driver
for JDBC and SQLJ.
- In the Database field, type the name of
the database the program uses. The LDB2SAMP.cbl program uses the SAMPLE
database that is shipped with DB2.
- In the Host field, type localhost.
- If the Port Number or the class location
is different from the defaults change them to suit your installation.
- In the User name and Password fields,
type a user ID and password.
- Click the Test Connection button to ensure
the connection parameters are correct and then click Finish.
- On the Local Link Options page
set Link Options to /de db2api.lib and
then close and save the property group.
- In the z/OS Projects
view, select LDB2SAMP.cbl and then select Nominate
as entry point from the pop-up menu.
- Right-click the project name and select Rebuild
Project. The executable that is generated
to the BuildOutput folder can now be executed
or debugged as a compiled application.