Creating a Windows GUI Application | Deploying an Application on UNIX |
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 Net Express, and worked through the previous session, Creating a Windows GUI Application, before you do this session.
You need to have installed Dialog System to do this session.
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.
An associated program typically has a main loop which does the following:
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:\Program Files\MERANT\Net Express\DialogSystem\Demo\Customer.
If you have closed Net Express, 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:\Program Files\MERANT\Net Express\Base\Demo\Welcome. By default the Open dialog box shows files of type .app, .cbl, and .cpy, so the file Welcome should be visible.
In this sample session you:
You could use any text editor to add your business logic to the COBOL program. We will use the IDE.
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.
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 Net Express and contains standard definitions needed by all Dialog System applications.
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.
To build the application:
Net Express saves and compiles the program, and rebuilds the executable file. Wait until the message "Rebuild Complete" appears in the Output window before continuing.
To run the application:
The Start Animating dialog box appears.
The program runs, and displays the screenset.
The program puts your name after the "Hello " in the Greeting field, then redisplays the screenset.
The program goes round the main loop again, displaying "Hello " followed by the new name.
Close the project.
If you're planning to go straight on to another session, you can keep Net Express 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 © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Creating a Windows GUI Application | Deploying an Application on UNIX |