Chapter 39: IMS and DB2 (Host Compatibility Option)

In this session you use IMS Option and Host Compatibility Option together.


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

You need to have installed the IMS and Host Compatibility Options to do this session.

We assume you are familiar with IMS and DB2 on a mainframe.

You must also have IBM's DB2 Universal Database system installed. If you have DB2 V6 or later, you also need to install the IBM DB2 Software Development Kit (SDK). From V7 the SDK is called the Application Development Client.


39.1 Overview

This session shows you how to get an application that includes IMS and DB2 working on your PC, using IMS Option and Host Compatibility Option.

This session uses the same demo application as the chapter DB2 Applications (Host Compatibility Option). It uses the DB2DEMO database that you created in that session.

39.2 Preparation

If you installed both SQL Option and Host Compatibility Option, ensure Host Compatibility Option is active, as described in the section Preparation in the chapter DB2 Applications (Host Compatibility Option).

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

    db2start

  2. You can now close the DB2 Command Window.

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

39.3 Sample Session

In this session you:

39.3.1 Creating a Project

To create the project:

  1. Click New on the File menu, then select Project on the New dialog box and click OK.

  2. Enter hcimdemo as the name of the project and change the name of the Project Folder to d:\mfuser\projects\gsdemo\hcimdemo, then click Next.

  3. Accept the default, Using this wizard, and click Next.

  4. Leave the default folder for the catalog unchanged and click Next.

    You now get a page asking which of the installed options this project uses.

  5. Ensure that only the IMS and SQL check boxes have check marks, and click Next.

    Because you have said this project uses SQL, and you installed Host Compatibility Option (rather than SQL Option), you now get a dialog box asking the name of the DB2 database.

  6. Enter DB2DEMO and click Next.

  7. Click Finish.

39.3.2 Adding Files to the Project

To add your files to the project:

  1. Click Add Files on the Project menu.

  2. In the Add Files to Project dialog box, open the folder \mfuser\projects\gsdemo\hcimdemo\source. Ensure the Files of Type field is set to Source Files.

  3. Click Add All, then click Yes on the confirmation message.

    The files are added to the project.

  4. Click Done.

39.3.3 Modifying the Build Settings

To be compatible with IBM DB2 V6 and later, the Host Compatibility Option in this version of Mainframe Express flags as an error any host variable reference that does not have a colon. References in this demo do not have colons. This was acceptable to earlier versions of Host Compatibility Option designed to be compatible with IBM DB2 V5 and earlier.

You can ensure the demo compiles cleanly by setting a directive:

  1. Click hcodb2t.cbl in the right-hand pane, then click Build settings for hcodb2t.cbl on the Project menu.

  2. On the COBOL tab, type db2(hostvar) in the Additional directives field.

    This makes Host Compatibility Option accept host variables without colons, as earlier versions did.

  3. Click OK.

39.3.4 Building the Project

To build the project:

  1. Click Build on the Build menu.

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

39.3.5 Defining an IMS Transaction

To define IMS transactions for the project's programs:

  1. Click the IMS tab at the bottom of the project view.

  2. Click Transactions on the left-hand pane.

    The right-hand pane now lists all the transactions in the application. Initially, there are none.

  3. Right-click on the right-hand pane and click Add New Entry on the popup menu.

    The Transaction Codes dialog box appears.

  4. Enter the following (leave the remaining fields unchanged), and click OK.
    Program Type MPP
    Trancode Name HCODEMO
    PSB Name HCODB2T
    Program Name HCODB2T
    Process Limit Count 99
    Maximum seg no. 99

    An entry for transaction HCODEMO appears in the list in the right-hand pane.

39.3.6 Running the Application

To run the application:

  1. Click Run on the Debug menu.

  2. Select the IMS tab, and enter HCODEMO in the Command or transaction code field, then click OK.

    The Application Output window appears. The application displays its output there.

    In the following, the Application Output window must be selected, so that keystrokes are directed to it and not to some other window. It should be automatically selected when it appears, but if in doubt click in it with your mouse.

  3. Press Enter to see the rest of the output.

  4. Press F3.

    This exits from the transaction, and the Application Output window shows a screen with a cursor and a message saying HCODEMO has ended.

  5. Type /RCL and press Enter.

    This exits from IMS. The Application Output window is cleared.

39.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.


Comments on the books? Click Send Us Comments.


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