Pro*COBOL Precompiler Programmer's Guide Release 8.0 A58232-01 |
Library | Product | Contents | Index

# 1
Introduction

This chapter introduces you to the Pro*COBOL Precompiler. You look at its role in developing application programs that manipulate Oracle data and find out what it allows your applications to do. The following questions are answered:

- What Is Pro*COBOL?
- Why Use the Pro*COBOL Precompiler?
- Why Use SQL?
- Why Use PL/SQL?
- What Does Pro*COBOL Offer?

## What Is Pro*COBOL?

The Pro*COBOL Precompiler is a programming tool that allows you to embed SQL statements in a high-level host program. As Figure 1-1 shows, the precompiler accepts the host program as input, translates the embedded SQL statements into standard Oracle run-time library calls, and generates a source program that you can compile, link, and execute in the usual way.

#### Figure 1-1 Embedded SQL Program Development

### Language Alternatives

Oracle Precompilers are available (but not on all systems) for the following high-level languages:

- C/C++
- COBOL
- FORTRAN

Pro*Pascal, Pro*ADA and Pro*PL/I will not be released with Oracle8. However, Oracle will continue to issue patch releases for Pro*FORTRAN as bugs are reported and corrected.

## Why Use the Pro*COBOL Precompiler?

The Pro*COBOL Precompiler lets you pack the power and flexibility of SQL into your application programs. You can use SQL in popular high-level languages such as COBOL. A convenient, easy to use interface lets your application access Oracle directly.

Unlike many application development tools, Pro*COBOL lets you create highly customized applications. For example, you can create user interfaces that incorporate the latest windowing and mouse technology. You can also create applications that run in the background without the need for user interaction.

Furthermore, with Pro*COBOL you can fine-tune your applications. They allow close monitoring of resource usage, SQL statement execution, and various run-time indicators. With this information, you can adjust program parameters for maximum performance.

## Why Use SQL?

If you want to access and manipulate Oracle data, you need SQL. Whether you use SQL interactively or embedded in an application program depends on the job at hand. If the job requires the procedural processing power of COBOL, or must be done on a regular basis, use embedded SQL.

SQL has become the database language of choice because it is flexible, powerful, and easy to learn. Being non-procedural, it lets you specify what you want done without specifying how to do it. A few English-like statements make it easy to manipulate Oracle data one row or many rows at a time.

You can execute any SQL (not SQL*Plus) statement from an application program. For example, you can

- CREATE, ALTER, and DROP database tables dynamically
- SELECT, INSERT, UPDATE, and DELETE rows of data
- COMMIT or ROLLBACK transactions

Before embedding SQL statements in an application program, you can test them interactively using SQL*Plus or Server Manager. Usually, only minor changes are required to switch from interactive to embedded SQL.

## Why Use PL/SQL?

An extension to SQL, PL/SQL is a transaction processing language that supports procedural constructs, variable declarations, and robust error handling. Within the same PL/SQL block, you can use SQL and all the PL/SQL extensions.

The main advantage of embedded PL/SQL is better performance. Unlike SQL, PL/SQL allows you to group SQL statements logically and send them to Oracle in a block rather than one by one. This reduces network traffic and processing overhead.

For more information about PL/SQL including how to embed it in an application program, see Chapter 5, "Using Embedded SQL".

## What Does Pro*COBOL Offer?

As Figure 1-2 shows, Pro*COBOL offers many features and benefits that help you to develop effective, reliable applications.

#### Figure 1-2 Features and Benefits

For example, the Pro*COBOL Precompiler allows you to:

- write your application in COBOL
- conform to the ANSI/ISO embedded SQL standard
- take advantage of dynamic SQL, an advanced programming technique that lets your program accept or build any valid SQL statement at run-time in a COBOL program
- design and develop highly customized applications
- convert automatically between Oracle8 internal datatypes and COBOL datatypes
- improve performance by embedding PL/SQL transaction processing blocks in your COBOL application program
- specify useful precompiler options and change their values during precompilation
- use datatype equivalencing to control the way Oracle8 interprets input data and formats output data
- precompile several program modules separately, then link them into one executable program
- check the syntax and semantics of embedded SQL data manipulation statements and PL/SQL blocks
- access Oracle8 databases on multiple nodes concurrently using Net8
- use arrays as input and output program variables
- precompile sections of code conditionally so that your host program can run in different environments
- interface with tools such as Oracle Forms and Oracle Reports via user exits written in a high-level language
- handle errors and warnings with the ANSI-approved status variables SQLSTATE and SQLCODE, and/or the SQL Communications Area (SQLCA) and WHENEVER statement
- use an enhanced set of diagnostics provided by the Oracle Communications Area (ORACA)

Prev | Next
| Copyright © 1997 Oracle Corporation. All Rights Reserved. |
Library | Product | Contents | Index