Rational Developer for System z

Building a local batch COBOL application using a remote DB2 connection

This tutorial explains how to build a local batch COBOL application using a remote DB2® connection.

Before you begin

Before you begin, ensure that the remote database connection is cataloged with the DB2 Manager. The information for setting up this connection can be found at the following web address: http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp. In the table of contents, open Configuring -> Database systems -> Client-to-server communications-> Configuring client-to-server connections using the Configuration Assistant (CA).

This scenario assumes you have created a local z/OS® project. For more information about creating a local project, see Creating a local z/OS project.

Linux icon Rational® Developer for System z® does not support local COBOL or PL/I builds on the Linux platform.

Procedure

To build a local batch COBOL application using a remote DB2 connection:

  1. To modify build options for the project:
    1. Select the project and click Property Group > Edit Associated Property Group.
    2. Select the COBOL tab and then click Local Compiler Options.
    3. 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.
    4. Click the Source contains EXEC SQL statements check box.
    5. 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.
    6. If a database connection is not configured for the project, follow these steps:
      1. Click New. The Database Connection window opens.
      2. On the Database Connection window, click New.
      3. 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 z/OS.
      4. From the Drivers drop-down list, select the JDBC driver to use. For example, IBM Data Server Driver for JDBC and SQLJ.
      5. In the Location field, type the name of the database your program uses.
      6. In the Host field, type the host name of the z/OS system on which the database is located.
      7. If the Port Number or the class location is different from the defaults change them to suit your installation.
      8. In the User name and Password fields, type a user ID and password.
      9. Click the Test Connection button to ensure the connection parameters are correct and then click Finish.
    7. On the Local Link Options page set Link Options to /de db2api.lib and then close and save the property group.
  2. In the z/OS Projects or Enterprise Projects view, select your COBOL program and then select Nominate as entry point from the pop-up menu.
  3. 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.

Feedback