Skip Headers
Oracle® Database Administrator's Reference
10g Release 2 (10.2) for hp OpenVMS

Part Number B25416-02
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

6 Using Oracle Precompilers and the Oracle Call Interface

This chapter describes how to use Oracle Precompilers and the Oracle Call Interface.

It contains the following topics:

6.1 Overview of Oracle Precompilers

Oracle Precompilers are application development tools used to combine SQL statements from an Oracle Database with programs written in a high-level language. Oracle Precompilers are compatible with ANSI SQL and are used to develop open, customized applications that run with the Oracle Database or any other ANSI SQL database management system.

See Also:

Programmer's Guide to the Oracle Precompilers for general information about Oracle Precompilers and interface features

6.1.1 Precompiler Configuration Files

System configuration files for the Oracle Precompilers are located in the ORA_ROOT:[PRECOMP.ADMIN]directory.

Table 6-1 lists the names of the system configuration files for each precompiler. These files are currently empty. Their purpose is to specify command-line parameters, such as the include directories.

Table 6-1 System Configuration Files for Oracle Precompilers

Product Configuration File

Pro*C/C++

PCSCFG.CFG

Pro*COBOL

PCBCFG.CFG

Pro*FORTRAN

PCCFOR.CFG

Object Type Translator

OTTCFG.CFG


6.1.2 Precompiler Executables

Table 6-2 lists products and their corresponding executable names as well as the OpenVMS symbols associated with them. These images are found in the ORA_ROOT:[BIN] directory.

6.1.2.1 Precompiler README files

Precompiler README files for the various languages are located in ORA_ROOT:[PRECOMP.DOC.LANGUAGE].

Table 6-2 lists precompiler products, executable names and OpenVMS symbols.

Table 6-2 Executable Names and OpenVMS Symbols for Precompiler Products

Product Executable OpenVMS Symbol

Pro*C/C++

PROC.EXE

PROC

Pro*COBOL

PROCOB.EXE

PROCOB

Pro*FORTRAN

PROFOR.EXE

PROFOR

Object Type Translator

OTT.COM

OTT


6.1.3 Precompiler README Files

Table 6-3 lists the location of the precompiler README files. The README files describe changes made to the precompiler since the last release.

Table 6-3 Location of Precompiler README Files

Precompiler README File

Pro*C/C++

ORA_ROOT:[PRECOMP.DOC.PROC]README.DOC

Pro*COBOL

ORA_ROOT:[PRECOMP.DOC.PROCOB2]README.DOC

Pro*FORTRAN

ORA_ROOT:[PRECOMP.DOC.PRO1X]README.TXT


6.1.4 Issues Common to All Precompilers

The following issues are common to all precompilers.

Conversion for Uppercase to Lowercase

In languages other than the C programming language, the compiler converts an uppercase function or subprogram name to lowercase. This can cause the following error message to be displayed:

No such user exists

If this error message is displayed, then verify that the function or subprogram name in the option file matches the case used in the IAPXTB table.

Vendor Debugger Programs

Precompilers and vendor-supplied debuggers can be incompatible. Oracle does not guarantee that a program run using a debugger performs the same way when it is run without the debugger.

Values of the IRECLEN and ORECLEN Parameters

The IRECLEN and ORECLEN parameters do not have maximum values.

6.1.5 Static and Dynamic Linking

You can statically or dynamically link Oracle libraries with precompiler and OCI applications. With static linking, the libraries and objects of the whole application are linked together into a single executable program. As a result, application executables can become very large.

With dynamic linking, the executing code is partly stored in the executable program and partly stored in libraries that are loaded with the application at run time, or later, after the program starts, when referenced. These libraries are called shareable libraries or dynamic libraries. The benefits of dynamic linking are:

  • Reduced disk space requirements: More than one application or invocation of the same application can use the same dynamic library.

  • Reduced main memory requirements: The same dynamic library image is loaded into main memory only once and it can be shared by more than one application, if the library is installed as a shared image.

6.1.6 Client Shared and Static Libraries

The client shared and static libraries are located in the ORA_ROOT:[LIB32] directory. If you use the Oracle provided installer or link scripts to link an application, then the client shared library is linked by default. The necessary logical name for the client shared library is defined by default when the client environment is set up.

The client shared library is created automatically during installation. If you need to re-create it, then perform the following:

  1. Exit all client applications that use the client shared library, including all Oracle Database client applications.

  2. Log in as the oracle user, and enter the following command:

    @ORA_ROOT:[BIN]RELINK CLIENT_SHAREDLIB
    

If an application links with the client shared library and needs to be installed as a known image, OpenVMS requires that an executive mode logical name point to the shared library.

If there is only one Oracle Installation on the system, add the following commad to the system startup file:

$ DEFINE/SYSTEM/EXEC LIBCLNTSH full_Path/LIBCLNTSH.SO

Do not use concealed logical names, including ORA_ROOT, in the full_path specification.If you have multiple Oracle installations on the system, you need to uniquely identify the client shared library for the installation in question. Do the following:

  1. Copy LIBCLNTSH.SO to LIBCLNTSH_unique_id.SO, where the unique_id is a string not common to any other Oracle installation on the system.

  2. Install the shared library LIBCLNTSH_unique_id.SO. Refer to ORA_ROOT:[000000]INSORACLE.COM for the correct syntax.

  3. Define the logical name LIBCLNTSH_unique_id as follows:

    $ DEFINE/SYSTEM/EXEC LIBCLNTSH_unique_id full_path/LIBCLNTSH_unique_id.SO
    
    

    Again, do not use concealed logical names in the full_path.

  4. Link your application with this uniquely named client shared library. You need to modify the file ORA_ROOT:[RDBMS]ORA_CLIENT.OPT to do this

Note that steps 2 and 3 the previous procedure should be added to the system startup command file.

6.2 Precompiling

You start the precompilers and Object Type Translators by using the OpenVMS symbols specified in Table 6-2.

This section covers the following aspects of precompiling:

6.2.1 Syntax

The syntax of the command for precompiling source files is as follows:

$ VMS_symbol INAME=filename OPTION=value ... 

In this syntax:

  • VMS_symbol is the OpenVMS symbol for the precompiler

  • filename is the name of the source file you want to precompile

  • OPTION is the precompiling option available for the Oracle Precompilers program You can supply any number of option-value pairs, separated by a space

  • value is the value of the option specified

Example 6-1 Syntax for Precompiling

$ PROFOR INAME=MYFILE HOST=FORTRAN INCLUDE=ORA_PRECOMP

The HOST=language identifier is optional. For example, the following command is also valid:

$ PROFOR INAME=MYFILE INCLUDE=ORA_PRECOMP

The INCLUDE option gives the path to the directory that contains the precompiler include files. If this option is not provided, then the path to the directory in which the include files are distributed is taken as the default.

You can display a list of options and their values (if you have an Oracle instance running) by entering the required symbol name. For example:

$ PROFOR

The system displays a list of options and their values for Pro*FORTRAN.

6.2.2 Guidelines and Restrictions

The following guidelines and restrictions apply to precompiling:

Using the OpenVMS Debugger

Precompiler programs can be run with the OpenVMS debugger by compiling the program with the /DEBUG qualifier and linking using the D option with the LNPROlanguage symbol.

Using Event Flags

If you use OpenVMS event flags in the source code, then ensure that none of them are numbered 1 through 18 before compiling the code for use with Oracle Database. Event flags 1 through 18 are reserved for the server.

Migrating Applications Developed with Pro*C Compilers

When migrating applications developed with Pro*C precompilers, each application must have a unique SQLCA, ORACA, or both. Oracle recommends that you insert the following definition in one module to produce a defining declaration of the SQLCA structure:

#DEFINE SQLCA_STORAGE_CLASS GLOBALDEF

Each of the other modules should have the following global reference to product referencing declarations.

#DEFINE SQLCA_STORAGE_CLASS GLOBALREF

This line must precede inclusion of SQLCA.H.

6.3 Compiling

You must ensure that the conditions described in the following are met when using the precompilers listed in this section:

6.3.1 Compiler Options Used to Compile Oracle Database 10g

Oracle Database 10g is compiled with as few deviations from the default C compiler options as possible and with minimal use of pragma statements.

For the DEC C compiler on OpenVMS, the compilation options are as follows:

/DECC/NOSTANDARD/DEBUG=TRACE/PREFIX=ALL/GRAN=LONG/NAMES=AS_IS/
FLOAT=IEEE/MODE=DENORM/EXTERN=STRICT_REFDEF/NOANSI_ALIAS

If you compile the code with /DEBUG=TRACE, then line numbers in the modules are displayed, as required, in Oracle Database 10g stack trace listings.

6.3.2 Floating Point Format

Oracle Database 10g is compiled with the IEEE floating point format supported by the C compiler. The conversion routines within Oracle Database 10g translate operating system-specific floating point numbers into Oracle Database 10g internal floating point representation.

This is a change from Oracle Database 9i release 2 for OpenVMS. If you had an application that depended on non-IEEE defaults, then you may need to recompile.

6.3.2.1 Application Compatibility for Floating Point Format

With release 10.1.0.3.0 of Oracle Database 10g for OpenVMS, the floating point format supported by Oracle code is the IEEE floating point format.

Earlier releases of the product supported the default native floating format of the C compiler, which was the D float for single and G float for double.

6.3.3 Pro*COBOL

You must specify the /ANSI option when you compile the Pro*COBOL demonstration source files.

6.4 Linking

Use the following command procedures to link object files:

This section discusses the following aspects of linking:

6.4.1 Syntax

To link compiled PROlanguage object files, use the LNPROlanguage symbol.

Table 6-4 provides a description of each argument.

Table 6-4 Linking Precompiled Programs

Argument Description

language

Abbreviation for the programming language you are using

For example: C, COB, or FOR

executable

Name of the executable image to be created

The file name extension is optional.

objectfilelist

Comma-delimited list of object files and libraries

If this list is longer than one line, then use the continuation character, the dash sign (-). Note that there are no spaces in this specification.

options

List of options with no separators needed:

D links with the OpenVMS DEBUG utility.

F produces a full map.

M creates a link map.

X produces a link map with cross-references.


Example To link MYOBJ and SUB into a COB executable called MYFILE and to specify options D and M, use the following command:

$ LNPROCOB MYFILE MYOBJ,SUB DM

6.4.2 Linking Precautions

Oracle Database 10g is compiled with the IEEE floating point format supported by the C compiler.

Applications that were compiled with earlier releases of the Oracle Database 10g for OpenVMS should not be directly linked with the static or dynamic libraries that are provided with the current release. Although they may link correctly, run-time results may be unpredictable. Oracle recommends that all such applications be either recompiled or continue to be run from a 9.2 client environment connecting to Oracle Database 10g through Oracle Net Services.

6.4.3 Guidelines for Linking

Apply the guidelines defined in this section when using link scripts.

Using the Demonstrations

Several sample programs, covering different aspects of precompiler programs, are provided in the PROlanguage demonstration directories. Oracle recommends that you precompile, compile, and link these programs. You can use these programs as models for new programming efforts.

Before running the PROC demonstrations, ensure that you define the following environment setting:

$ DEFINE SYS DECC$LIBRARY_INCLUDE

Compatibility with ANSI Standard Compilers

Oracle makes every effort to ensure compatibility with the ANSI standard compilers supported by Hewlett-Packard. However, new functionality available with the latest compilers may not yet be supported.

Linking Sharable Images with LOUTL.COM

You may link a sharable image against Oracle Database 10g code using the D option with LOUTL.COM or one of the LNPRO*.COM link scripts that internally calls LOUTL.COM.

You may want to install the sharable image in system memory with a command similar to the following:

$ INSTALL CREATE/SHARE/WRITE/HEADER shareable_image

To avoid receiving an error when you link the main program, include the sharable image in the link list.

Watching the Link Command Passed to LOUTL

LOUTL looks for the symbol SHOW_LINK_COMMAND, which lets you see the LINK command that is constructed by LOUTL.COM without waiting for a link map. If this symbol is defined to any non-null value, then LOUTL displays the link command. If this symbol is undefined, then LOUTL issues the link command silently.

Using LNK$LIBRARY When Linking Against Oracle

All Oracle link scripts call the LINK command with the /NOUSERLIBRARY qualifier. This means that any libraries you want to link automatically using the LNK$LIBRARY logical names are ignored. Therefore, explicitly include these libraries in the link line or by using an option file.

6.5 Pro*C/C++ Precompiler

Before you use the Pro*C/C++ precompiler, verify that the correct version of the operating system compiler is properly installed.

See Also:

This section discusses the following topics:

6.5.1 Pro*C/C++ Demonstrations

Demonstrations are provided to show the features of the Pro*C/C++ precompiler. There are three types of demonstrations: C, C++, and Object programs. All the demonstrations are located in the ORA_ROOT:[PRECOMP.DEMO.PROC] directory. By default, all programs are dynamically linked with the client shared library.

To run, the programs require the demonstration tables created by the ORA_ROOT:[SQLPLUS.DEMO]DEMOBLD.SQL script to exist in the SCOTT schema with the password TIGER.

Note:

You must unlock the SCOTT account and set the password before creating the demonstrations.

For example, the following are the steps to precompile, compile, and link the sample1 demonstration program:

The DBA of the site must install Oracle Database Sample Schemas and unlock SCOTT/TIGER. For example:

$ @ORA_ROOT:[000000]ORAUSER sid
$ SQLPLUS "/ AS SYSDBA"

Note:

The following is for illustrative purposes only. Contact the DBA of the site for information about the required security settings.
SQL> ALTER USER SCOTT ACCOUNT UNLOCK;
SQL> ALTER USER SCOTT IDENTIFIED BY TIGER;
SQL> EXIT
$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.PROC]

Note:

The following is for illustrative purposes only. Contact the system manager of the site for information about the required C programming language compiler header location.
$ PROC INAME=SAMPLE1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")')
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /
NAMES=AS_IS /FLOAT=IEEE /INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] SAMPLE1.C
$ LNPROC SAMPLE1
$ RUN SAMPLE1
7934
0

Use similar commands for the demonstration programs SAMPLE2, 3, 6, 7, 8, 12, SQLVCP.PC and SCDEMO2.PC. This procedure does not require data entry.

To create the Proc*C SAMPLE4 demonstration, additional parameters and data entry are required as follows:

Note:

The following is for illustrative purposes only. Contact the system manager of the site for information about the required C programming language compiler definitions.
$ DEFINE SYS DECC$LIBRARY_INCLUDE
$ PROC INAME=SAMPLE4 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',ORA_ROOT:[RDBMS.PUBLIC])
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /
NAMES=AS_IS /FLOAT=IEEE /
INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC]) SAMPLE4.C
$ LNPROC SAMPLE4
$ RUN SAMPLE4
y
l
i
dd
sample4.pc
l
r
dd
tsamp4.pc
d
dd
l
q

Note:

SAMPLE5.PC is not supported.

Some demonstrations require you to run a SQL script that is located in the ORA_ROOT:[PRECOMP.DEMO.SQL] directory. If you do not run the script, then a message requesting you to run it is displayed. For example, to create the SAMPLE9 demonstration program and run the required ORA_ROOT:[PRECOMP.DEMO.SQL]CALLDEMO.SQL script, run the following commands:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]CALLDEMO.SQL
$ PROC INAME=SAMPLE9 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")') SQLCHECK=FULL USER=SCOTT/TIGER
$ CC /DECC/NOSTANDARD/DEBUG=TRACE/OPTIMIZE/PREFIX=ALL/GRAN=LONG/NAMES=AS_IS/
FLOAT=IEEE/INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] SAMPLE9.C
$ LNPROC SAMPLE9
$ RUN SAMPLE9
30

Running the SAMPLE10 demonstration requires additional data entry as follows:

$ RUN SAMPLE10
scott
tiger
select * from dept;
select * from emp;
exit

Running the SAMPLE11 demonstration requires additional SQL statements, parameters, and data entry as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]SAMPLE11.SQL
$ PROC INAME=SAMPLE11 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")') SQLCHECK=FULL USER=SCOTT/TIGER
$ CC /DECC/NOSTANDARD/DEBUG=TRACE/OPTIMIZE/PREFIX=ALL/GRAN=LONG/
NAMES=AS_IS/FLOAT=IEEE/INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] SAMPLE11.C
$ LNPROC SAMPLE11
$ RUN SAMPLE11
10
20
30
40
0

Running the ANSIDYN1 demonstration requires additional parameters and data entry:

$ PROC INAME=ANSIDYN1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")') MODE=ANSI
$ CC /DECC/NOSTANDARD/DEBUG=TRACE/OPTIMIZE/PREFIX=ALL/GRAN=LONG/
NAMES=AS_IS/FLOAT=IEEE/INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] ANSIDYN1.C
$ LNPROC ANSIDYN1
$ RUN ANSIDYN1
scott
tiger
SELECT empno, ename, mgr FROM emp;
SELECT deptno, dname FROM dept;
EXIT;

Running the ANSIDYN2 demonstration requires additional parameters and data entry as follows:

$ PROC INAME=ANSIDYN2 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")') DYNAMIC=ANSI
$ CC /DECC/NOSTANDARD/DEBUG=TRACE/OPTIMIZE/PREFIX=ALL/GRAN=LONG/
NAMES=AS_IS/FLOAT=IEEE/INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] ANSIDYN2.C
$ LNPROC ANSIDYN2
$ RUN ANSIDYN2
scott
tiger
SELECT empno, ename, mgr FROM emp;
1
SELECT deptno, dname FROM dept;
1
EXIT;
10
20
0

Running the CV_DEMO demonstration requires additional SQL statements, parameters, and data entry as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]CV_DEMO.SQL
$ PROC INAME=CV_DEMO INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")') SQLCHECK=FULL USER=SCOTT/TIGER
$ CC /DECC/NOSTANDARD/DEBUG=TRACE/OPTIMIZE/PREFIX=ALL/GRAN=LONG/
NAMES=AS_IS/FLOAT=IEEE/INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] CV_DEMO.C
$ LNPROC CV_DEMO
$ RUN CV_DEMO

Running the LOBDEMO1 demonstration requires additional SQL statements, parameters, and data entry as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]LOBDEMO1.SQL
$ PROC INAME=LOBDEMO1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
ORA_ROOT:[RDBMS.PUBLIC]) SQLCHECK=FULL USER=SCOTT/TIGER
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS /
FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC],ora_root:[rdbms.public]) LOBDEMO1.C
$ LNPROC LOBDEMO1
$ RUN LOBDEMO1
L
G
555001212
I
123456789
John Doe
A
123456789
2
Q

Alternatively, LOBDEMO1.PC can be precompiled with by setting cpool to the values yes as follows:

$ PROC INAME=LOBDEMO1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
ORA_ROOT:[RDBMS.PUBLIC]) SQLCHECK=FULL USER=SCOTT/TIGER CPOOL=YES

The remainder of the demonstration is the same as shown earlier.

Running the ORACA demonstration requires additional SQL statements and data entry as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]ORACATST.SQL
$ PROC INAME=ORACA INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")')
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /
NAMES=AS_IS /FLOAT=IEEE /INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] ORACA.C
$ LNPROC ORACA
$ RUN ORACA
10

Running the SCDEMO1 demonstration requires additional parameters and data entry as follows:

$ PROC INAME=SCDEMO1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")')
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /
NAMES=AS_IS /FLOAT=IEEE /INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC] SCDEMO1.C
$ LNPROC SCDEMO1
$ SCDEMO1 :== $ORA_ROOT:[PRECOMP.DEMO.PROC]SCDEMO1.EXE
$ SCDEMO1 SCOTT/TIGER
SELECT ENAME, JOB FROM EMP
1
1
y
4
n
EXIT

The CPDEMO1.PC and CPDEMO2.PC demonstrations are not supported.

To precompile, compile, and link the C++ CPPDEMO1.PC demonstration program, run the following commands:

$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.PROC]

Note:

The following is for illustrative purposes only. Contact the system manager of the site for information about the required header locations for the C and C++ programming language compilers.
$ PROC INAME=CPPDEMO1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
SYS$COMMON:[CXX$LIB.REFERENCE.CXXL$ANSI_DEF]) DEFINE=_RWSTD_USE_CONFIG CODE=CPP
$ CXX /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS /FLOAT=IEEE /
INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) CPPDEMO1.C/DEFINE=(_RWSTD_USE_CONFIG)
$ LNPROC CPPDEMO1 CPPDEMO1 CPP
$ RUN CPPDEMO1
7369
7499
0

To create the Pro*C++ CPPDEMO2.PC demonstration program which also includes EMPCLASS.PC, run commands similar to those of CPPDEMO1.PC, but without data entry, as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]CPPDEMO2.SQL
$ PROC INAME=EMPCLASS INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
SYS$COMMON:[CXX$LIB.REFERENCE.CXXL$ANSI_DEF]) CODE=CPP SQLCHECK=FULL USER=SCOTT/TIGER
$ CXX /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /
NAMES=AS_IS /FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) EMPCLASS.C
$ PROC INAME=CPPDEMO2 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
SYS$COMMON:[CXX$LIB.REFERENCE.CXXL$ANSI_DEF]) CODE=CPP
$ CXX /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS 
/FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) CPPDEMO2.C
$ LNPROC CPPDEMO2 CPPDEMO2,EMPCLASS CPP
$ RUN CPPDEMO2

To create the Pro*C++ CPPDEMO3.PC demonstration program, run commands similar to those of CPPDEMO1.PC. This procedure does not require data entry.

To precompile, compile, and link the OTT COLDEMO1.PC demonstration program, run the following commands:

$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.SQL]
$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]COLDEMO1.SQL
$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.PROC]
$ @ORA_ROOT:[JDBC]JDBC_SETUP_JDK12.COM
$ OTT COLDEMO1 CODE=C USERID=SCOTT/TIGER INTYPE=COLDEMO1.TYP OUTTYPE=COLDEMO1O.TYP HFILE=COLDEMO1.H
$ PROC INAME=COLDEMO1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
ORA_ROOT:[RDBMS.PUBLIC]) INTY=COLDEMO1O.TYP
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS /
FLOAT=IEEE /INCLUDE=([],ORA_ROOT:[PRECOMP.PUBLIC],ORA_ROOT:[RDBMS.PUBLIC]) COLDEMO1.C
$ LNPROC COLDEMO1
$ RUN COLDEMO1
A
Q

Optionally, COLDEMO1.PC may also be precompiled with "cpool=yes" as follows:

$ PROC INAME=COLDEMO1 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
ORA_ROOT:[RDBMS.PUBLIC]) INTY=COLDEMO1O.TYP CPOOL=YES

To run the Pro*C NAVDEMO1.PC, OBJDEMO1.PC OTT demonstrations, run commands similar to COLDEMO1.PC. This procedure does not require data entry.

To precompile, compile, and link the OTT COLDEMO2.PC demonstration program, run the following commands:

$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.SQL]
$ SQLPLUS/NOLOG
SQL> CONNECT SCOTT/TIGER
SQL> DROP TABLE COUNTY_TBL;
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]COLDEMO2.SQL
$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.PROC]
$ @ORA_ROOT:[JDBC]JDBC_SETUP_JDK12.COM
$ OTT COLDEMO2 CODE=C USERID=SCOTT/TIGER INTYPE=COLDEMO2.TYP OUTTYPE=COLDEMO2O.TYP HFILE=COLDEMO2.H
$ PROC INAME=COLDEMO2 INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
ORA_ROOT:[RDBMS.PUBLIC]) INTY=COLDEMO2O.TYP
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /
OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS /FLOAT=IEEE /
INCLUDE=([],ORA_ROOT:[PRECOMP.PUBLIC],ORA_ROOT:[RDBMS.PUBLIC]) COLDEMO2.C
$ LNPROC COLDEMO2
$ RUN COLDEMO2
Y
1999
A
Q

6.5.2 Pro*C/C++ User Programs

To create and run a program, enter commands similar to the following:

$ PROC INAME=objfile1 INCLUDE=('f$trnlnm("DECC$LIBRARY_INCLUDE")')
$ PROC INAME=objfile2 INCLUDE=('f$trnlnm("DECC$LIBRARY_INCLUDE")')
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS 
/FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) objfile1.c
$ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS 
/FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) objfile2.c
$ LNPROCOB OBJFILE1 OBJFILE1,OBJFILE2
$ RUN OBJFILE1

In this example:

  • OBJFILEN is the C source file for the program

  • the first LNPROC parameter is the executable program

For example, to create the program MYPROG from the Pro*C/C++ source file MYPROG.PC, enter one of the following commands, depending on the source and the type of executable that you want to create:

  • For C source, linked with the client shared library, enter the following commands:

    $ PROC INAME=MYPROG INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")')
    $ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /
    NAMES=AS_IS /FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) MYPROG.C
    $ LNPRO MYPROG
    
    
  • For C source, linked with the client object library, enter the following commands:

    $ PROC INAME=MYPROG INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")')
    $ CC /DECC /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /
    NAMES=AS_IS /FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) MYPROG.C
    $ DEFINE ORA_OLB ORA_ROOT:[LIB32],ORA_RDBMS
    $ DEFINE ORA_UTIL ORA_OLB 
    $ LOUTL MYPROG MYPROG MYPROG NS
    
    
  • For C++ source, linked with the client shared library, enter the following commands:

    $ PROC INAME=myprog INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
    SYS$COMMON:[CXX$LIB.REFERENCE.CXXL$ANSI_DEF]) CODE=CPP
    $ CXX /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS /
    FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) MYPROG.C
    $ LNPROC MYPROG MYPROG CPP
    
    
  • For C++ source, linked with the client object library, enter the following commands:

    $ PROC INAME=MYPROG INCLUDE=('F$TRNLNM("DECC$LIBRARY_INCLUDE")',
    SYS$COMMON:[CXX$LIB.REFERENCE.CXXL$ANSI_DEF]) CODE=CPP
    $ CXX /NOSTANDARD /DEBUG=TRACE /OPTIMIZE /PREFIX=ALL /GRAN=LONG /NAMES=AS_IS /
    FLOAT=IEEE /INCLUDE=(ORA_ROOT:[PRECOMP.PUBLIC]) MYPROG.C
    $ DEFINE ORA_OLB ORA_ROOT:[LIB32],ORA_RDBMS
    $ DEFINE ORA_UTIL ORA_OLB 
    $ LOUTL MYPROG MYPROG MYPROG NS CPP
    
    

6.5.3 Operating System (OpenVMS) Header Files

If you want to upgrade the C/C++ libraries, then you have to refresh Oracle's local copies of these files. This is achieved using the following commands:

$ SET DEFAULT ORA_ROOT:[PRECOMP]
$ @BUILD_DIRS

6.6 Pro*COBOL Precompiler

Table 6-5 shows the naming conventions for the Pro*COBOL precompiler.

Table 6-5 Pro*COBOL Naming Conventions

Item Pro*COBOL

Executable

PROCOB.EXE

demo directory

PROCOB2


Pro*COBOL supports static linking with the static client object library, ORA_ROOT:[LIB32]LIBCLNTST10.OLB, as well as dynamic linking with the dynamically loadable client shared library, ORA_ROOT:[LIB32]LIBCLNTSH.SO.

This section discusses the following topics:

6.6.1 Pro*COBOL Oracle Runtime System

The RUN command or a symbol may be used to invoke Pro*COBOL programs. For example:

$ RUN SAMPLE1

If the program requires input parameters, then define a symbol for the executable and then use the symbol to invoke the program. For example:

$ MYPROG  :== $ORA_ROOT:[BIN]MYPROG.EXE
$ MYPROG parameter_list

6.6.2 Pro*COBOL Demonstrations

Demonstrations are provided to show the features of the Pro*COBOL precompiler. These programs are located in the ORA_ROOT:[PRECOMP.DEMO.PROCOB2] directory. By default, all programs are linked with the client shared library.

To run the programs, the demonstration tables created by the ORA_ROOT:[SQLPLUS.DEMO]DEMOBLD.SQL script must exist in the SCOTT schema with the password TIGER.

Note:

You must unlock the SCOTT account and set the password before creating the demonstrations.

To precompile, compile, and link the SAMPLE1 demonstration program for Pro*COBOL, run the following commands:

Note:

The DBA of the site must install Oracle Database Sample Schemas and unlock SCOTT/TIGER. The following is for illustrative purposes only. Contact the DBA of the site for information about the required security settings.
$ @ORA_ROOT:[000000]ORAUSER sid
$ SQLPLUS "/ AS SYSDBA"
SQL> ALTER USER SCOTT ACCOUNT UNLOCK;
SQL> ALTER USER SCOTT IDENTIFIED BY TIGER;
SQL> EXIT
$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.PROCOB2]
$ PROCOB INAME=SAMPLE1
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE SAMPLE1.COB
$ LNPROCOB SAMPLE1
$ RUN SAMPLE1
7934
0

To create the Pro*COBOL SAMPLE2, 3, 6, 7, 8, 14 demonstrations, run commands similar to SAMPLE1. No data entry is required.

Running the SAMPLE4 demonstration requires the following data entry:

$ RUN SAMPLE4
y
7499
0

Note:

SAMPLE5.PCO is not supported.

Some demonstrations require you to run a SQL script that is located in the ORA_ROOT:[PRECOMP.DEMO.SQL] directory. If you do not run the script, then a message requesting you to run it is displayed. For example, to create the SAMPLE9 demonstration program and run the required ORA_ROOT:[PRECOMP.DEMO.SQL]CALLDEMO.SQL script, enter:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]CALLDEMO.SQL
$ PROCOB INAME=SAMPLE9 SQLCHECK=FULL USERID=SCOTT/TIGER PICX=VARCHAR2
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE SAMPLE9.COB
$ LNPROCOB SAMPLE9
$ RUN SAMPLE9
10

Running the SAMPLE10 demonstration requires additional parameters and data entry:

$ PROCOB INAME=SAMPLE10 INCLUDE=ORA_ROOT:[PRECOMP.PUBLIC]
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE SAMPLE10.COB
$ LNPROCOB SAMPLE10
$ RUN SAMPLE10
scott
tiger
SELECT empno FROM emp

Running the SAMPLE11 demonstration requires additional SQL statements, parameters, and data entry as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]SAMPLE11.SQL
$ PROCOB INAME=SAMPLE11 SQLCHECK=FULL USERID=SCOTT/TIGER PICX=VARCHAR2
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE SAMPLE11.COB
$ LNPROCOB SAMPLE11
$ RUN SAMPLE11
20

Running the SAMPLE12 requires additional parameters and data entry as follows:

$ PROCOB INAME=SAMPLE12 DYNAMIC=ANSI
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE SAMPLE12.COB
$ LNPROCOB SAMPLE12
$ RUN SAMPLE12
scott
tiger
SELECT * FROM emp WHERE deptno = :b1
30

Running the SAMPLE13 demonstration requires additional data entry as follows:

$ RUN SAMPLE13
30
20
10
0

Running the LOBDEMO1 demonstration requires additional SQL statements and data entry as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]LOBDEMO1.SQL
$ PROCOB INAME=LOBDEMO1
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE LOBDEMO1.COB
$ LNPROCOB LOBDEMO1
$ RUN LOBDEMO1
1
2
555001212
3
555001212
4
4
111223333
Mickey
1
2
111223333
3
111223333
5
3
111223333
2
5

6.6.3 Pro*COBOL User Programs

See Also:

The make file for information about creating 32-bit user programs

To create a program, enter commands similar to the following:

$ PROCOB INAME=cobfile1
$ PROCOB INAME=cobfil2
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE cobfile1.COB
$ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE cobfile2.COB
$ LNPROCOB cobfile1 cobfile1,cobfile2
$ RUN cobfile1

In this example:

  • cobfilen is the COBOL source file for the program

  • The first LNPROCOB parameter is the executable program

For example:

To create the myprog program, enter one of the following commands, depending on the source and type of executable that you want to create:

  • To link with the client shared library, enter the following commands:

    $ PROCOB INAME=myprog
    $ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE myprog.COB
    $ LNPROCOB myprog
    
    
  • To link with the client object library (non-shared), enter the following commands:

    $ PROCOB INAME=myprog
    $ COB /ANSI /NAMES=AS_IS /FLOAT=IEEE myprog.COB
    $ DEFINE ORA_OLB ORA_ROOT:[LIB32],ORA_RDBMS
    $ DEFINE ORA_UTIL ORA_OLB 
    $ LOUTL MYPROG MYPROG MYPROG NS
    
    

6.6.4 FORMAT Precompiler Option

The FORMAT precompiler option specifies the format of input lines for COBOL. If you specify the default value ANSI, then columns 1 to 6 contain an optional sequence number, column 7 indicates comments or continuation lines, paragraph names begin in columns 8 to 11, and statements begin in columns 12 to 72.

If you specify the value TERMINAL, then columns 1 to 6 are dropped, making column 7 the left-most column.

6.6.5 Pro*COBOL Restriction

The use of incorrectly aligned binary data, such as COMP-1, in Pro*COBOL applications will generate unaligned access warnings that will prevent optimum compiler performance. However, the application results are not affected.

6.7 Pro*FORTRAN Precompiler

Before you use the Pro*FORTRAN precompiler, verify that the correct version of the compiler is installed.

This section discusses the following topics:

6.7.1 Pro*FORTRAN Demonstrations

Demonstrations are provided to show the features of the Pro*FORTRAN precompiler. All of the demonstrations are located in the ORA_ROOT:[PRECOMP.DEMO.PROFOR] directory. By default, all programs are dynamically linked with the client shared library.

To run the programs, the demonstration tables created by the ORA_ROOT:[sqlplus.demo]demobld.sql script must exist in the SCOTT schema with the password TIGER.

Note:

You must unlock the SCOTT account and set the password before creating the demonstrations.

Before creating the demonstrations, review the DEMO_PROFOR.MK make file, which is located in the ORA_ROOT:[PRECOMP.DEMO.PROFOR] directory.

For example, to precompile, compile, and link the SAMPLE1 demonstration program, enter the following commands:

Note:

The DBA of the site must install Oracle Database Sample Schemas and unlock SCOTT/TIGER.

The following is for illustrative purposes only. Contact the DBA of the site for information about the required security settings.

$ @ORA_ROOT:[000000]ORAUSER sid
$ SQLPLUS "/ AS SYSDBA"
SQL> ALTER USER SCOTT ACCOUNT UNLOCK;
SQL> ALTER USER SCOTT IDENTIFIED BY TIGER;
SQL> EXIT
$ SET DEFAULT ORA_ROOT:[PRECOMP.DEMO.PROFOR]
$ PROFOR INAME=SAMPLE1 INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC])
$ FORT /NAMES=AS_IS /FLOAT=IEEE /
INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC]) SAMPLE1
$ LNPROFOR SAMPLE1
$ RUN SAMPLE1
7934
0

To create the Pro*FORTRAN SAMPLE2, 3, 6, 7, and 8 demonstrations programs, run commands similar to those run for SAMPLE1. This procedure does not require data entry.

Running the SAMPLE4 demonstration requires additional data entry as follows:

$ RUN SAMPLE4
y
7934
0

Note:

SAMPLE5.PFO is not supported.

Some demonstrations require you to run a SQL script, located in the ORA_ROOT:[PRECOMP.DEMO.SQL] directory. If you do not run the script, then a message requesting you to run it is displayed. For example, to create the SAMPLE9 demonstration and run the required ORA_ROOT:[PRECOMP.DEMO.SQL]CALLDEMO.SQL script, run the following commands:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]CALLDEMO.SQL
$ PROFOR INAME=SAMPLE9 INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],
ORA_ROOT:[PRECOMP.PUBLIC]) SQLCHECK=FULL USERID=SCOTT/TIGER
$ FORT /NAMES=AS_IS /FLOAT=IEEE /INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],
ORA_ROOT:[PRECOMP.PUBLIC]) SAMPLE9
$ LNPROFOR SAMPLE9
$ RUN SAMPLE9
10

Running the SAMPLE10 demonstration requires data entry as follows:

$ RUN SAMPLE10
scott
tiger
SELECT empno, ename, job FROM emp;

Running the SAMPLE11 demonstration requires additional SQL statements, parameters, and data entry as follows:

$ SQLPLUS/NOLOG
SQL> @ORA_ROOT:[PRECOMP.DEMO.SQL]SAMPLE11.SQL
$ PROFOR INAME=SAMPLE11 INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],
ORA_ROOT:[PRECOMP.PUBLIC]) SQLCHECK=FULL USERID=SCOTT/TIGER
$ FORT /NAMES=AS_IS /FLOAT=IEEE /
INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC]) SAMPLE11
$ LNPROFOR SAMPLE11
$ RUN SAMPLE11
20

6.7.2 Pro*FORTRAN User Programs

See Also:

The make file for information about creating 32-bit user programs

To create a program, enter a commands similar to the following:

$ PROFOR INAME=forfile1 INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC])
$ PROFOR INAME=forfil2 INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC])
$ FORT /NAMES=AS_IS /FLOAT=IEEE /
INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC]) forfile1.for
$ FORT /NAMES=AS_IS /FLOAT=IEEE /
INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC]) forfile2.for
$ LNPROFOR forfile1 forfile1,forfile2.
$ RUN forfile1

In this example:

  • forfile1 and forfile2 are the FORTRAN source files for the program

  • The first LNPROFOR parameter is the executable program

For example, to create the myprog program from the Pro*FORTRAN source file myprog.PFO, enter one of the following commands, depending on the type of executable that you want to create:

  • For an executable linked with the client shared library, enter the following commands:

    $ PROFOR INAME=myprog
    $ FORT /NAMES=AS_IS /FLOAT=IEEE /
    INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC]) myprog.FOR
    $ LNPROFOR myprog
    
    
  • For an executable linked with the client object library (non-shared), enter the following commands:

    $ PROFOR INAME=myprog
    $ FORT /NAMES=AS_IS /FLOAT=IEEE /
    INCLUDE=(ORA_ROOT:[RDBMS.PUBLIC],ORA_ROOT:[PRECOMP.PUBLIC]) myprog.FOR
    $ DEFINE ORA_OLB ORA_ROOT:[LIB32],ORA_RDBMS$ DEFINE ORA_UTIL ORA_OLB 
    $ LOUTL myprog myprog myprog NS
    

6.8 Using the Oracle Call Interface Routines

Oracle Call Interface routines enable high-level language applications to access data in an Oracle Database. Programs that use the OCI routines can make direct calls to Oracle subroutines. They need not be precompiled. The C programming language, FORTRAN, and COBOL are supported on OpenVMS for OCI programs.

OCI sample programs are supplied in the following directory:

ORA_ROOT:[RDBMS.DEMO]

This section discusses the following topics:

6.8.1 Guidelines

The following guidelines apply when using OCI routines:

6.8.2 CDA/LDA Structure Information

For the C OCI programmer, the CDA and LDA structures (64 bytes each) are declared in the header file OCIDFN.H.

The following tabulation of the size and offsets of the structure elements allows COBOL and FORTRAN programmers to use these structures.

6.8.2.1 Size and Offsets of Structure Elements

The information for the cda_def structure, of which Cda_Def and Lda_Def are type definitions, is shown in Table 6-6.

Table 6-6 lists the sizes and offsets of structure elements.

Table 6-6 Size and Offset of Structure Elements

Structure Element Offset (Bytes) Size (Bytes)

v2_rc

0

2

ft

2

2

rpc

4

4

peo

8

2

fc

10

1

rc

12

2

wrn

14

1

rid

20

16

ose

36

4

rcsp

44

4


6.8.3 Linking Oracle Call Interface Programs Written in the C Programming Language

LNOCIC.COM is used to link Oracle Call Interface routines written in the C programming language. The syntax of this command is as follows:

$ LNOCIC executable objfilelist options

In this syntax:

  • executable is the name of the executable image to be created.

    A file name extension is not required.

  • objfilelist is a list of object files and libraries separated by commas.

    If this list is longer than one line, then use the continuation character, the hyphen (-).  Note that spaces are not allowed in the object file list.

  • options is a list of options with no separators needed:

    • D: Links with the OpenVMS DEBUG utility

    • F: Produces a full map

    • M: Creates a link map

    • X: Produces a link map with cross-references

    For example:

    $ LNOCIC SAMPLE OBJECT1 D 
    

6.8.4 Linking Oracle Call Interface Programs Written in Other Languages

LNOCI.COM is used to link with programs that are not written in the C programming language. Of these, only FORTRAN, and COBOL are supported on OpenVMS for OCI programs. The syntax is as follows:

$ LNOCI executable objectfilelist options

For example:

$ LNOCI SAMPLE OBJECT1 D 

Note:

The old style Oracle Call Interface (HLI) function calls are not supported in Oracle Database 10g Enterprise Edition.

6.9 Data Areas and Data Types

Data types for Oracle on OpenVMS are described in the following section. The Cursor Data Area is correct for OpenVMS as shown in the programmatic interface guides.

Binary Integers

For OpenVMS, binary integers are 32 bits and short binary integers are 16 bits, as shown in Table 6-7.

Table 6-7 lists binary intergers for programming languages.

Table 6-7 Usage of Binary and Short Binary Integers

Programming Language Usage of Binary Integers Usage of Short Binary Integers

C

int; short

NA

FORTRAN

INTEGER*4

NA

COBOL

PIC S9(9) COMP

PIC S9(4) COMP


6.10 Using Literals as Call Arguments

In FORTRAN, literals and the CHARACTER data type are passed by descriptor to subroutines. Oracle requires all data to be passed by reference. OpenVMS FORTRAN provides the %REF compiler directive for overriding the normal calling mechanism. This compiler directive should be used to pass literal strings and CHAR data to Oracle software routines like OCI.

For example:

CALL ORLON (LDA(1), HDA(1), %REF('SCOTT'), 5, %REF('TIGER'), 5)

6.11 Optional or Missing Parameters

On OpenVMS, the C programming language does not permit missing optional parameters. All call parameters must be specified. FORTRAN and COBOL, however, allow for missing trailing parameters. The required defaults are automatically provided. FORTRAN also allows missing embedded parameters. The required defaults are automatically provided.

If you omit a parameter by using the -1 convention, then the argument can be either the integer value -1 or a reference to the integer value -1, as long as the argument is of the integer or short binary integer data type. If the argument is the address of any data type, then -1 must be passed by value.

The following two examples show how to override the normal calling mechanism. In FORTRAN, you could use the following:

CALL ORLON(LDA(1), HDA(1), %REF('SCOTT/TIGER'), -1, X, %VAL(-1)) 

In COBOL, you could use this:

01 DEFLT PIC S9(9) COMP VALUE -1. 
01 LDA PIC X(64). 
01 HDA PIC X(256). 
01 UID PIC X(11) VALUE 'SCOTT/TIGER' 
01 UIDL PIC S9(9) VALUE 11. 
CALL ORLON USING LDA, HDA, UID, UIDL, 
BY VALUE DEFLT. 

6.12 Using Event Flags

Event flags signal the completion of synchronous and asynchronous events in OpenVMS, such as disk I/O, terminal I/O, timers, the return of system and user information, lock acquisition, and user interrupts.

Oracle Database 10g prevents asynchronous events from interfering with synchronous events by overwriting their event flags. This may increase the reliability of Oracle Database 10g software on modern hardware, but it may introduce some problems for application programmers.

In Oracle Database 10g, references to event flags 1 through 18 are included in the software. All of these event flags except flags 1 and 5 are tied to specific asynchronous events within Oracle Database 10g. Event flags 1 and 5 are used by all synchronous events within Oracle Database 10g and can also be used by application programmers. SYS$GETEF() is not used for these event flags.

Note:

Record Management Services (RMS) uses event flags 27 through 31.

6.13 Custom Link Files

Oracle recommends that you use the provided link scripts to create user programs as described in the product-specific sections of this chapter. If you modify the provided link file or if you choose to use a custom-written link file, then the following restrictions apply:

6.14 Multithreaded Applications

The Oracle libraries provided with this release are thread-safe, which enables support for multithreaded applications.