Pro*COBOL Precompiler Getting Started
Release 8.0.6 for Windows NT and Windows 95/98

A69941-01

Library

Product

Contents

Index

Prev Next

2
Building Pro*COBOL Applications

This chapter provides an overview of building Oracle database applications with Pro*COBOL release 8.0.6 and 1.8.28 for Windows NT and Windows 95/98. Specific topics discussed are:

Precompiling Pro*COBOL Applications

This section describes the basics of precompiling a Pro*COBOL application. For additional information, see the Getting Started guide and the Release Notes that are provided with the product.

The Pro*COBOL Commands

You can use one of three commands to precompile a file:

Use...  For Pro*COBOL Release... 

PROCOB80 filename 

8.0.6 

PROCOB18 filename 

1.8.28 

PROCOB filename 

8.0.6 or 1.8.28 (depending on the value of the PROCOB_DFLT configuration parameter) 

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.

The PROCOB_DFLT Configuration Parameter

The PROCOB_DFLT configuration parameter indicates which release of Pro*COBOL is started when you use the PROCOB command. There are two valid values: PROCOB80 and PROCOB18. The default value is PROCOB80.


Additional Information:

For instructions on how to modify the PROCOB_DFLT configuration parameter, see Appendix C, "Configuration Parameters and the Registry" in your main Windows-specific getting started manual. 


Precompiler Options

Many useful options are available at precompile time. They let you control how resources are used, how errors are reported, how input and output are formatted, how cursors are managed, and so on.


Additional Information:

See Chapter 7 of the Pro*COBOL Precompiler Programmer's Guide for more information about precompiler options and configuration files. 


Viewing the Available Options

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 /?

MAXLITERAL Option for Fujitsu COBOL

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.

Configuration File

Pro*COBOL reads the configuration file for options before processing options supplied at the command line.

The configuration file has the following two options:

Check the following table to see whether you should change the value of comp5:

If you are using Fujitsu COBOL...  If you are using MERANT Micro Focus COBOL... 

comp5 must be set to yes (comp5=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.

 

comp5 can be set to yes (comp5=yes) or no (comp5=no).

If comp5=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 comp5=no:

  • The precompiler ignores COMP-5 host variables.

  • Precompiled files generally do not run on Intel platforms.

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. 

The INCLUDE option enables the provided .COB files in the ORACLE_HOME\PRO80\COBOL\INCLUDE directory (for release 8.0.6) and the ORACLE_HOME\PRO18\COBOL\INCLUDE directory (for release 1.8.28) to be included without an explicit INCLUDE= option at the command line.

Using Embedded PL/SQL

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

  1. Enter the SQLCHECK option and the USERID string to connect at 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 the Pro*COBOL Precompiler Programmer's Guide or review the PL/SQL MAKE file. 


Compiling and Linking Pro*COBOL Applications

This section describes how to compile and link Pro*COBOL applications using the following compilers:

Fujitsu Compiler

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

Using Fujitsu COBOL PROGRAMMING-STAFF

Programs generated by Pro*COBOL can be compiled and executed from within Fujitsu COBOL PROGRAMMING-STAFF.

To avoid potential inconsistencies when calling routines in the Oracle libraries, use the "COMP5YES" 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).

The compiler option "TEST" must be selected when the COBOL application is compiled.

When you click Build/Rebuild, PROGRAMMING-STAFF 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 WINSVD from the Tools menu of PROGRAMMING-STAFF.

Using the COBOL32 and LINK Commands

For release 8.0.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.exe ORACLE_HOME\pro80\lib\sqllib80.lib

For release 1.8.28, 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.exe ORACLE_HOME\pro18\lib\sqllib80.lib

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

For release 8.0.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.exe ORACLE_HOME\pro80\lib\sqllib80.lib /DEBUG /DEBUGTYPE:COFF

For release 1.8.28, 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.exe ORACLE_HOME\pro18\lib\sqllib80.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".

MERANT Micro Focus Compiler

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:

Using the IDE

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.

Using Animator

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).

Using the COBOL and CBLLINK Commands

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.0.6 the commands are:

 COBOL sample1 /LITLINK /MAKESYN"COMP-5"="COMP";
 CBLLINK sample1 ORACLE_HOME\pro80\lib\sqllib80.lib

For static linking Pro*COBOL 1.8.28 the commands are:

 COBOL sample1 /LITLINK /MAKESYN"COMP-5"="COMP";
 CBLLINK sample1 ORACLE_HOME\pro18\lib\sqllib80.lib

The previous commands produce SAMPLE1.EXE, which can be executed like any other Windows NT or Windows 95/98 program.


Note:

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


Using COBSQL

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.

Building the Sample 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. Follow these 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 user name SCOTT and the password TIGER. If no such account exists on your database, create one before running the sample programs.


Additional Information:

See your Oracle8 documentation or your database administrator for more information. 


The SCOTT account must contain the EMP and DEPT tables. If the account does not contain these tables, use the DEMOBLD script to create them.

To run the DEMOBLD script:
  1. Start the local Oracle database, or SQL*Net software if you are connecting to a remote database.

  2. Start Server Manager or SQL*Plus.

  3. Connect to the database as user name SCOTT with password TIGER.

  4. Run the DEMOBLD.SQL script (located in the ORACLE_HOME\DBS directory).

If you encounter errors, ensure that all paths and file names reflect the configuration of your system. The commands to run the sample programs assume that the ORACLE_HOME\PRO80\COBOL\SAMPLES directory (for release 8.0.6) or the ORACLE_HOME\PRO18\COBOL\SAMPLES directory (for release 1.8.28) is the current working directory. 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 DEMOBLD.SQL script contains constraint options in several statements. You may customize it before running the script.

Building the Sample Programs

Pro*COBOL supplies four batch files: two for Fujitsu COBOL, and two for MERANT Micro Focus COBOL.

Fujitsu Compiler

The sample directories for release 8.0.6 and release 1.8.28 contain a batch file called FJMAKEIT.BAT.

For release 8.0.6, this batch file does 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.exe ORACLE_HOME\pro80\lib\sqllib80.lib

For release 1.8.28, this batch file does 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.exe ORACLE_HOME\pro18\lib\sqllib80.lib

To build the sample programs, run this batch file with any sample file. Do not provide the file extension. For example:

FJMAKEIT sample1

MERANT Micro Focus Compiler

The sample directories for release 8.0.6 and release 1.8.28 contain a batch file called MAKEIT.BAT. For release 8.0.6, this batch file does the following:

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

For release 1.8.28, this batch file does the following:

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

To build the sample programs, run this batch file with any sample file. Do not provide the file extension. For example:

MAKEIT sample1

Sample Files

The ORACLE_HOME\PRO80\COBOL\SAMPLES (for release 8.0.6) and ORACLE_HOME\PRO18\COBOL\SAMPLES (for release 1.8.28) directories contain the following sample files:


Prev Next
Oracle
Copyright © 1999 Oracle Corporation.

All Rights Reserved.

Library

Product

Contents

Index