|Pro*COBOL® Programmer's Guide
Part Number A96109-03
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 enables your applications to do. The following questions are answered:
The Pro*COBOL Precompiler is a programming tool that enables you to embed SQL statements in a host COBOL 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.
Pro*Pascal, Pro*ADA, and Pro*PL/I will not be released again. However, Oracle will continue to issue patch releases for Pro*FORTRAN as bugs are reported and corrected.
The Pro*COBOL Precompiler lets you pack the power and flexibility of SQL into your application programs. You can embed SQL statements in 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. It enables close monitoring of resource usage, SQL statement execution, and various run-time indicators. With this information, you can adjust program parameters for maximum performance.
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.
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 enables 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 6, " Embedded PL/SQL".
As Figure 1-2 shows, Pro*COBOL offers many features and benefits that help you to develop effective, reliable applications.
Figure 1-2 Pro*COBOL Features and Benefits
For example, the Pro*COBOL Precompiler enables you to:
Write your application in COBOL.
Conform to the ANSI/ISO embedded SQL standard.
Take advantage of ANSI Dynamic SQL Method 4, 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 Oracle9i 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 Oracle9i interprets input data and formats output data.
Precompile several program modules separately, and then link them into one executable program.
Check the syntax and semantics of embedded SQL data manipulation statements and PL/SQL blocks.
Access Oracle9i databases on multiple nodes concurrently, using Oracle Net (formerly called 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 through 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).
Access Large Object (LOB) database types.