Pro*COBOL Precompiler Getting Started Release 8.1.6 for Windows Part Number A73024-01 |
|
This chapter provides an overview of building Oracle database applications with Pro*COBOL release 8.1.6 and 1.8.51 for Windows Platforms. Specific topics discussed are:
This section describes the basics of precompiling a Pro*COBOL application.
See Also:
See the Pro*COBOL Precompiler Programmer's Guide for more information about Pro*COBOL commands, precompiler options, and configuration files. |
You can use one of three commands to precompile a file:
Use... | For Pro*COBOL Release... |
---|---|
procob filename |
8.1.6 |
procob18 filename |
1.8.51 |
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:
To see a list of available options and their default values, enter the following at the MS-DOS command prompt:
C:\> procob
To see the option, defaults, and the restrictions (if any) on values, enter the following at the MS-DOS command prompt:
C:\> procob /?
Pro*COBOL reads the configuration file for options before processing options supplied at the command line.
pcbcfg.cfg
. This file is located in the oracle_base
\
oracle_home
\precomp\admin
directory.
pcccob.cfg
. This file is located in the oracle_base\oracle_home\precomp\admin
directory.
The configuration file has the following two options:
Check the following table to see whether you should change the value of comp5
:
The INCLUDE option enables the provided .COB files in the oracle_base
\
oracle_home
\precomp\public
directory to be included without an explicit INCLUDE= option at the command line.
If you are using the Fujitsu COBOL compiler, set the MAXLITERAL option to 160. The Fujitsu COBOL compiler cannot handle string literals that are longer than 160 characters. You can set this option in the configuration file as well as at the command line. The default value of the MAXLITERAL option is 256.
If you are using embedded PL/SQL blocks, do the following:
For an example of a command line string, see the Pro*COBOL Precompiler Programmer's Guide or review the PL/SQL MAKE file.
See Also:
This section describes how to compile and link Pro*COBOL applications using the following compilers:
You can build and execute a Fujitsu COBOL application in two ways:
Programs generated by Pro*COBOL can be compiled and executed from within Fujitsu COBOL Project Manager.
To avoid potential inconsistencies when calling routines in the Oracle libraries, use the "COMP5=YES"
option. This step is required because binary numbers for COBOL BINARY/COMP data are stored in Big Endian format. Oracle libraries expect binary numbers to be stored in Little Endian format (machine format).
To debug the application using the Interactive Debugger WINSVD when the COBOL application is compiled, the compiler option TEST
must be selected.
When you click Build/Rebuild, COBOL Project Manager generates the executable and WINSVD debug information.
After building the application, you can debug the application using the Interactive Debugger WINSVD. To start WINSVD, choose Debug from the Tools menu of COBOL Project Manager.
For release 8.1.6, the following commands can be used to build an executable:
COBOL32 -M sample1.cbl LINK sample1.obj f3bicimp.lib libc.lib kernel32.lib user32.lib /out:sample1.exeoracle_base
\
oracle_home
\precomp\lib\orasql8.lib
For release 1.8.51, the following commands can be used to build an executable:
COBOL32 -M sample1.cbl LINK sample1.obj f3bicimp.lib libc.lib kernel32.lib user32.lib /out:sample1.exeoracle_base
\
oracle_home
\precomp\lib\orasql8.lib
These commands produce sample1.exe
, which can be executed like any other Windows NT or Windows 95/98 program.
For release 8.1.6, the following commands can be used to build an executable for debugging:
COBOL32 -M -Dt sample1.cbl LINK sample1.obj f3bicimp.lib libc.lib kernel32.lib user32.lib /out:sample1.exeoracle_base
\
oracle_home
\precomp\lib\orasql8.lib /DEBUG /DEBUGTYPE:COFF
For release 1.8.51, the following commands can be used to build an executable for debugging:
COBOL32 -M -Dt sample1.cbl LINK sample1.obj f3bicimp.lib libc.lib kernel32.lib user32.lib /out:sample1.exeoracle_base
\
oracle_home
\precomp\lib\orasql8.lib /DEBUG /DEBUGTYPE:COFF
These commands produce sample1.exe
, as well as WINSVD debug information. Fujitsu COBOL applications can be debugged using the Interactive Debugger WINSVD.
You can build and execute a MERANT Micro Focus COBOL application in two ways:
In each of these the COBSQL utility may be used with the following advantages:
.pco
source file rather than the .cbl
file produced by Pro*COBOL.
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 via 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).
COBOL and CBLLINK can be used to build programs can be 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 Pro*COBOL 8.1.6 the commands are:
COBOL sample1 /LITLINK /MAKESYN"COMP-5"="COMP"; CBLLINK sample1oracle_base
\
oracle_home
\precomp\lib\orasql8.lib
For static linking Pro*COBOL 1.8.51 the commands are:
COBOL sample1 /LITLINK /MAKESYN"COMP-5"="COMP"; CBLLINK sample1oracle_base
\
oracle_home
\precomp\lib\orasql8.lib
The previous commands produce sample1.exe
, which can be executed like any other Windows NT or Windows 95/98 program.
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 user name 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.
demobld.sql
script. For example:
SQL> @ORACLE_BASE\ORACLE_HOME\SQLPLUS\DEMO\DEMOBLD.SQL
Pro*COBOL supplies batch files for building the sample files:
For release 8.1.6, the batch files are located in oracle_base
\
oracle_home
\precomp\demo\procob
. For release 1.8.51, the files are located in oracle_base
\
oracle_home
\precomp\demo\procob
2.
To build the sample programs, run the batch files with any sample file. Do not provide the file extension. For example:
C:\ORACLE\ORA81\PRECOMP\DEMO\PROCOB2> fjmakeit sample1 C:\ORACLE\ORA81\PRECOMP\DEMO\PROCOB2> makeit sample1
If you encounter errors when building the sample programs, ensure that all paths and file names reflect the configuration of your system. 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 8.1.6
oracle_base
\
oracle_home
\precomp\demo\procob
directory for release 1.8.51
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 fjmakeit.bat
for release 8.1.6 contains the following:
procob iname=%1.pco ireclen=132 maxliteral=160 cobol32 -M %1.cbl link %1.obj f3bicimp.lib libc.lib kernel32.lib user32.lib /out:%1.exeoracle_base
\
oracle_home
\precomp\lib\orasql8.lib
For release 1.8.51, this batch file contains the following:
procob18 iname=%1.pco ireclen=132 maxliteral=160 cobol32 -M %1.cbl link %1.obj f3bicimp.lib libc.lib kernel32.lib user32.lib /out:%1.exeoracle_base
\
oracle_home
\precomp\lib\orasql8.lib
The makeit.bat
for release 8.1.6 contains the following:
procob iname=%1.pco ireclen=132 cobol %1 /anim /litlink makesyn "COMP-5" = "COMP"; cbllink %1 /M%1oracle_base
\
oracle_home
\precomp\lib\orasql8.lib
For release 1.8.51, this batch file contains the following:
procob18 iname=%1.pco ireclen=132 cobol %1 /ganim /litlink makesyn "COMP-5" = "COMP"; cbllink %1 /M%1oracle_base
\
oracle_home
\precomp\lib\orasql8.lib
The Pro*COBOL sample files listed in Table 2-1, "Pro*COBOL Sample Programs" are located in the oracle_base
\
oracle_home
\precomp\demo\procob2
(release 8.1.6) and/or oracle_base
\
oracle_home
\precomp\demo\procob
(release 1.8.51) directories. The SQL scripts are located in the oracle_base
\
oracle_home
\precomp\demo\sql
directory.
|
![]() Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
|