This chapter provides information for the Pro*COBOL precompiler specific to the Windows NT, Windows 98, and Windows 2000 operating systems.
This chapter describes only the features of Oracle9i for Microsoft Windows (32-Bit) software that apply to the Windows NT, Windows 2000, Windows XP, and Windows 98 operating systems. Information on Oracle9i Personal Edition software on Windows 98 is not covered in this chapter.
This chapter contains the following sections:
This section describes the Oracle programmatic interface for the COBOL language running on Windows operating systems.
This section contains these topics:
Oracle Corporation expects that any application written for Pro*COBOL release 1.8.x should precompile successfully with Pro*COBOL release 9.2.0. However, some vendor extensions may not be accepted and the application may not precompile successfully when migrating from release 1.8.x to release 9.2.0.
Note:
Pro*COBOL Precompiler for Windows release 1.8.77 is now automatically installed with the Programmer installation type of the Oracle9i Client top-level component. You do not need to use the Custom installation type of the Oracle9i Client top-level component.If you simply want to migrate a release 1.8.x application to release 9.2.0 without using any of the new features of Pro*COBOL release 9.2.0, but the application does not precompile successfully, then report the problem to Oracle Support Services.
Note:
Oracle Corporation recommends that you use release 9.2.0 to develop new applications.Pro*COBOL supports the MERANT Micro Focus NetExpress version 3.1 for 32-bit Windows NT, Windows 2000, and Windows 98.
Note:
Pro*COBOL does not support Object Oriented COBOL (OOCOBOL) specifications.When you install Pro*COBOL, Oracle Universal Installer creates a directory called \precomp
in your ORACLE_BASE\ORACLE_HOME
directory.
Note:
The\precomp
directory can contain files for other products, such as Pro*C/C++.The \precomp
directory contains the directories listed in Table 3-1.
Directory Name | Contents |
---|---|
|
Configuration files |
|
|
|
|
|
SQL scripts for sample programs |
|
Readme files for Pro*COBOL® 9.2.0 |
|
Readme files for Pro*COBOL® 1.8.77 |
|
Library files |
|
Message files |
|
Header files |
The ORACLE_BASE\ORACLE_HOME
\precomp\public
directory contains the Pro*COBOL® header files listed in Table 3-2.
Header File | Description |
---|---|
Contains the Oracle Communications Area (ORACA), which helps you to diagnose runtime errors and to monitor your program's use of various Oracle resources. |
|
|
ORACA5 is the COMP-5 version of ORACA. |
Contains the SQL Communications Area (SQLCA), which helps you to diagnose runtime errors. The SQLCA is updated after every executable SQL statement. |
|
|
SQLCA5 is the COMP-5 version of SQLCA. |
Contains the SQL Descriptor Area (SQLDA), which is a data structure required for programs that use dynamic SQL Method 4. |
|
|
This is the COMP-5 version of SQLDA. |
The ORACLE_BASE\ORACLE_HOME
\precomp\lib
directory contains the library file that you use when linking Pro*COBOL applications. The library file is called orasql9.lib
.
Although all Windows operating systems allow spaces in filenames and directory names, the Oracle Pro*C/C++ and Oracle Pro*COBOL precompilers will not precompile files that include spaces in the file name or directory name. For example, do not use the following formats:
proc iname=test one.pc
proc iname=d:\dir1\second dir\sample1.pc
Users running PROCOB application that are not linked using /LITLINK option and failing at runtime with the error,
Load error: file 'ORASQL8'
need to copy orasql9.dll
to orasql8.dll
in the same directory where orasql9.dll
exists.
This section provides an overview of building Oracle database applications with Pro*COBOL Releases 9.2 and 1.8.77 for Windows operating systems.
This section contains these topics:
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.This section describes the basics of precompiling a Pro*COBOL application.
Use one of the following commands to precompile a file:
For Pro*COBOL Release 9.2, use:
procob filename
For Pro*COBOL Release 1.8.77, use:
procob18 filename
By default, if no extension is provided, Pro*COBOL tries to open filename
.pco
. If the ONAME option is not specified, Pro*COBOL generates a file named filename
.cbl
.
Many useful options are available at precompile time. Included are options that allow you to determine how:
Resources are used
Errors are reported
Input and output are formatted
Cursors are managed
To see a list of available options and their default values, enter the following at the command prompt:
C:\> procob
To see the option, defaults, and the restrictions (if any) on values, enter the following at the command prompt:
C:\> procob /?
Pro*COBOL reads the configuration file for options before processing options supplied at the command line.
For release 9.2.0, the configuration file is called pcbcfg.cfg
. This file is located in the ORACLE_BASE\ORACLE_HOME
\precomp\admin
directory.
For release 1.8.77, the configuration file is called pcccob.cfg
. This file is located in the ORACLE_BASE
\
ORACLE_HOME
\precomp\admin
directory.
The configuration file has the following two options:
COMP–5= yes | no
include=
ORACLE_BASE\ORACLE_HOME
\precomp\public
Check the following to determine whether you should change the value of COMP-5
:
If you are using MERANT Micro Focus COBOL, COMP-5
can be set to yes
(COMP-5=yes
) or no
(COMP-5=no
).
If COMP-5=yes
:
All COMP data items (if they are potential host variables) are converted to COMP–5
.
All data items generated by the precompiler will be declared as COMP–5
.
If COMP-5=no:
The precompiler ignores COMP–5
host variables.
Precompiled files generally do not run on Intel platforms.
For a workaround during the compilation stage, use the MERANT Micro Focus COBOL compiler directive:
MAKESYN "COMP–5" = "COMP"
This statement directs the compiler to treat COMP items as if they are COMP–5
items.
If you are using embedded PL/SQL blocks, do the following:
Enter the SQLCHECK
option and the USERID
string to connect at the precompiling command line.
Specify the SQLCHECK=FULL
option to check the syntax or semantics of embedded SQL statements and PL/SQL blocks.
See Also:
Pro*COBOL Programmer's Guide for an example of a command line string or review the PL/SQL MAKE fileThis section describes how to compile and link Pro*COBOL applications using the MERANT Micro Focus compiler.
You can build and execute a MERANT Micro Focus COBOL application in two ways:
How to Use the IDE (using NetExpress only)
How to Use the Animator (products other than NetExpress)
The COBOL and CBLLINK Commands (all products)
In each of these the COBSQL utility may be used with the following advantages:
Pro*COBOL is run by the MERANT Micro Focus compiler and does not need to be run as a separate step.
Animation is done using the .pco
source file rather than the .cbl
file produced by Pro*COBOL.
The MAKEYSYN
directive is provided automatically and need not be specified manually.
A program generated by Pro*COBOL can be compiled and executed from within the MERANT Micro Focus NetExpress IDE. Simply add the .cbl
file generated by Pro*COBOL to a Net Express project. To avoid potential inconsistencies when calling routines in the Oracle libraries the program should be compiled using the directive:
MAKESYN "COMP-5" = "COMP"
This directive can be specified in the build setting for the source file, the project settings or through a $SET
line at the start of the source file. When you select Rebuild or Rebuild All the IDE generates an executable ready to Run or Animate.
Programs can be compiled and executed from within the MERANT Micro Focus COBOL 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 MERANT Micro Focus COBOL stores binary numbers in Big Endian format. Oracle libraries expect binary numbers to be stored in Little Endian format (machine format).
The COBOL and CBLLINK Commands
COBOL
and CBLLINK
can be used to build programs in two ways, depending on whether the Pro*COBOL runtime is to be statically linked or accessed through a DLL at runtime.
For dynamic linking, the commands are:
COBOL sample1 /MAKESYN"COMP-5"="COMP"; CBLLINK sample1
For static linking, the commands are:
COBOL sample1 /LITLINK /MAKESYN"COMP-5"="COMP";
CBLLINK sample1 ORACLE_BASE\ORACLE_HOME\precomp\lib\orasql9.lib
The previous commands produce sample1.exe
, which can be executed like any other Windows NT, Windows 2000, or Windows 98 program.
Note:
MERANT Micro Focus COBOL must be installed on the same system as Pro*COBOL to successfully execute the file.COBSQL
can be used to simplify preprocessing and debugging. To use COBSQL
, specify the following directive to the COBOL compiler:
PREPROCESS(COBSQL) COBSQLTYPE=ORACLE8 ENDP
or the short form:
P(COBSQL) CSQLT=ORA8 ENDP
COBSQLTYPE
should be set to ORACLE
or ORA
for versions of Pro*COBOL prior to release 8.0. The directive may be set with a $SET
line at the start of the source file, on the COBOL command line, in program build settings or project settings for NetExpress, or with SQL compiler directives settings for Animator. At compile time, COBSQL runs Pro*COBOL as a background task and passes its output to the COBOL compiler together with additional information required to enable Animator to track execution using the .pco
file rather than .cbl
file.
When using COBSQL
there is no need to deal directly with the .cbl
file. Instead, add the .pco
file to a NetExpress project, or open it with Animator.
Oracle provides sample programs to demonstrate the use of Pro*COBOL with Oracle database features. See "Sample Files" for a listing of these programs.
This section describes how to use the basic precompiling, compiling, and linking commands to build the sample programs. This section also describes the preparations required for running the Pro*COBOL sample programs.
To run the Pro*COBOL sample programs, you must have a database account with the username scott
and the password tiger
. If this account does not exist on your database, create one before running the sample programs.
The scott
account must contain the emp
and dept
tables. If the account does not contain these tables, use the demobld.sql
script to create them.
To run the demobld.sql
script:
Pro*COBOL supplies the makeit.bat
file which is listed in the next section, for building a MERANT Micro Focus COBOL sample file:
For release 9.2.0, the batch files are located in ORACLE_BASE\ORACLE_HOME
\precomp\demo\procob2
. For release 1.8.77, the files are located in ORACLE_BASE\ORACLE_HOME
\precomp\demo\procob
.
To build the sample programs:
Run the batch files with any sample file. Do not include the file extension. For example:
C:\ORACLE\ORA90\PRECOMP\DEMO\PROCOB2> makeit sample1
Ensure that all paths and file names reflect the configuration of your system, if you encounter errors when building a sample program.
The commands to run the sample programs assume that the following are the current working directories:
ORACLE_BASE\ORACLE_HOME
\precomp\demo\procob2
directory for release 9.2.0
ORACLE_BASE\ORACLE_HOME
\precomp\demo\procob
directory for release 1.8.77
You may need to modify the sample link script to reflect the configuration of your system. See "Compiling and Linking Pro*COBOL Applications" for more information.
The makeit.bat
for release 9.2.0 contains the following:
procob iname=%1.pco ireclen=132
cobol %1 /anim /litlink makesyn "COMP-5" = "COMP";
cbllink %1 /M%1 ORACLE_BASE\ORACLE_HOME\precomp\lib\orasql9.lib
For release 1.8.77, this batch file contains the following:
procob18 iname=%1.pco ireclen=132
cobol %1 /anim /litlink makesyn "COMP-5" = "COMP";
cbllink %1 /M%1 ORACLE_BASE\ORACLE_HOME\precomp\lib\orasql9.lib
The Pro*COBOL sample files listed in Table 3-3 are located in the ORACLE_BASE\ORACLE_HOME
\precomp\demo\procob2
(release 9.2.0) and/or ORACLE_BASE\ORACLE_HOME
\precomp\demo\procob
(release 1.8.77) directories. The SQL scripts are located in the ORACLE_BASE\ORACLE_HOME
\precomp\demo\sql
directory.
Table 3-3 Pro*COBOL Sample Programs
Sample Program | Description |
---|---|
|
Simple query |
|
Cursor operations |
|
Host tables |
|
Datatype equivalence |
|
Dynamic SQL Method 1 |
|
Dynamic SQL Method 2 |
|
Dynamic SQL Method 3 |
|
Stored procedure call |
|
Stored procedure call |
|
Dynamic SQL Method 4 |
|
Cursor variable operations |
|
Cursor variable operations |
|
|
|
Nested program |
|
Simple query and insert |
|
Host table x (release 8.1.6 and on) |
|
LOB datatypes (release 8.1.6 and on) |
|
LOB datatypes (release 8.1.6 and on) |