Oracle Pro*COBOL(TM) Getting Started for Windows NT and Windows 95
Release 8.0

A53715-01

Library

Product

Contents

Index

Prev Next

2
Building Pro*COBOL Applications

This chapter describes how to build Oracle database applications with Pro*COBOL Release 8.0 for Windows NT and Windows 95. It covers the following topics:

For specific information on the capabilities of Pro*COBOL 8.0 for Windows NT and Windows 95, refer to the Pro*COBOL Supplement to the Oracle Precompilers Guide and the Programmer's Guide to the Oracle Call Interfaces.

Building Pro*COBOL Applications

Pro*COBOL 8.0 converts embedded SQL statements in your COBOL program into standard COBOL code. When you successfully precompile this code, the result is a COBOL program that can be compiled and used to build applications that access an Oracle database.

Note:

This section assumes that you have installed Pro*COBOL under C:\ORANT.  

Building 32-bit (Windows NT and Windows 95) Applications

This section describes how to build Pro*COBOL applications.

Note:

Build and execute Pro*COBOL applications in a command prompt session with the default settings for the screen buffer size and the windows size. These settings ensure successful execution of the Pro*COBOL applications.  

Precompiling for WIN32

Use the following syntax to precompile a file with Pro*COBOL 8.0 for Windows NT and Windows 95:

C:\> PROCOB file

By default, if no extension is provided, Pro*COBOL tries to open file.PCO. If the oname= directive is not specified, Pro*COBOL generates a file named file.CBL.

Pro*COBOL reads PCCCOB.CFG (located in C:\ORANT\PRO80) for directive settings before processing directives supplied in the command line. This file can be modified to include directives for precompiling.

If EXEC SQL INCLUDE statements are used, an include= directive is required.

An option include=C:\ORANT\PRO80\COBOL\INCLUDE is present in the PCCCOB.CFG file so that including SQLCA and ORACA always works even though no include= is explicitly provided in the command line.

An option comp5 is also present in the PCCCOB.CFG file.

If the option comp5=yes:

If comp5=no:

PL/SQL Option

If you are using embedded PL/SQL blocks, do the following:

  1. Enter the SQLCHECK option and the USERID string to connect on the precompiling command line.
  2. Specify the SQLCHECK=FULL option to check the syntax or semantics of embedded SQL statements and PL/SQL blocks.
    Additional Information:

    For an example of a command line string, see Oracle Precompilers Programmer's Guide for more information, or review the PL/SQL MAKE file.  

Compiling/Linking for WIN32

You can build and execute a Micro Focus COBOL application in two ways:

Using Animator

Programs can be compiled and executed from within the Micro Focus debugger, Animator V2. To avoid potential inconsistencies when calling routines in the Oracle libraries, select the menu option Compiler Directives, and enter MAKESYN "COMP-5" = "COMP". This step is required because Micro Focus COBOL stores binary numbers in Big Endian format. Oracle libraries expect binary numbers to be stored in Little Endian format (machine format).

Compiling and Using CBLLINK to Link the Program

By default, Micro Focus subprograms are compiled to be dynamically linked at runtime. In such programs, called subprograms, names are resolved and linked at runtime. The name is resolved by looking for the file subprogram.OBJ or subprogram.DLL. The following commands can be used to build a dynamic linking executable:

COBOL sample1 /MAKESYN "COMP-5" = "COMP"
CBLLINK sample1 C:\ORANT\pro80\lib\sqllib80.lib

These commands produce the executable SAMPLE1.EXE, which can be executed like any other Windows NT or Windows 95 program.

Note:

Micro Focus COBOL must be installed on the same system as Pro*COBOL to successfully execute the file.  

Building the Sample Programs

This section describes how to use the basic precompiling, compiling, and linking commands to build sample programs. This section also describes the preparations required for running the Pro*COBOL sample programs. Follow the guidelines when you build Oracle database applications.

Building the Demonstration Tables

To run the Pro*COBOL sample programs, you must have a database account with the username SCOTT and the password TIGER. If no such account exists on your database, create one before running the sample programs.

Additional Information:

See your Oracle Server documentation or your database administrator for more information.  

The SCOTT account must also contain the special demonstration tables EMP and DEPT. If the account does not contain these tables, use the DEMOBLD utility to create them. To run DEMOBLD:

  1. Start the local Oracle Database or SQL*Net software if connecting to a remote database.
  2. Connect to the database as user SCOTT with password TIGER using Server Manager or SQL*Plus.
  3. Run the DEMOBLD.SQL script (in the \ORAWIN95\DBS directory or in the \ORANT\DBS directory).
    Note:

    If you encounter errors, check to make sure that all paths and file names reflect the configuration of your system. The commands to run the sample programs assume that the ORAWIN95\PRO80\COBOL\SAMPLES or ORANT\PRO80\COBOL\SAMPLES subdirectory is the current working directory. You may need to modify the sample link script to reflect the configuration of your system. See Compiling/Linking for WIN32 earlier in this chapter for more information.  

    Note:

    DEMOBLD.SQL contains constraint options in several statements. You may customize it before running the script.  

Building Sample Programs

There is a batch file, MAKEIT.BAT, in the sample directory. This batch file does the following for you:

procob iname=%1.pco ireclen=132
cobol %1 /ganim /litlink makesyn "COMP-5" = "COMP";
cbllink %1 /M%1 c:\orant\pro80\lib\sqllib80.lib

To build sample programs, run this batch file with any sample file:

MAKEIT sample1    [do not provide file extension name]

Sample Files

The following table contains information about sample files.

DIRECTORY   PROGRAM   SOURCE   HOW TO BUILD (Type the following)   DESCRIPTION  

\SAMPLES  

SAMPLE1.EXE  

SAMPLE1.PCO  

MAKEIT SAMPLE1  

See Pro*COBOL Supplement to the Oracle Precompilers Guide  

 

SAMPLE2.EXE  

SAMPLE2.PCO  

MAKEIT SAMPLE2  

 

SAMPLE3.EXE  

SAMPLE3.PCO  

MAKEIT SAMPLE3  

 

SAMPLE4.EXE  

SAMPLE4.PCO  

MAKEIT SAMPLE4  

 

 

SAMPLE6.EXE  

SAMPLE6.PCO  

MAKEIT SAMPLE6  

 

 

SAMPLE7.EXE  

SAMPLE7.PCO  

MAKEIT SAMPLE7  

 

 

SAMPLE8.EXE  

SAMPLE8.PCO  

MAKEIT SAMPLE8  

 

 

SAMPLE9.EXE  

SAMPLE9.PCO  

MAKEIT SAMPLE9  

 

 

SAMPLE10.EXE  

SAMPLE10.PCO  

MAKEIT SAMPLE10  

 

 

SAMPLE11.EXE  

SAMPLE11.PCO  

MAKEIT SAMPLE11  

 

 

SAMPLECO.EXE  

SAMPLECO.PCO  

MAKEIT SAMPLECO  

 




Prev

Next
Oracle
Copyright © 1997 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index