HP 3000 Manuals

Some More Features [ COBOL/HP-UX Getting Started for the Series 700 and 800 ] MPE/iX 5.0 Documentation


COBOL/HP-UX Getting Started for the Series 700 and 800

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 in this
task.

Directory Facility 

Whenever you are prompted for a file-name in COBOL Toolbox, the Directory
Facility is invoked.  Let's have a closer look at it.

   1.  Make sure you are in the COBOL Editor.

   2.  Press Ctrl+F4=clear to clear your work area.

   3.  Press Alt+F3=load.

       You should be looking at a menu similar to that shown in Figure
       3-5 .

[]
Figure 3-5. The Load File Menu You are being asked for a file-name to load into the COBOL Editor. Toolbox has entered the name of the current directory for you, so you can just key in a name from the current cursor position. Alternatively, you can press F2 for a list of files to choose from. 4. Press F2=directory. You will see a list containing several names appear including the source program tictac.cbl. You can move the cursor up and down using the cursor keys, the Home key and the End key. The Directory program has shown only files with an extension of .cbl, .cpy or spaces because it assumes that, since you're in the COBOL Editor, you wish to load a source file. However, you might want to load a file with some other extension. 5. Press Escape to return to the file-name prompt. 6. Type: .* to indicate that you want all extensions, and: 7. Press Enter. A longer list appears showing all the files in the directory. 8. Press F5=sort-name to sort the list by name. 9. Press F6=sort-time to sort the list by time. These two alternative ways of sorting are invaluable when you have a long list and are searching for something specific. 10. Press Escape. You are not restricted to the current directory. If you want to select a file from a different directory, you can simply type over the directory name on the file prompt. First, let's assume you want to look at a file in the COBOL system's COPY-files directory. Assuming you have the default directory structure, this is a subdirectory at the same level as the demonstration programs directory - the one you are currently in. 11. Press Home to move the cursor to the beginning of the prompt (you might have to press it more than once if you have a long path name set). In the following step, to type "/" you will have to press "/" twice. This is because Toolbox uses "/" as a special character to introduce the mapping keys. 12. Type: ../source/.* 13. Press the Space bar a number of times to clear any of the previous name that remains. 14. Press F2=directory. You will now see a list of all the files in your COBOL system COPY-files directory. 15. Press Escape to return to the file-name prompt once more. The Ctrl menu has a function to allow you to return to the default directory without having to key in its name again. 16. Press Ctrl+F3=use-def-dir. 17. Press Enter to get the listing of the COBOL demonstration programs directory again. Now let's assume you can't remember a directory name or that it's a long name which you don't want to key in. 18. Press F3=list-dirs. 19. Use the cursor keys to select ..(parent directory) 20. Press F3=list-dirs again. You'll now see a list of one or more directories including demo. 21. Use the cursor keys to select the line containing the name "demo". 22. Press F2=list-files to list the files in your sample directory again. 23. Use the cursor keys to select the line containing the name tictac.cbl. 24. Press Enter twice to load the file into the COBOL Editor once again. 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 twice to enter the COBOL menu. 3. Press F2=compile/animate to set the Cmp+Anim toggle. 4. Press F4=list to change the listing toggle. Press it until "Nolist" appears on the information line. This prevents the source code being listed on the screen, although error messages are still shown. 5. Press F10=directives 6. Type the following words at the prompt: osvs flag(osvs) list() You have just 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 Operating Guide for more information about setting directives. Ensure that the bottom part of your display looks like the one in Figure 3-6 .
[]
Figure 3-6. The Directives Menu 7. Press Enter to return to the check-anim menu. 8. Press F9=directives to set the directive you have just entered. 9. Press Enter to start the check process. You might see that the listing is different this time. Since you switched off the program listing with the Nolist toggle you might not expect to see any messages at all. However, you should see that some messages are displayed although too quickly for you to read them. 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. 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. 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 Checker menu. 3. Press F2=check/animate until "Chk+Anim" appears on the information line. 4. Press F5=strc/anlz until "Strc+Anlz" appears on the information line. 5. Press Enter to start checking. When the checking process has finished, Animator will be loaded. 6. Press Alt+F3=structure/code to turn structure animation on. You should now be looking at a screen like the one shown in Figure 3-7 .
[]
Figure 3-7. The Structure Animation Screen An extra window has appeared on the Animator listing showing the structure of your program, and your cursor is positioned in this window. You can execute your program using the structure diagram instead of the source code. 7. Press Step several times. You will see that each step executes one block of the structure diagram. 8. When the program displays "Shall I start?", reply Y. 9. 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. Now we will turn structure animation off. 10. If your cursor is in the code, press Alt+F3 to move it to the structure diagram. 11. Press Qury and 12. Press Monitor-off Analyzer The first few steps of the preceding section prepare your program both for structure animation and for the Analyzer. This section assumes you have just completed the preceding section. Analyzer performs a coverage analysis of your program. 1. Press Alt+F2=analyzer on/off to turn the Analyzer on. You will see numbers have appeared on the right hand side of the text area. These numbers represent the number of times each line of code has been executed. 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, then: 2. Press Escape


MPE/iX 5.0 Documentation