PreviousCompleting and Running Your Windows GUI Application Windows TipsNext

Chapter 14: Deploying an Application on UNIX

You use the UNIX Option to deploy applications developed on NetExpress to UNIX systems.


You need to have read the chapter Start Here for the Tutorials and worked through the first session, Using NetExpress, before you do this session.


14.1 Overview

You use the UNIX Option to deploy an application that you have created on NetExpress to a UNIX system that has Micro Focus COBOL for UNIX V3.1 or later installed.

In this sample session we start with an existing COBOL application. When you deploy the application on the UNIX system using the UNIX Option, the application is rebuilt on UNIX and you run it there. This sample application consists of just one COBOL program, which simply creates a one-record output file.

To see how to deploy a Web application on UNIX, after finishing this book you should see the online book Internet Applications.

You cannot deploy a Windows GUI application, such as is created using Dialog System, on UNIX. However, the UNIX Option includes a character version of Dialog System for creating character user interfaces; this is described in the Dialog System Character Mode User Guide.

14.2 Preparation

Before you can run this session you must have the Server Control Program (SCP) installed on your UNIX system. It is needed for the Publish function of UNIX Option to work. SCP is supplied on the NetExpress CD. For instructions on installing it, see the appendix Installing SCP and Samba in the UNIX Option User Guide.

You must have a connection to your UNIX system. Provide a login on the UNIX system, and configure the .rhosts file to enable transparent login without requiring a password. See your UNIX documentation for details on how to do this.

If you have closed NetExpress, open it as before. If any project window or text windows are open, close them.

14.3 Sample Session

In this sample session you:

  1. Create a project
  2. Build the application and check it's portable
  3. Use your PC as a UNIX terminal (optional)
  4. Set up the options for publishing
  5. Publish the application on the UNIX system
  6. Run the application

14.3.1 Creating a Project

To create a project for your application:

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

  2. Click Project from an existing application on the New Project dialog box.

  3. Enter Unixo as the name of the project , and d:\NetExpress\Base\Demo\Unixo as the folder to contain the project, then click Create.

  4. If this tutorial has been run previously, you will be asked whether to overwrite the existing project. Click Yes.

  5. Click Add Files.

  6. Select Unixo.cbl and click Open.

  7. Click Next.

  8. Click Next on the next dialog box.

  9. Click Finish to create the project.

    The project window for the project appears, and the project is scanned for dependencies. It currently contains just the COBOL program you are going to use to build your application.

14.3.2 Building the Application

When building this application, we need to set an option so we will be warned if it contains any features not portable to UNIX.

  1. Click Properties on the Project menu.

  2. In the Project Directives field, before the semicolon at the end, type WARNINGS"2" (leave a space after ENSUITE"3"). Then click OK.

  3. Click Rebuild on the Project menu to compile the program.

    A message warning that the intermediate code is not portable is displayed in the Output window. You may need to make the Output window bigger to see the message. You need to edit the file to change the non-portable syntax:

  4. Double-click the error message in the Output window.

    An edit window opens and the line containing the problem is marked by a red cross in the margin.

  5. Edit the line so that OUT FILE is replaced by OUTFILE.

    This line was flagged by the compiler because the filename contained a space. A filename that contains spaces can be used on Windows, but not on UNIX.

  6. Click Rebuild on the Project menu.

    Your program should now compile without warnings, and you can deploy the application to the UNIX system.

  7. Close the text window displaying Unixo.cbl.

14.3.3 Using Your PC as a UNIX Terminal

NetExpress includes terminal emulation software, PowerTerm, so you can use your PC as a UNIX terminal. While running this tutorial, you may find it convenient to use PowerTerm to give you a separate window open on your PC as a terminal onto your UNIX host system. If you don't intend to do this, either because you have other terminal emulation software or because you are using a separate UNIX terminal, you can skip this section.

  1. Click Terminal on the UNIX menu.

  2. Click Connect on PowerTerm's Communication menu.

  3. On the Connect dialog box, ensure the Session Type is set to a type that is compatible with the network you're using. Enter the name of your UNIX host machine in the Host Name field. Then click Connect.

  4. Log in to your UNIX system as usual.

14.3.4 Setting Up the Options for Publishing

Deployment is known as publishing in the UNIX Option. It consists of copying the files to the correct directories on the UNIX system and building the application there. Accessible from the NetExpress menus is a tool, Publisher, that handles this process.

First you provide Publisher with details of the publish operation required:

  1. Click Setup on the Unix menu.

  2. Click OK on the Welcome screen. You should have already made the preparations it tells you about, when you were doing the section Preparation above.

    This displays the form shown in Figure 14-1.


    Figure 14-1: The Setup Dialog Box

  3. Click the Server tab. This displays the form shown in Figure 14-2:


    Figure 14-2: The Server Dialog Box

    The list box displays any servers that have currently been defined. If you select one of these, then any changes you make using the buttons in this tab are made to the selected server. The entry New Server enables you to define a new server. If there are no servers currently configured, New Server is selected by default and all of the buttons on the dialog except Settings are deactivated (see figure above).

  4. Click Settings. A dialog is displayed that enables you to specify a new server name:


    Figure 14-3: Specifying a Server

  5. Enter a valid Server name, and press OK. The following dialog box is then displayed:


    Figure 14-4: Server Settings

  6. In the User ID field, enter the user id you use to log onto your UNIX system.

  7. In the UNIX COBOL Directory field, enter the name of the COBOL system directory on your UNIX system. You can find out this directory by entering echo $COBDIR on your UNIX system. If you leave this field blank it defaults to /usr/lib/cobol.

  8. Decide the directory on your UNIX system to which you want to publish your application, and enter its name in the Build Directory field.
  9. Click OK.

  10. Click OK again.

14.3.5 Publishing the Application

To publish the application:

  1. Ensure the directory you named in the Build Directory field in the Setup dialog box exists on your UNIX system.

  2. Click Publish on NetExpress's UNIX menu.

    This builds the project on the PC, creates a file called Makefile to do the same thing on UNIX, copies the project files to the UNIX system and runs Makefile there.

    If you have any problem, check your setup - use Setup on the UNIX menu again - to ensure you specified the server name, UNIX login name, and directory names correctly, and try again.

    If this doesn't solve the problem, see the chapter Tips and Troubleshooting in the UNIX Option User Guide

  3. On your UNIX machine, use any listing utility to look at the log file Make.log.

    If the log file shows any errors, or if any of the files listed in the next section Files Created are not present in your UNIX build directory, check your setup and try again.

    Publish publishes only files that have changed since the previous time you published the project. Publish All publishes all the files unconditionally. If you run this tutorial a second time, do not first delete the files from your build directory on UNIX. Publish will not know they have gone, and will not replace them. Alternatively, if you do delete the files from your UNIX directory, use Publish All.

14.3.6 Files Created

UNIX Option has now created the following file for you in your project directory on the PC and copied it into your build directory on UNIX (it has not added it to the project, as it is not used on the PC):

It has also copied the following file from your project directory on the PC into your build directory on UNIX:

The build directory also contains the following files created by the build process on UNIX:

Several files created for use during the build process are also in the build directory on UNIX.

Note that filenames on UNIX are case sensitive.

14.3.7 Running the Application

To run the application

  1. On your UNIX system, run the application in whatever way you normally run your UNIX COBOL applications; for example:
    cobrun Unixo.int
  2. List your build directory (for, example, use an ls command), and check that file OUTPUT exists. Use any listing utility to check that it has just one record, containing the words "Example output".

    All that Unixo.cbl does is create this file, so if this file exists the application has been built and run correctly.

14.4 Before Continuing

Close the project.

If you're using PowerTerm, logoff from UNIX in your usual way and click Exit on PowerTerm's File menu.

If you're planning to go straight on to another session, you can keep NetExpress open.

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 © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
PreviousCompleting and Running Your Windows GUI Application Windows TipsNext