You need to do the tutorials in this book in the order shown by the Tutorials Map in the chapter Start Here for the Tutorials.
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.
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 Net Express, 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 Net Express, Setup creates, within the system folders containing Net Express, a folder called by default Net Express\Base\Workarea. This folder is intended as your work area, and we suggest that you put all your project folders within it.
Net Express 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. Most are in folders within Net Express\Base\Demo, though a few for optional extensions are in other folders - for example the demos for Dialog System are in folders within Net Express\DialogSystem\Demo.
Throughout this book we assume that you installed Net Express into a folder called Net Express. If you installed into a different folder, remember to change the paths shown accordingly.
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.
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. You can close it by clicking its button, now or at any time.
If not, then start the IDE as follows:
In this book, we generally omit any version numbers shown on menu items.
You may get a dialog box warning you that your license expires in a few days. In these sessions we will ignore this warning, but later you should load Net Express again and click the Help button on this screen for details of how to get a full license.
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 Net Express.
The Welcome screen closes. You now have the IDE on your screen. It is shown in Figure 4-1.
Figure 4-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. (Right-click in a pane and look for an Allow docking option.)
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.
To load the Locking project:
This opens the Open dialog box. If this is the first time you have started Net Express since installing, this displays the contents of Net Express\Base\Demo. If it doesn't, change it to that directory.
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.
The .cbl files are the COBOL source files.
This opens a text window showing you the source code
This closes the text window, leaving the project window open.
The .int files are executable files in intermediate code, 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.
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.
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 Net Express, 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 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. 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".
You use the Animate menu for both running and debugging. To run the application without debugging:
Depending on options in the IDE, either the application starts straight away or the Start Animating dialog box appears. You use this dialog box 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 Debug > Run.
This is a character-based application, so a new window appears, called the Application Output window. This window appears for any application that does character displays. It is shown in Figure 4-2.
Figure 4-2: The Application Output Window
In this tutorial we are just showing how to build and run an application, so we will not use this application in any detail.
"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.
This closes the Application Output window.
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. We will animate this application to see a few of these features:
The Start Animating dialog box appears.
The IDE opens a text window showing the source code for locking.cbl. The first statement is highlighted, ready for execution.
Step executes the next statement. This statement displays spaces on the text console, so it opens the Application Output window for this application.
Run Thru executes all the code for a PERFORM or CALL statement in a single step.
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.
The statement EVALUATE CHOICE is highlighted ready for execution.
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).
Let's look at some ways you can configure the behavior of the IDE:
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.
The whole line is selected. You often use this when editing. However, you may not want the whole line selected.
A rectangular block 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.
Execution halts on the STOP RUN statement at the end of the application.
Let's take a moment here to look at one way you can get help whenever you're using Net Express.
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. Many screens also have a Help menu or Help button which takes you into the main help.
Close the project, by clicking in it to select it and clicking File > Close, or by clicking its 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 using File > Close, and they do not have buttons when they are docked. Instead, right-click on the Application Output window and click Hide on the popup menu. Alternatively, click View > Dockable Windows, 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 Net Express open. Otherwise, either click Exit on the File menu, or click the IDE's button.
To continue to another tutorial, go to the Tutorials Map in the chapter Start Here for the Tutorials.
Copyright © 2003 Micro Focus International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.