Preparing an application to run on DB2 for z/OS

To prepare and run applications that contain embedded static SQL statements or dynamic SQL statements, you must precompile, compile, link-edit, and bind them.

About this task

You can perform these steps by using one of the following methods:

Productivity hint: To avoid rework, first test your SQL statements using SPUFI. Then compile your program without SQL statements, and resolve all compiler errors. Finally, proceed with the preparation and the DB2® precompiler or with the host compiler that supports that DB2 coprocessor.
The following types of applications require different methods of program preparation:
  • Applications that contain ODBC calls
  • Applications in interpreted languages, such as REXX
  • Java applications, which can contain JDBC calls or embedded SQL statements

For information about running REXX programs, which you do not prepare for execution, see Running a DB2 REXX application.

Steps in program preparation

The following topics provide details on preparing and running a DB2 application:

Binding a package is not necessary in all cases. These instructions assume that you bind some of your DBRMs into packages and include a package list in your plan.

For more information about when to bind a package, see DB2 program preparation overview.

Preparing applications by using JCL procedures

A number of methods are available for preparing an application to run. You can:
  • Use DB2 interactive (DB2I) panels, which lead you step by step through the preparation process.
  • Submit a background job using JCL (which the program preparation panels can create for you).
  • Start the DSNH CLIST in TSO foreground or background.
  • Use TSO prompters and the DSN command processor.
  • Use JCL procedures added to your SYS1.PROCLIB (or equivalent) at DB2 installation time.
  • For C and C++ only, you can invoke the coprocessor from UNIX System Services and, if the DBRM is generated in a HFS file, you can use the command line processor to bind the resulting DBRM. Optionally, you can also copy the DBRM into a partitioned data set member by using the oput and oget commands and then bind it by using conventional JCL.

This topic describes how to use JCL procedures to prepare a program.

For information about using the DB2I panels, see Preparing an application to run on DB2 for z/OS.

Preparing applications by the DB2 Program

If you develop programs using TSO and ISPF, you can prepare them to run by using the DB2 Program Preparation panels. These panels guide you step by step through the process of preparing your application to run. Other ways of preparing a program to run are available, but using DB2 Interactive (DB2I) is the easiest because it leads you automatically from task to task.

Important: If your C++ program satisfies both of the following conditions, you must use a JCL procedure to prepare it:
  • The program consists of more than one data set or member.
  • More than one data set or member contains SQL statements.
To prepare an application by using the DB2 Program Preparation panels:
  1. If you want to display or suppress message IDs during program preparation, specify one of the following commands on the ISPF command line:
    TSO PROFILE MSGID
    Message IDs are displayed
    TSO PROFILE NOMSGID
    Message IDs are supressed
  2. Open the DB2I Primary Option Menu.
  3. Select the option that corresponds to the Program Preparation panel.
  4. Complete the Program Preparation panel and any subsequent panels. After you complete each panel, DB2I automatically displays the next appropriate panel.

Preparation guidelines for DL/I batch programs

Use the following guidelines when you prepare a program to access DB2 and DL/I in a batch program: