Oracle Pro*COBOL Getting Started Release 8.0.4 for Windows NT and Windows 95 A55974-01 |
|
This chapter describes how to build Oracle database applications with Pro*COBOL release 8.0 for Windows NT and Windows 95.
Specific topics discussed are:
This section describes the basics of precompiling a Pro*COBOL application.
Use the following syntax to precompile a file with Pro*COBOL version 8.0 for Windows NT and Windows 95:
C:\> PROCOB 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. They let you control how resources are used, how errors are reported, how input and output are formatted, and how cursors are managed.
Additional Information: See Chapter 7 of the Pro*COBOL Precompiler Programmer's Guide for more information about precompiler options and configuration files. |
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 /?
If you are using the Fujitsu COBOL compiler, set the MAXLITERAL option to 160. The Fujitsu 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.
The configuration file is called PCBCFG.CFG. This file is located in the ORACLE_HOME\PRO80 directory.
Pro*COBOL reads the configuration file for options before processing options supplied at the command line.
The configuration file has the following two options:
The INCLUDE option is set to ORACLE_HOME\PRO80\COBOL\INCLUDE in the configuration file so that the provided .COB files under ORACLE_HOME\PRO80\COBOL\INCLUDE can be included without an explicit include= option at the command line.
Check the following table to see whether you should change the value of comp5:
If you are using embedded PL/SQL blocks, do the following:
Additional Information: For an example of a command line string, see the Pro*COBOL Precompiler Programmer's Guide for more information, or review the PL/SQL MAKE file. |
This section describes how to compile and link Pro*COBOL applications using the Fujitsu COBOL and Micro Focus COBOL 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 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. PROGRAMMING-STAFF generates SAMPLE1.EXE and WINSVD debug information when the Build/Rebuild button is clicked. After building the application, you can debug the application using the Interactive Debugger "WINSVD." To launch "WINSVD", choose WINSVD from the Tools menu of PROGRAMMING-STAFF.
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 ORACLE_HOME\pro80\lib\sqllib80.lib /out:sample1.exe
These commands produce the executable SAMPLE1.EXE, which can be executed like any other Windows NT/95 program.
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 ORACLE_HOME\pro80\lib\sqllib80.lib /out:sample1.exe /DEBUG /DEBUGTYPE:COFF
These commands produce the executable SAMPLE1.EXE and WINSVD debug information. Fujitsu COBOL applications can be debugged using the Interactive Debugger "WINSVD."
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 these 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 ORACLE_HOME\pro80\lib\sqllib80.lib
These commands produce the executable SAMPLE1.EXE, which can be executed like any other Windows NT/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 these guidelines when you build Oracle database applications.
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 Oracle Server documentation or your database administrator for more information. |
The SCOTT account must contain the demonstration tables EMP and DEPT. If the account does not contain these tables, use the DEMOBLD script to create them.
To run DEMOBLD:
If you encounter errors, make sure 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 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", earlier in this chapter, for more information.
DEMOBLD.SQL contains constraint options in several statements. You may customize it before running the script.
Pro*COBOL supplies two batch files: one for Fujitsu COBOL, and one for Micro Focus COBOL.
The sample directory contains a batch file called FJMAKEIT.BAT. 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 ORACLE_HOME\pro80\lib\sqllib80.lib /out:%1.exe
To build sample programs, run this batch file with any sample file. Do not provide the file extension. For example:
FJMAKEIT sample1
The sample directory contains a batch file called MAKEIT.BAT. 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
To build sample programs, run this batch file with any sample file. Do not provide the file extension. For example:
MAKEIT sample1
The ORACLE_HOME\PRO80\COBOL\SAMPLES directory contains the following sample files: