PreviousDB2 Applications (Host Compatibility Option) IMS ApplicationsNext"

Chapter 21: Joins

You can use Host Compatibility Option to run applications containing inner and outer joins.

You need to have read the chapter Start Here for the Tutorials and worked through the first session, Using Mainframe Express, and the session DB2 Applications (Host Compatibility Option) before you do this session.

You need to have installed Host Compatibility Option to do this session. We assume you are familiar with DB2 on a mainframe.

You must also have IBM's DB2 Universal Database V5 system installed. Inner and outer joins are not supported by versions before V5.

21.1 Overview

This short session shows you an application that includes inner and outer joins working on your PC, using Host Compatibility Option.

This session uses the SAMPLE database that comes with IBM's DB2 Universal Database.

Joining is the process of combining data from two or more tables. The database manager forms all combinations of rows from the specified tables, and then selects those that conform to the join condition that you specify. For a fuller description of joins, see the SQL Getting Started book that comes with IBM's DB2 Universal Database V5.

21.2 Preparation

  1. Issue a DB2START command if you have not already done so. In the DB2 Command Window, enter:


  2. The SAMPLE database is not automatically created when you install DB2. If you have not yet created it, do so now. In the DB2 Command Window, enter:


    If the database does in fact exist, this command results in a number of error messages. You can ignore these messages.

  3. You can now close the DB2 Command Window.

    Creating a project for a DB2 application that uses joins is just the same as for any other DB2 application. Since this application does not use CICS or IMS, it is just like in the chapter DB2 Applications (Host Compatibility Option).

    To save you creating the project used in this session, we supply the project hcjndemo.mvp.

  4. If you have closed Mainframe Express, open it as before. If any project window or other windows are open, close them.

  5. Open the project hcjndemo.mvp in any of the ways described in the chapter Start Here for the Tutorials.

    The full path is \mfuser\projects\gsdemo\hcjndemo\hcjndemo.mvp. If you use Open on the File menu, you need the Files of Type field on the Open dialog box set to Project Files (*.mvp) to see this file.

21.3 Sample Session

In this session you:

21.3.1 Building the Project

To build the project:

  1. Click Build on the Build menu.

    The build finishes with "Build finished with no errors".

21.3.2 Running the Application

To run the application:

  1. Click join.tso in the right-hand pane of the project window to select it.

  2. Click Run on the Debug menu.

  3. Click the TSO tab. The name of the CLIST file to run has defaulted to the one you selected.

  4. Click OK.

    The application runs. The Application Output window appears and displays the screen output from the application. The application displays the output from the JOIN statements in the program.

    If you get a "***" line indicating more input is required, just press Enter to let the application complete.

21.4 Before Continuing

Hide the Application Output window.

You can close DB2 if you wish.

Close the project. If you want to take a break before going on to the next session, you can close Mainframe Express.

Return to the Tutorials Map in the chapter Start Here for the Tutorials and choose which session to go on to next, depending on your interests.

Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousDB2 Applications (Host Compatibility Option) IMS ApplicationsNext"