Previous Topic Next topic Print topic


Compiler Directives

You have now learned how to perform the main task which Studio Enterprise Edition for UNIX facilitates - create, test, and run a program.

This part of the tutorial shows you how to use Compiler directives to change the syntax allowed by the Compiler, and the output it produces.

Compiler directives enable you to control the way in which your source code is compiled.

Load the Development Environment by using the sde command, and load the file tictac.cbl into the COBOL Editor as before.

To set the Compiler directives:

  1. Press F2=COBOL.
  2. Press F2=compl/animate.
  3. Ensure that "Compile" appears on the information line. If it doesn't, press F2=compl/anim until it does.
  4. Press F4=list 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 directives at the prompt:
    osvs flag(osvs) list()

    Ensure that the bottom part of your display looks like the image below.

  7. You have entered three 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, means 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 .lst, so this creates tictac.lst.

    The Directives Menu:
    The Directives Menu

  8. Press Enter to accept the directives and return to the COBOL menu.
  9. Press F9=directives to enable the directives you have just entered.
  10. 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 use Animator with the code again.

There are many different directives available, and this is just one way of setting them.

Previous Topic Next topic Print topic