Oracle Pro*COBOL(TM) Getting Started for Windows NT and Windows 95 Release 8.0 A53715-01 |
|
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.
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. |
This section describes how to build Pro*COBOL applications.
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
:
Workaround: During the compilation stage, use the Micro Focus compiler directive:
MAKESYN "COMP-5" = "COMP"
This 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:
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. |
You can build and execute a Micro Focus COBOL application in two ways:
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).
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. |
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.
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:
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. |
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]
The following table contains information about sample files.