HP 3000 Manuals

Some More Features [ Micro Focus COBOL for UNIX, Getting Started ] MPE/iX 5.0 Documentation


Micro Focus COBOL for UNIX, Getting Started

Some More Features 

You have now learned how to perform the main task which COBOL Toolbox
facilitates - create, test, and run a program.

This part of the sample session examines some other commonly used
features of COBOL Toolbox which will improve your productivity.

Compiler Directives 

You're going to see how to change the syntax allowed by the Compiler, and
the output it produces, by setting some directives.

   1.  Make sure you have the file tictac.cbl loaded into the COBOL
       Editor.

   2.  Press F2 to enter the COBOL menu.

   3.  Press F2=compile/animate until "Compile" appears on the
       information line.

   4.  Press F4=list to change the listing toggle.

       Press it until "List-Con" appears on the information line.  This
       causes the source code to be listed on the screen, with any error
       messages.

   5.  Press F10=directives.

   6.  Type the following words at the prompt:

            osvs flag(osvs) list ( )

       Ensure that the bottom part of your display looks like Figure 4-6
       .

[]
Figure 4-6. The Directive Menu 7. Press Enter to return to the COBOL menu. 8. Press F9=directives to enable the directives you have just entered. 9. Press Enter to start compiling the program. Some messages are displayed, too quickly for you to read. With this indication that there could be something wrong, you can load the listing file you have created (tictac.lst ) into the COBOL Editor at some future time to see what they are. In fact, the messages are indicating the lines of code that do not conform to OSVS syntax. These are not errors that prevent the creation of usable code, so you can go on to animate the code again. You entered several directives. The first two describe the language you want to test for: the OSVS directive means you want the OSVS reserved word list used, and the FLAG(OSVS) directive means you want any syntax that is not OSVS compatible to be indicated. The final directive, LIST, specifies that you want the source listing that the Compiler produces sent to a file. The parentheses mean you want to use the default name, which is your program name with an extension of of .lst, so this creates tictac.lst. There are many different directives available, and this is just one way of setting them. Look in your COBOL System Reference for more information about setting directives. Structure Animation Structure Animator extends the Animator display and functions to allow you to see your program executing as a diagram. You can also print this diagram as part of your program documentation. Preparing for Structure animation. You have to compile the program with special toggles set to make the Compiler create the extra files that Animator needs. The first few steps in this section prepare the program both for structure animation and for the Analyzer, described in the next section. 1. Make sure you have the file tictac.cbl loaded into the COBOL Editor. 2. Press F2=COBOL to get the COBOL menu. 3. Press F2=compile/animate until "Cmp+Anim" appears on the information line. 4. Press F5=strc/anlz until "Strc+Anlz" appears on the information line. 5. Press Enter to start compiling the program. When compiling has finished, Animator will be loaded. Using Structure Animation. In Animator, Alt+F3 =structure/code is a toggle that turns structure animation on or off. If structure animation is on, there is an extra window on the Animator listing, as shown in Figure 4-7 .
[]
Figure 4-7. The Structure Animation Screen 1. If this window is not there, Press Alt+F3=structure/code to turn structure animation on. The extra window shows the structure of your program. Your cursor is positioned in this window. You can execute your program using the structure diagram instead of the source code. 2. Press Step several times. You will see that each step executes one block of the structure diagram. 3. When the program displays "Shall I start?", reply Y. 4. Press Alt+F3. This moves you back to the code. If you keep pressing Alt+F3, you switch between code and structure - when you are in the structure the cursor is positioned there and the border of the structure window is highlighted. Turning structure animation off. 1. If your cursor is in the code, press Alt+F3 to move it to the structure diagram. 2. Press Query and 3. Press Monitor-off Analyzer The first few steps of the section Structure Animation prepared your program both for structure animation and for the Analyzer. This section assumes you have just completed that section. Analyzer performs a coverage analysis of your program. 1. Press Alt+F2=analyzer on/off to turn the Analyzer on. Numbers appear on the right-hand side of the text area. They represent the number of times each line of code has been executed. 2. If you now press Alt+F6 you can change the way that the Analyzer information is presented to you. Explore some of the options on the menu if you wish. 3. Press Esc


MPE/iX 5.0 Documentation