PreviousCreating a Windows GUI Application Deploying an Application on UNIXNext

Chapter 13: Completing and Running Your Windows GUI Application

In the previous session you used Windows GUI Application Wizard and Dialog System to design a screenset and generate a COBOL program. You now edit the COBOL program generated and add your business logic. You then run the completed application, using the IDE.


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


13.1 Overview

Windows GUI Application Wizard generates a COBOL source program in a .cbl file, containing code to input and output the screenset. You then edit this .cbl file to add your business logic to process the data from the screenset and create data to be output. Of course, you can simply add CALL statements to call other programs, and so keep your business logic completely separate from this screenset-handling program.

13.1.1 Structure of an Associated Program

An associated program typically has a main loop which does the following:

  1. Calls DSGRUN
  2. Tests the status codes returned from DSGRUN
  3. Performs the business logic you've inserted
  4. Repeats to call DSGRUN again to display the output and get more input

The program generated for you by Windows GUI Application Wizard has this structure. For another example, look later at the Customer demo in the directory d:\NetExpress\DialogSystem\Demo\Customer.

13.2 Preparation

If you have closed NetExpress, open it as before. If you have closed the project, open it as described in the chapter Start Here for the Tutorials. If you use Open, the project to open is Welcome in the directory d:\NetExpress\Base\Demo\Welcome. By default the Open dialog box shows files of type .app, .cbl, and .cpy, so the file Welcome should be visible.

13.3 Sample Session

In this sample session you:

  1. Edit the COBOL Program
  2. Build the application
  3. Run the application

13.3.1 Editing the COBOL Program

You could use any text editor to add your business logic to the COBOL program. We will use the IDE.

  1. Double-click Welcome.cbl in the project window.

    A text window opens with the source of the program. You may need to resize the window to see the source clearly. Look at Hide All Copyfiles on the View menu and ensure that the button-like icon beside it is shown depressed (if it isn't, click it).

    Take a few minutes to look through the program to see what it does.

  2. Put the cursor on the line COPY "Welcome.CPB" in the Working-Storage, click Copyfile on the File menu, then click Show.

    The file welcome.cpb is the data block. You'll see your data items I-NAME and GREETING at the end of it.

    The other copyfile, ds-cntrl.mf, is called the control block. It is supplied with NetExpress and contains standard definitions needed by all Dialog System applications.

  3. In the Program-Body Section, insert the following line above the period and below the statement PERFORM Call-Dialog-System:
    string "Hello " I-Name delimited by size into Greeting

    In a real application you would probably put a call here to a subprogram to process data from the screenset and calculate or look up data to display. You could use an EVALUATE statement performing actions depending on what is returned from DSGRUN. This would typically include a WHEN EXIT-FLAG-TRUE CONTINUE branch.

13.3.2 Building the Application

To build the application:

  1. Click Rebuild All on the Project menu.

    NetExpress saves and compiles the program, and rebuilds the executable file. Wait until the message "Rebuild Complete" appears in the Output window before continuing.

13.3.3 Running the Application

To run the application:

  1. Click Run on NetExpress's Animate menu.

    The Start Animating dialog box appears.

  2. Click OK on the Start Animating dialog box.

    The program runs, and displays the screenset.

  3. Click in the Enter name field, type your name and click Start. Because you defined I-NAME-DISP to be 12 characters long, there is a limit of 12 characters.

    The program puts your name after the "Hello " in the Greeting field, then redisplays the screenset.

  4. Click in the Enter name field and delete your name, then type another name and click Start.

    The program goes round the main loop again, displaying "Hello " followed by the new name.

  5. Press Esc to close the window and end the program.

13.4 Before Continuing

Close the project.

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.
PreviousCreating a Windows GUI Application Deploying an Application on UNIXNext