Using Application ServerNext"

Chapter 1: Developing COBOL Applications

Object COBOL for UNIX provides everything you need to develop COBOL applications to run on UNIX systems. It also provides for problem-free migration of COBOL applications from a large number of other systems and dialects, including IBM mainframe COBOL, and UNIX systems. Before reading this chapter you should have read your Getting Started, which tells you how to install the COBOL system and gives a brief overview of using it.

This chapter gives an overview of the steps required to create executable files from COBOL source code, and the tools available to help you develop applications. If you want to create object oriented COBOL programs, you need additional information; refer to your OO Programming with Object COBOL for details.

1.1 The Development Cycle

The basic steps in creating an application are shown in Figure 1-1 below:



Figure 1-1: Application Development Cycle

Object COBOL provides tools and utilities to help you develop COBOL programs and applications. These are described in the following sections.

1.1.1 Creating and Editing Programs

Creating and editing programs is one of the most basic functions you need when writing applications.

You can edit your programs using the Editor . The Editor is described in detail in the chapter Editor in your Object COBOL Character Tools. Alternatively, you can edit programs using system editors, such as vi.

1.1.2 Checking the Syntax of Your Program

Before you can debug your program, you must check its syntax. Syntax-checking is the first phase of compilation.

The syntax-check creates:

These files are used by Animator when debugging a program.

You can check the syntax your program using the cob command. See the chapters Using the Compiler and COBOL System Interface (cob) for details on compiling and the cob command.

You can also check the syntax of your program from the Editor. The Editor calls the Compiler to check the syntax of a program. If the Compiler finds a syntax error it displays a message. When the syntax check is complete, the Editor returns to the editing screen and positions the cursor in the first error it found. When you have fixed the error you can move the cursor to the next error. See the Editor chapter in your Object COBOL Character Tools for details.

1.1.3 Debugging your program

Use Animator to debug your program. Animator offers a comprehensive debugging environment.

Animator shows you both the source code of your programs as they are running and the effect of each statement as it is executed. Debugging using Animator is also referred to as "animating".

When you debug a program using Animator you can:

To learn how to use Animator, follow the sample session described in your Getting Started. You can use Animator very effectively by knowing how to use the basic functions:

Step
Perform Step
Perform Exit
Breakpoint Set
Zoom
View
Locate
Query
Monitor (on the Query menu)

When you are familiar with these and with using Animator, you should become familiar with the following additional functions:

Breakpoint Do
Do statement
Reset Quit
Split Text
Breakpoint If
Environment Threshold
Backtrack

For detailed information on using Animator, see your Object COBOL Character Tools.

1.1.4 Compiling Your Program

When you have debugged your program you need to compile it to create an an executable file format (the types of executable file are described in the section Executable File Types in the chapter Packaging Applications). If you choose to create a system executable file you have to link the program after it has been compiled. For more details on how to compile programs, see the chapter Compiling Programs.

1.2 Packaging Applications

Object COBOL offers alternative methods for packaging applications; each method has its advantages and disadvantages. The methods used to package applications are described in detail in the chapter Packaging Applications. You can package applications by:

An overview of these methods is given in the sections below.

1.2.1 Using Intermediate and Generated Code Files

Object COBOL enables all subprograms and support modules required by an application to be kept in memory. This avoids the need for the link step usually required to create an application. To use Object COBOL in this way, your programs must be compiled to intermediate code or generated code.

You can simply ship the programs in your application as intermediate or generated code files.

Executable file formats are described in the chapter Packaging Applications.

1.2.2 Linking Your Program

You can link a program, using cob, to create an executable file. Linking programs is a two stage process. First, the source code is compiled to create a file in object code format. The object code file is then linked to create a system executable file or a dynamic link library file. Linking is described in detail in the chapter Linking Programs.

Usually you compile and link in one step using the cob command.

1.3 Running Your Application

When you have packaged an application using one of the methods described earlier in this chapter, you can run the application. An application can be run by typing the name of the executable file at the command line. For example, if you have linked your application to create an executable file myprog, this could be run by typing:

myprog

at the command line.

If your program reads the command line using an ACCEPT ... FROM COMMAND-LINE statement, enter the required command following the name. For example:

myprog in-file new-file

If your application is built using intermediate or generated code files, you might need to use the cobrun trigger. For example:

cobrun myprog

1.4 Shipping Applications

When you have created and tested your application, you can, if necessary, ship it to your end-users. To ship an application, you need to ship all of the executable programs that make up your application, along with any configuration files and data files. You also need to ship Application Server, which contains all of the Micro Focus Object COBOL system files required by the application.

See the chapter Application Server for information on Application Server.

1.5 For More Information

For more information see the following chapters:

The chapter Sample Session in your Getting Started guides you through the development process using a tutorial.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

Using Application ServerNext"