[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
User Manual


Previous Contents Index

1.1.4.3 Errors and Switches

See Section 1.4 for a discussion of errors that can cause incorrect or undesirable results when you run a program.

See Section 1.5 for a discussion of controlling program execution with switches.

1.1.5 Program Development Stages and Tools

This manual primarily addresses the program development activities associated with development and testing phases. For information about topics usually considered during application design, specification, and maintenance, refer to your operating system documentation, appropriate reference pages, or appropriate commercially published documentation.

Table 1-3 lists and describes some of the software tools you can use when developing and testing a program.

Table 1-3 Main Tools for Program Development and Testing
Task or Activity Tool and Description
Manage source files Use RCS or sccs to manage source files. For more information, refer to the Tru64 UNIX documentation on programming support tools or the appropriate reference page.
Create and modify source files Use a text editor, such as vi , emacs , or another editor. For more information, refer to your operating system documentation.
Analyze source code Use searching commands such as grep and diff . For more information, refer to the Tru64 UNIX documentation on programming support tools or the appropriate reference page.
Build program (compile and link) You can use the cobol command to create small programs, perhaps using shell scripts, or use the make command to build your application in an automated fashion using a makefile. For more information on make , refer to the make(1) reference page and the Tru64 UNIX documentation on programming support tools.
Debug and test program Use the Ladebug Debugger to debug your program or run it for general testing. For more information on Ladebug Debugger, refer to the Ladebug Debugger Manual.
Install program Use setld and related commands such as tar . For more information, refer to the Tru64 UNIX documentation on programming support tools.

In addition, you might use the following shell commands at various times during program development:

  • To view information about an object file or an object library, use the following commands:
    • The file command shows the type of a file (such as which programming language, whether it is an object library, ASCII file, and so forth).
    • The nm command (perhaps with the -a or -o flag) shows symbol table information, including the identification field of each object file.
    • The odump command shows the contents of a file and other information.
    • The size command shows the size of the code and data sections.

    For more information on these commands, refer to the appropriate reference page or the Tru64 UNIX documentation on programming support tools.
  • Use the ar command to create an archive object library ( -r flag), maintain the modules in the library, list the modules in the library ( -t ), and perform other functions. Use -ts to add a table of contents to the object library for linking purposes. For more information, refer to ar(1) or the Tru64 UNIX programmer's documentation.
  • To create shared libraries on Tru64 UNIX systems, use ld , not the ar command. For more information, see Section 1.1.3.4 and refer to the Tru64 UNIX programmer's documentation.
  • The strip command removes symbolic and other debugging information to minimize image size. For additional information, refer to the strip(1) reference page.

Note

The CALL dataname, CANCEL, and the Hewlett-Packard extensions to the ACCEPT and DISPLAY statements will not work correctly if you use the strip command on your image.

In most instances, use the cobol command to invoke both the HP COBOL compiler and the ld linker. To link one or more object files created by the HP COBOL compiler, you should use the cobol command instead of the ld command, because the cobol command automatically references the appropriate HP COBOL Run-Time Libraries when it invokes ld . If the executable image is not in your current working directory, specify the directory path in addition to the file name.

Compilation does the following for you:

  • Detects errors in your program syntax
  • Displays compiler messages on your terminal screen
  • Generates machine language instructions from valid source statements
  • Groups the instructions into an object module for the linker
  • Launches the linker with the compiled file or files
  • Creates an executable image

You use the cobol command to compile and link your program. The cobol command invokes the HP COBOL compiler driver that is the actual user interface to the HP COBOL compiler. The compiler driver can accept command options and multiple file names, and normally causes the compiler and linker to process each file. A variety of qualifiers to the compile command are available to specify optional processing and to specify the names of output files.

After the HP COBOL compiler processes the source files to create one or more object files, the compiler driver passes a list of object files and other information to the linker. <>

1.2 Developing Programs on OpenVMS

You use DCL commands (commands used at the OpenVMS system prompt) to create, compile, link, and run HP COBOL programs on OpenVMS systems.

1.2.1 Creating an HP COBOL Program on OpenVMS

To create and modify an HP COBOL program, you must invoke a text editor. The default editor for OpenVMS is the Text Processing Utility (TPU). Other editors, such as EDT or the Language-Sensitive Editor (LSE), may be available on your system. Check with your system administrator and refer to the OpenVMS EDT Reference Manual (this manual has been archived but is available on the OpenVMS Documentation CD-ROM) for more information about EDT or the Guide to Language-Sensitive Editor for additional information about LSE.

Figure 1-2 shows the basic steps in HP COBOL program development.

Figure 1-2 DCL Commands for Developing Programs


Use the text editor of your preference to create and revise your source files. For example, the following command line invokes the TPU editor and creates the source file PROG_1.COB:


$ EDIT PROG_1.COB

The file type .COB is used to indicate that you are creating an HP COBOL program. COB is the default file type for all HP COBOL programs.

The COPY Statement, Dictionaries, and Libraries

Including the COPY statement in your program allows separate programs to share common source text, reducing development and testing time as well as storage requirements. You can use the COPY statement to access modules in libraries. The COPY statement causes the compiler to read the file or module specified during the compilation of a program. When the compiler reaches the end of the included text, it resumes reading from the previous input file.

By using the /INCLUDE qualifier on the COBOL command line, you can set up a search list for files specified by the COPY statement. For more information, refer to the HP COBOL Reference Manual.

You can use the COPY FROM DICTIONARY statement in your program to access a data dictionary and copy Oracle CDD/Repository record descriptions into your program as COBOL record descriptions. Before you can copy record descriptions from Oracle CDD/Repository, you must create the record descriptions using the Common Data Dictionary Language (CDDL) or Common Dictionary Operator (CDO).


Previous Next Contents Index