PreviousThe Grid Example Obtaining SupportNext

Chapter 4: The Order Example

The Order example illustrates the support for CORBA within Server Express.


Note: This example application is only available if you have obtained the ORB interface software from MERANT. See the chapter Obtaining Support for details.


4.1 Installation

To run this example:

  1. Change to the example program directory $COBDIR/demo/corba/order.

    This directory contains a simple client and server, written in COBOL, and a makefile. The makefile is there for you to run when you wish to compile both modules and then link them together into an executable.

  2. Copy the contents of the directory $COBDIR/demo/corba/order into a working directory of your own.

  3. To run the example, follow the detailed instructions below.

4.2 Source Files

The source files for the Order example are listed below:

$COBDIR/demo/corba/order/ACCOUNT.CPY
$COBDIR/demo/corba/order/CUSTOMER.CPY
$COBDIR/demo/corba/order/custordr.cbl
$COBDIR/demo/corba/order/DB.CPY
$COBDIR/demo/corba/order/dbac.cbl
$COBDIR/demo/corba/order/ORDER.CPY
$COBDIR/demo/corba/order/makefile

4.3 Prerequisites

For details of prerequisites, refer to the section Prerequisites in the Coborbgen chapter.

4.4 Running the Example for Orbix

  1. To wrap the example program using C++, enter:
        make orbix

    This runs the command line:

        coborbgen dbac -client custordr -v -make -debug -orbix

    which generates the following files:

    dbac.idl IDL for the interface to the component
    dbac-s.cbl wrapper to handle COBOL datatypes for server
    dbac-c.cbl wrapper to handle COBOL datatypes for client
    dbac_C.cc C++ for client to invoke remote C++ object
    dbac_S.cc C++ to create instance of C++ object
    dbac_i.h header file for Object instance
    dbac_i.cc C++ instance of object that wraps the COBOL
    dbac.mak makefile to build executable

  2. To compile the generated output into executables, run the generated makefile:
        make -f dbac.mak

    This command compiles all the generated code and then links it all together with the appropriate libraries.

  3. Once you have finished building your executables, start the Orbix deamon.

  4. Use the command putit within the generated makefile to register the application with Orbix:
        make -f dbac.mak putit
  5. Once defined, you need to run the client only and Orbix starts the server automatically. To start up the server on the localhost by default, enter:
        dbac-c

    The generated client can accept a hostname on the command line but, by default, uses the local host. (You can, of course, start your dbac-s server manually, if you so wish.)

  6. You can now use the client to create customers and list their details. The details are saved within a file that the server creates.

  7. To terminate the server use the Orbix command killit as follows:
       killit dbac

4.5 Running The Example for Visibroker

  1. To wrap the example program using C++, enter:
        make visi

    This runs the command line:

        coborbgen dbac -client custordr -v -make -debug -visi

    which generates the following files:

    dbac.idl IDL for the interface to the component
    dbac-s.cbl wrapper to handle COBOL datatypes for server
    dbac-c.cbl wrapper to handle COBOL datatypes for client
    dbacC.cc C++ for client to invoke remote C++ object
    dbacS.cc C++ to create instance of C++ object
    dbac_i.h header file for Object instance
    dbac_i.cc C++ instance of object that wraps the COBOL
    dbac.mak makefile to build executable

  2. To compile the generated output into executables, run the generated makefile:
        make -f dbac.mak

    This command compiles all the generated code and then links it all together with the appropriate libraries.

  3. Once you have finished building your executables, start the Visibroker Smart Agent, if it is not already running.

  4. Start the dbac-s server by typing:
        dbac-s &
  5. Start the dbac-c client by typing:
        dbac-c
  6. The generated client can accept a hostname on the command line but, by default, uses the local host.

    You can now use the client to create customers and list their details. The details are saved within a file that the server creates.


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

PreviousThe Grid Example Obtaining SupportNext