PreviousStart Here for the Tutorials Maintaining and Creating Data FilesNext

Chapter 5: Using NetExpress

The Integrated Development Environment (IDE) is where you compile, edit and debug all your applications.


This is the first session of the tutorial in the Getting Started book. You need to work through this before you do any of the others. You need to have read the chapter Start Here for the Tutorials before doing this one.


5.1 Overview

The IDE integrates all the tools you need for editing, compiling and debugging (known as "animating") COBOL applications. It contains extensive on-line documentation, both for the tools and for the COBOL language.

The easiest way to learn about the IDE is to complete a few simple tasks, so this session takes you through loading a project, compiling it, running it, and animating (debugging) it - that is, stepping through the source code.

5.1.1 Projects and Project Folders

A project is a file detailing all the files in your application, and how they should be compiled. A project is very easy to create, and makes compiling extremely quick and easy. You should create a project for every application, even the simplest. On disk, a project is recognizable by the extension .app at the end of its name. However, you never need to look at a project directly because, like most things in NetExpress, you create and maintain it entirely using the IDE.

The folder where you keep the project for an application is called its project folder. You could keep the application's other files anywhere, since the project contains pointers to them, but it's usually convenient to keep them all in the project folder.

When you install NetExpress, Setup creates, within the system folders containing NetExpress, a folder called - by default d:\NetExpress\Base\Workarea. This folder is intended as your work area, and we suggest that you put all your project folders within it.

5.1.2 Demonstration Applications

NetExpress includes many demonstration applications. Some are used in the tutorials in this Getting Started book. Others are used in more advanced tutorials accessed via the online help. They are all are in folders within d:\NetExpress\Base\Demo.

If, when you installed, you specified a different name for the folder NetExpress, remember to use it in these sessions instead of NetExpress.

If you get partway through a tutorial and decide you want to start again, you can return the supplied files of demo to their initial state by clicking the demo's Initialize button in the full list of tutorials in the NetExpress Help. You must have the CD-ROM or network connection from which you installed NetExpress available. To get to the list, click Start -> Programs -> Micro Focus NetExpress -> NetExpress Help, and then in the Help Contents double-click Start Here! -> Tutorials, then click the subject area you want.

This does not delete files or folders created during the demo, but reinstalls the original versions of the supplied files.

The demo application used in this session is called Locking. A project file is supplied with it, and in this session you load the project and get the application running.

5.2 Sample Session

In this sample session you:

5.2.1 Starting the IDE

If you've entered the IDE by clicking the Run button at the end of installing, you may still have visible the main screen of the installation utility - the one with the Install, Installation Notes, and Exit buttons - though it may be hidden behind the IDE. You can close it by clicking its g           button, now or at any time - it won't interfere with this session

If not, then start the IDE as follows (this is how you will always start the IDE in future):

  1. From the Windows 95 or Windows NT Start menu, click Programs, then Micro Focus NetExpress, then NetExpress.

    You may get a dialog box entitled Micro Focus Protection System, warning you that your license expires in a few days. In these sessions we will ignore this warning, but later you should load NetExpress again and click the Help button on this screen for details of how to get a full license.

  2. If you got the license warning, click OK to ignore it.

    When you first load the IDE you get a Welcome screen as well as the IDE window. It has a check box you can set to show whether you want to get it every time. It enables you to choose whether to look at the Help file, or go straight into NetExpress.

  3. Click Continue on the Welcome screen.

    The Welcome screen closes. You now have the IDE on your screen. It is shown in Figure 5-1.

IDE

Figure 5-1: The Integrated Development Environment (IDE)

The large pane is where various windows such as project windows and editing windows will be opened. The pane below it is the Output window, where messages from the IDE and compiler are displayed. It has several tabs, of which the one you will use most is marked Build. When the Build tab is highlighted (that is, white), this window displays messages to show the progress of a build.

You can change the size and shape of the IDE by dragging the edges and corners. You can detach some panes and position them elsewhere in the IDE or separately on your screen - this is called docking or undocking them. See the appendix Windows Tips if you want to do this.

In doing the sessions in this book, be aware that if anyone has used the product on your computer before you, they might have moved panes from their standard positions.

5.2.2 Loading a Project

To load the Locking project:

  1. Click Open on the File menu.

    This opens the Open dialog box. If this is the first time you have started NetExpress since installing, this displays the contents of d:\NetExpress\Base\Demo. If it doesn't, change it to that directory.

  2. Go into subdirectory Locking, select the project locking.app and click Open. (The extension .app and the icon are standard for a project file. If your Windows settings are such that extensions aren't shown, you can identify this file by its icon.)

    The IDE opens a project window, displaying the files in the project. The left-hand pane is a tree view showing which files are created from which. The right-hand pane is a list of the files. You can drag the borders of the window; for example, you might want to make the right-hand pane wider to see more details of the files.

  3. Right-click in the right-hand pane to get a popup menu. Ensure Show only source files on this menu has no checkmark by it. If it has, click it to make this pane show all files, not just files that can be compiled.

    The .cbl files are the COBOL source files.

  4. Double-click on any .cbl file.

    This opens a text window showing you the source code

  5. Click Close on the File menu.

    This closes the text window, leaving the project window open. Alternatively you can close a window by clicking the Close icon at its top right-hand corner.

The .int files are executable files in intermediate code format (a Micro Focus executable format).

The IDE can also produce industry-standard .exe and .dll files, but .int code has the advantage of not needing linking - this makes it very quick to recompile individual programs when you are debugging a new application.

Files don't have to exist yet to be shown in the project. A project is analogous to a makefile or batch file that will guide the build. Since you haven't built the project yet, none of the .int files exist.

5.2.3 Building a Project

Building a project means compiling the files to an executable format. The format of the files created depends on the type of build and the options selected for the project type. Each project has two standard build types available, Debug and Release, and you can create your own build types as well.

To build the project:

  1. Click Rebuild on the Project menu, or click on the toolbar.

    This rebuilds all the files that have changed since the last time the project was built. Since you haven't built the project before, all the files are rebuilt. (The Rebuild All function on the same menu rebuilds all files in the project, whether they need it or not.)

This one function carries out the entire build. The correct compiler or translator is automatically called for each source file. In NetExpress, the term "compilation" is generally used for any compilation, translation, conversion or preprocessing. Also, the term "source file" is used for any file that is the input to such a compilation.

Notice the g           button on the toolbar. The same symbol appears by Rebuild on the Project menu. Many commonly used functions on the menus have equivalent buttons on the toolbar. It's often quicker to use these. In these sessions we'll sometimes use the menus and sometimes the toolbar. If you leave the mouse pointer over a button on the toolbar for a moment, a brief explanation of that button appears. These explanations are called tooltips.

Messages in the Output window keep you informed about the progress of the build. The build is over when you see the message "Rebuild complete".

5.2.4 Running the Application

You use the Animate menu for both running and debugging. To run the application without debugging:

  1. Click Run on the Animate menu.

    The Start Animating dialog box appears. You use it to specify where execution starts.

    This dialog box appears for both running and debugging. In the IDE, running and debugging use the same underlying mechanism. In running an application within the IDE you are really using the debugging engine with the debugging features switched off. Consequently, running is controlled via the Animate menu, and observations we make about debugging will generally apply to running as well.

    The button on the toolbar is equivalent to Run on the Debug menu.

  2. Click OK to confirm that you want to start the Locking program.

    This is a character-based application, so a new window appears at the bottom of the IDE. This window always appears for an application that does character displays. It is called the Application Output window, or character window. It is shown in Figure 5-2. You might have to drag the borders within the IDE to make this window bigger so you can see the whole display. If it is not big enough to show the whole display, there is a slider at its right-hand side.



    Figure 5-2: The Application Output Window

    In this session we are just showing how to build and run an application, so we will not use this application in any detail.

  3. Click in the Application Output window to select it, then type "5" and press Enter.

    "5" is the code that tells this application to finish. The Application Output window remains so that you can see the application's final display.

    You can check it has finished by clicking the Animate menu. The Start Animating and Run functions are not grayed out, as they are while an application is running. Click elsewhere on your screen to close the menu again.

    (This Locking application is also used in one of the more advanced tutorials accessed via the online help, to demonstrate different ways of locking a file.)

  4. Right-click anywhere in the Application Output window, and click Hide on the popup menu.

    This closes the Application Output window.

5.2.5 Debugging an Application

The IDE gives you an intuitive and graphical way to trace the execution of your code. It provides an extensive set of debugging (known as "animating") facilities. It is useful if the application isn't doing what you expect, or if you want to get familiar with an unfamiliar application. We will animate this application to see a few of these features:

  1. Click Start Animating on the Animate menu.

    The Start Animating dialog box appears.

  2. Click OK to confirm that you want to debug the Locking program.

    The IDE opens a text window showing the source code for locking.cbl. The first statement is highlighted, ready for execution.

  3. Click Step on the Animate menu, or click on the toolbar.

    Step executes the next statement. This statement displays spaces on the text console, so it opens the Application Output window for this application. Windows might be moved about to make room for the Application Output window. You might have to drag borders within the IDE so you can see the source code again.

  4. Step the next statement as well (DISPLAY LOCKING01-00).

  5. Click Run Thru on the Animate menu.

    Run Thru executes all the code for a PERFORM or CALL statement in a single step.

  6. Right-click on the statement EVALUATE CHOICE (second statement in the paragraph RE-ENTER-CHOICE) and click Run to Cursor on the popup menu. (You might have to make the text window bigger to see more of the source.)

    Run to Cursor gives you a quick way of executing to a particular statement without setting a breakpoint. Execution does not reach the EVALUATE statement yet though - part of the code you have executed is an ACCEPT statement, and the application pauses there waiting for input.

  7. Click in the Application Output window to select it, then type "5" and press Enter.

    The statement EVALUATE CHOICE is highlighted ready for execution.

  8. Double-click on any reference to the data item CHOICE to see its value.

    This opens the Examine List, where you can see that its value is 5. From this dialog box you could create an individual monitor window for a data item, or change its value, or add it to the Watch list (which opens a window at the bottom of the screen).

  9. Click the g           button at the top right-hand corner of the Examine List.

5.2.6 Setting IDE Options

Let's look at some ways you can configure the behavior of the IDE:

  1. Click Animate on the Options menu.

  2. On the dialog box, make sure the checkbox by Show tool tips to examine data contains a checkmark (click in it if it hasn't), and click OK.

  3. Put the mouse pointer on the data item CHOICE, without clicking, and wait a moment.

    With this option set, putting the mouse pointer on a data item displays the item's value. This is quicker than using the Examine List, but you may not want this to happen every time you put the mouse on a data item. It's up to you whether you leave this option set or not.

  4. Put the mouse pointer on any line in the source and, with the button held down, drag it a little way along the line.

    The whole line is selected. You often use this when editing. However, you may not want the whole line selected.

  5. Click anywhere in the source to deselect the line.

  6. Click Edit on the Options menu.

  7. On the dialog box, click the Blocks/Clipboard tab, then make sure the checkbox by Select column blocks when dragging, except when in the prefix area contains a checkmark (click in it if it hasn't), and click OK.

  8. Put the mouse pointer on any line in the source and, with the mouse button held down, drag it a little way along the line.

    Only the part of the line you dragged the mouse along is selected. Again, it's up to you whether you leave this option set or not.

    There are many other options which you can set. We suggest you explore them when you are more familiar with using the IDE.

5.2.7 Ending Animation

  1. Click to run the rest of the application.

    Execution halts on the STOP RUN statement at the end of the application.

  2. Click OK on the "Stop Run encountered" message and then click Stop Animating on the Animate menu.

5.2.8 Using Context Help

Let's take a moment here to look at one way you can get help whenever you're using NetExpress.

  1. Click on the toolbar, and then click anywhere in the project window.

    A popup appears telling you what the project window is for. Generally, whenever you see the Context Help button, normally or , you can use it to get quick context-sensitive help in this way. Of course, many screens also have a Help menu or Help button which takes you into the main help.

  2. Press any key or click the mouse anywhere to make the popup disappear.

5.3 Before Continuing

Close the project, by clicking in it to select it and clicking Close on the File menu, or by clicking its g           button. Closing a project window closes all its dependent windows - in this case, the text window displaying the source.

You can't close the standard windows like the Application Output window and the Output window using Close on the File menu, and they do not have g           buttons (unless you've undocked them). Instead, right-click on the Application Output window and click Hide on the popup menu. Alternatively, click Dockable Windows on the View menu, then click by Application Output on the dialog box to delete the check mark, and click Close to close the dialog box. You hide these windows rather than close them - if you open them again, they are still displaying what was there before.

If you're planning to go straight on to another session, you can keep NetExpress open. Otherwise, either click Exit on the File menu, or click the IDE's g           button.

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.
PreviousStart Here for the Tutorials Maintaining and Creating Data FilesNext