Programmer's Guide to the Oracle Precompilers, 1.8 | Library |
Product |
Contents |
Index |
Host Language | Precompiler Command |
COBOL | procob |
FORTRAN | profor |
The INAME option specifies the source file to be precompiled. For example, the Pro*COBOL command
procob INAME=test
precompiles the file test.pco in the current directory, since the precompiler assumes that the filename extension is .pco. You need not use a file extension when specifying INAME unless the extension is nonstandard.
Input and output filenames need not be accompanied by their respective option names, INAME and ONAME. When the option names are not specified, the precompiler assumes that the first filename specified on the command line is the input filename and that the second filename is the output filename.
Thus, the Pro*FORTRAN command
profor MODE=ANSI myfile.pfo DBMS=V7 myfile.f
is equivalent to
profor MODE=ANSI INAME=myfile.pfo DBMS=V7 ONAME=myfile.f
Note: Option names and option values that do not name specific operating system objects, such as filenames, are not case-sensitive. In the examples in this guide, option names are written in upper case, and option values are usually in lower case. Filenames, including the name of the precompiler executable itself, always follow the case conventions used by the operating system on which it is executed.
The generated code also includes calls to the SQLLIB routines that perform embedded SQL operations. Note that the precompiler does not generate calls to Oracle Call Interface (OCI) routines.
Note: The precompiler does not generate calls to Oracle Call Interface (OCI) routines.
The precompiler can issue warnings and error messages. These messages have the prefix PCC-, and are described in Oracle7 Server Messages.
<option_name>=<value>
The value of an option is a string literal, which represents text or numeric values. For example, for the option
... INAME=my_test
the value is a string literal that specifies a filename, but for the option
... MAXOPENCURSORS=20
the value is numeric.
Some options take Boolean values, which you can represent with the strings YES or NO, TRUE or FALSE, or with the integer literals 1 or 0, respectively. For example, the option
... SELECT_ERROR=YES
is equivalent to
... SELECT_ERROR=TRUE
or
... SELECT_ERROR=1
The option value is always separated from the option name by an equal sign, leave no whitespace around the equal sign, because spaces delimit individual options. For example, you might specify the option AUTO_CONNECT on the command line as follows:
... AUTO_CONNECT=YES
You can abbreviate the names of options if the abbreviation is unambiguous. For example, you cannot use the abbreviation MAX because it might stand for MAXLITERAL or MAXOPENCURSORS.
A handy reference to the precompiler options is available online. To see the online display, enter the precompiler command with no arguments at your operating system prompt. The display gives the name, syntax, default value, and purpose of each option. Options marked with an asterisk (*) can be specified inline as well as on the command line.
Then, if this option is set on the command line, the new command-line value takes precedence. Finally, an inline specification takes precedence over all preceding defaults. For more information, see "Configuration Files" .
procob ?
the complete option set, along with current values, is displayed on your terminal. In this case, the values are those built into the precompiler, overridden by any values in the system configuration file. But if you issue the following command
procob CONFIG=my_config_file.cfg ?
and there is a file named my_config_file.cfg in the current directory, the options from the my_config_file.cfg file are listed with the other default values. Values in the user configuration file supply missing values, and they supersede values built into the precompiler or values specified in the system configuration file.
You can also determine the current value of a single option by simply specifying the option name followed by "=?" as in
procob MAXOPENCURSORS=?
Note: With some operating systems, the "?" may need to be preceded by an "escape" character, such as a back-slash (\). For example, instead of "procob ?," you might need to use "procob \?" to list the Pro*COBOL option settings.
FIPS=YES MODE=ANSI
to set defaults for the FIPS and MODE options.
There is a single system configuration file for each system. The name of the system configuration file is precompiler-specific and is shown in Table 6 - 2.
Precompiler | Configuration File |
Pro*COBOL | pcccob.cfg |
Pro*FORTRAN | pccfor.cfg |
Each precompiler user can have one or more user configuration files. The name of the configuration file must be specified using the CONFIG command-line option. For more information, see "Determining Current Values" .
Note: You cannot nest configuration files. This means that CONFIG is not a valid option inside a configuration file.
... [option_name=value] [option_name=value] ...
Separate each option with one or more spaces. For example, you might enter the following options:
... ERRORS=no LTYPE=short
EXEC ORACLE OPTION (option_name=value);
For example, you might code the following statement:
EXEC ORACLE OPTION (RELEASE_CURSOR=YES);
An option entered inline overrides the same option entered on the command line.
Specifying options inline is also helpful if your operating system limits the number of characters you can enter on the command line, and you can store inline options in configuration files, which are discussed in the next section.
EXEC SQL BEGIN DECLARE SECTION;
emp_name CHARACTER(20);
emp_number INTEGER;
salary REAL;
dept_number INTEGER;
EXEC SQL END DECLARE SECTION;
...
EXEC SQL WHENEVER NOT FOUND GOTO no_more;
EXEC ORACLE OPTION (HOLD_CURSOR=NO);
EXEC SQL DECLARE emp_cursor CURSOR FOR
SELECT EMPNO, DEPTNO FROM EMP;
EXEC SQL OPEN emp_cursor;
display 'Employee Number Dept';
display '--------------- ----';
LOOP
EXEC SQL FETCH emp_cursor INTO :emp_number, :dept_number;
display emp_number, dept_number;
ENDLOOP;
no_more:
EXEC SQL WHENEVER NOT FOUND CONTINUE;
LOOP
display 'Employee number? ';
read emp_number;
IF emp_number = 0 THEN
exit loop;
EXEC ORACLE OPTION (HOLD_CURSOR=YES);
EXEC SQL SELECT ENAME, SAL
INTO :emp_name, :salary
FROM EMP
WHERE EMPNO = :emp_number;
display 'Salary for ', emp_name, ' is ', salary;
ENDLOOP;
...
FIPS=YES
MODE=ANSI
SQLCHECK=SEMANTICS
Each Oracle Precompiler can have its own system configuration file. The name and location of the file are language- and system-specific. If the file is not found, you get a warning but the precompiler continues processing.
There is only one system configuration file for a given language, but you can create any number of user configuration files. You use the new command-line option CONFIG to specify the name and location of a particular user configuration file, as follows:
... CONFIG=<filename>
You cannot nest configuration files. Therefore, you cannot specify the CONFIG option in a configuration file. Also, you cannot specify CONFIG inline.
For example, if you specify HOLD_CURSOR=YES and RELEASE_CURSOR=YES for unit A but not unit B, SQL statements in unit A run with these HOLD_CURSOR and RELEASE_CURSOR values, but SQL statements in unit B run with the default values. However, the MAXOPENCURSORS setting that is in effect when you connect to Oracle stays in effect for the life of that connection.
The scope of an inline option is positional, not logical. That is, an inline option affects SQL statements that follow it in the source file, not in the flow of program logic. An option setting stays in effect until the end-of-file unless you respecify the option.
Another handy reference is available online. To see the online display, just enter the precompiler command without options at your operating system prompt. The display gives the name, syntax, default value, and purpose of each option.
Note: There are some platform-specific options. For example, on byte-swapped platforms that use MicroFocus COBOL, the option COMP5 governs the use of certain COMPUTATIONAL items. Check your system-specific Oracle manuals.
Purpose
Specifies whether the listing file follows the ASA convention of using the first column in each line for carriage control.
Syntax
ASACC={YES|NO}
Default
NO
Usage Notes
Cannot be entered inline.
Purpose
Instructs the Oracle Precompiler to presume that SQLCODE is declared whether or not it is declared in the Declare Section or of the proper type. ASSUME_SQLCODE=YES causes Releases 1.6 and later of the Oracle Precompilers to behave similarly to Release 1.5 in this respect.
Syntax
ASSUME_SQLCODE={YES|NO}
Default
NO
Usage Notes
Cannot be entered inline.
When ASSUME_SQLCODE=NO, SQLCODE is recognized as a status variable if and only if at least one of the following criteria is satisfied:
When ASSUME_SQLCODE=YES, and when SQLSTATE and/or SQLCA (Pro*FORTRAN only) are declared as status variables, the precompiler presumes SQLCODE is declared whether or not it is declared in a Declare Section or of the proper type. This causes Releases 1.6.7 and later to behave like Release 1.5 in this regard.
Purpose
Specifies whether your program connects automatically to the default user account.
Syntax
AUTO_CONNECT={YES|NO}
Default
NO
Usage Notes
Cannot be entered inline.
When AUTO_CONNECT=YES, as soon as the precompiler encounters an executable SQL statement, your program tries to log on to Oracle automatically with the userid
<prefix><username>
where prefix is the value of the Oracle initialization parameter OS_AUTHENT_PREFIX (the default value is OPS$) and username is your operating system user or task name. In this case, you cannot override the default value for MAXOPENCURORS (10), even if you specify a different value on the command line.
When AUTO_CONNECT=NO (the default), you must use the CONNECT statement to log on to Oracle.
Purpose
For Pro*FORTRAN only, the COMMON_NAME option specifies a prefix used to name internal FORTRAN COMMON blocks. Your host program does not access the COMMON blocks directly. But, they allow two or more program units in the same precompilation unit to contain SQL statements.
Syntax
COMMON_NAME=blockname
Default
First five characters in name of input file
Usage Notes
The Pro*FORTRAN Precompiler uses a special program file called a block data subprogram to establish COMMON blocks for all the SQL variables in an input file. The block data subprogram defines two COMMON blocks -- one for CHARACTER variables, the other for non-CHARACTER variables -- and uses DATA statements to initialize the variables.
The format of a block data subprogram follows:
BLOCK DATA <subprogram_name>
variable declarations
COMMON statements
DATA statements
END
Your host program does not access the COMMON blocks directly. But, they allow two or more program files in the same precompilation file to contain SQL statements.
To name the COMMON blocks, the precompiler uses the name of the input file and the suffixes C, D, and I. At most, the first five characters of the filename are used. For example, if the name of the input file is ACCTSPAY, the precompiler names the COMMON blocks ACCTSC, ACCTSD, and ACCTSI.
The precompiler, however, can give COMMON blocks defined in different output files the same name, as the following schematic shows:
ACCTSPAY.PFO ===> ACCTSC, ACCTSD, ACCTSI in ACCTSPAY.FOR
ACCTSREC.PFO ===> ACCTSC, ACCTSD, ACCTSI in ACCTSREC.FOR
If you were to link ACCTSPAY and ACCTSREC into an executable program, the linker would see three, not six, COMMON blocks.
To solve the problem, you can rename the input files, or you can override the default COMMON block names by specifying COMMON_NAME inline or on the command line as follows:
COMMON_NAME=<block_name>
where block_name is a legal COMMON block name. For example, if you specify COMMON_NAME=PAY, the precompiler names its COMMON blocks PAYC and PAYI. At most, the first five characters in block_name are used.
For example, if you specify COMMON_NAME=PAY, the precompiler names its COMMON blocks PAYC and PAYI. At most, the first 5 characters in block_name are used.
If you specify COMMON_NAME inline, its EXEC ORACLE OPTION statement must precede the FORTRAN PROGRAM, SUBROUTINE, or FUNCTION statement.
You might want to override the default COMMON block names if they conflict with your user-defined COMMON block names. However, the preferred practice is to rename the user-defined COMMON blocks.
COMMON_NAME is not needed if you specify MULTISUBPROG.
Purpose
Specifies the name of a user configuration file.
Syntax
CONFIG=filename
Default
None
Usage Notes
Can be entered only on the command line.
The Oracle Precompilers can use a configuration file containing preset command-line options. By default, a text file called the system configuration file is used. However, you can specify any of several alternative files, called user configuration files. For more information, see "Configuration Files" .
You cannot nest configuration files. Therefore, you cannot specify the option CONFIG in a configuration file.
Purpose
Specifies whether Oracle follows the semantic and syntactic rules of Oracle Version 6, Oracle7, or the native version of Oracle (that is, the version to which your application is connected).
Syntax
DBMS={NATIVE|V6|V7}
Default
NATIVE
Usage Notes
Cannot be entered inline.
With the DBMS option you can control the version-specific behavior of Oracle. When DBMS=NATIVE (the default), Oracle follows the semantic and syntactic rules of the native version of Oracle.
When DBMS=V6 or DBMS=V7, Oracle follows the rules of Oracle Version 6 or Oracle7, respectively. A summary of the differences between DBMS=V6 and DBMS=V7 follows:
CREATE TABLE T1 (COL1 CHAR(10))
creates the table using the VARCHAR2 (variable-length) datatype, as if the CREATE TABLE statement had been
CREATE TABLE T1 (COL1 VARCHAR2(10))
Table 6 - 4 shows how the compatible DBMS and MODE settings interact. All other combinations are incompatible or unrecommended.
Situation | DBMS=V7 MODE=ANSI | DBMS=V7 MODE=ORACLE | DBMS=V6 MODE=ORACLE |
"no data found" warning code | +100 | +1403 | +1403 |
fetch nulls without using indicator variables | error -1405 | error -1405 | no error |
fetch truncated values without using indicator variables | no error but SQLWARN(2) is set | no error but SQLWARN(2) is set | error -1406 and SQLWARN(2) is set |
cursors closed by COMMIT or ROLLBACK | all explicit | CURRENT OF only | CURRENT OF only (1) |
open an already OPENed cursor | error -2117 | no error | no error |
close an already CLOSEd cursor | error -2114 | no error | no error |
SQL group function ignores nulls | no warning | no warning | SQLWARN(3) is set |
when SQL group function in multirow query is called | FETCH time | FETCH time | OPEN time |
declare SQLCA structure | optional | required | required (2) |
declare SQLCODE or SQLSTATE status variable | required | optional but Oracle ignores | optional but Oracle ignores (2) |
default external datatype of character host variables external datatype used for CHAR in TYPE and VAR statements | CHARF | VARCHAR2 | VARCHAR2 |
default external datatype of string literals in SQL statements | CHARF | CHARF | VARCHAR2 |
default internal datatype of CHAR variables in SQL statements | CHAR | CHAR | VARCHAR2 |
default external datatype of CHAR variables in PL/SQL blocks | CHARF | CHARF | VARCHAR2 |
default external datatype of value function USER returns | CHARF | CHARF | VARCHAR2 |
external datatype code DESCRIBE returns (dynamic SQL Method 4) | 96 | 96 | 1 |
integrity constraints | enabled | enabled | disabled |
PCTINCREASE for rollback segments | not allowed | not allowed | allowed |
MAXEXTENTS storage parameters | not allowed | not allowed | allowed |
Purpose
Specifies a user-defined symbol that is used to include or exclude portions of source code during a conditional precompilation. For more information, see "Doing Conditional Precompilations" .
Syntax
DEFINE=symbol
Default
None
Usage Notes
If you enter DEFINE inline, the EXEC ORACLE statement takes the following form:
EXEC ORACLE DEFINE <symbol>;
Purpose
Specifies whether precompiler error messages are sent to the terminal and listing file or only to the listing file.
Syntax
ERRORS={YES|NO}
Default
YES
Usage Notes
When ERRORS=YES, error messages are sent to the terminal and listing file.
When ERRORS=NO, error messages are sent only to the listing file.
Purpose
Specifies whether extensions to ANSI/ISO SQL are flagged (by the FIPS Flagger). An extension is any SQL element that violates ANSI/ISO format or syntax rules, except privilege enforcement rules.
Syntax
FIPS={YES|NO}
Default
NO
Usage Notes
When FIPS=YES, the FIPS Flagger issues warning (not error) messages if you use an Oracle extension to the ANSI/ISO embedded SQL standard (SQL92) or use a SQL92 feature in a nonconforming manner.
The following extensions to ANSI/ISO SQL are flagged at precompile time:
Purpose
Specifies the format of COBOL or FORTRAN input lines.
Syntax
FORMAT={ANSI|TERMINAL}
Default
ANSI
Usage Notes
Cannot be entered inline.
The format of input lines is system-dependent. Check your system-specific Oracle manuals.
When FORMAT=ANSI, the format of input lines conforms as much as possible to the current ANSI standard.
Purpose
Specifies how the cursors for SQL statements and PL/SQL blocks are handled in the cursor cache.
Syntax
HOLD_CURSOR={YES|NO}
Default
NO
Usage Notes
You can use HOLD_CURSOR to improve the performance of your program. For more information, see Appendix C.
When a SQL data manipulation statement is executed, its associated cursor is linked to an entry in the cursor cache. The cursor cache entry is in turn linked to an Oracle private SQL area, which stores information needed to process the statement. HOLD_CURSOR controls what happens to the link between the cursor and cursor cache.
When HOLD_CURSOR=NO, after Oracle executes the SQL statement and the cursor is closed, the precompiler marks the link as reusable. The link is reused as soon as the cursor cache entry to which it points is needed for another SQL statement. This frees memory allocated to the private SQL area and releases parse locks.
When HOLD_CURSOR=YES and RELEASE_CURSOR=NO, the link is maintained; the precompiler does not reuse it. This is useful for SQL statements that are executed often because it speeds up subsequent executions. There is no need to reparse the statement or allocate memory for an Oracle private SQL area.
For inline use with implicit cursors, set HOLD_CURSOR before executing the SQL statement. For inline use with explicit cursors, set HOLD_CURSOR before opening the cursor.
Note that RELEASE_CURSOR=YES overrides HOLD_CURSOR=YES and that HOLD_CURSOR=NO overrides RELEASE_CURSOR=NO. For information showing how these two options interact, see Table C - 1 .
Purpose
Specifies the host language to be used.
Syntax
HOST={COB74|COBOL}
Default
COBOL
Usage Notes
Cannot be entered inline.
COB74 refers to the 1974 version of ANSI-approved COBOL. COBOL refers to 1985 version. Other values might be available on your platform.
Purpose
Specifies the name of the input file.
Syntax
INAME=filename
Default
None
Usage Notes
Cannot be entered inline.
When specifying the name of your input file on the command line, the keyword INAME is optional. For example, in Pro*COBOL, you can specify myprog.pco instead of INAME=myprog.pco.
The precompiler assumes the standard input file extension (see Table 6 - 5). So, you need not use a file extension when specifying INAME unless the extension is nonstandard. For example, in Pro*FORTRAN, you can specify myprog instead of myprog.pfo.
Host Language | Standard File Extension |
COBOL | pco |
FORTRAN | pfo |
For Pro*COBOL only, if you use a nonstandard input file extension when specifying INAME, you must also specify HOST.
Purpose
Specifies a directory path for EXEC SQL INCLUDE files. It only applies to operating systems that use directories.
Syntax
INCLUDE=path
Default
Current directory
Usage Notes
Typically, you use INCLUDE to specify a directory path for the SQLCA and ORACA files. The precompiler searches first in the current directory, then in the directory specified by INCLUDE, and finally in a directory for standard INCLUDE files. Hence, you need not specify a directory path for standard files such as the SQLCA and ORACA.
You must still use INCLUDE to specify a directory path for nonstandard files unless they are stored in the current directory. You can specify more than one path on the command line, as follows:
... INCLUDE=<path1> INCLUDE=<path2> ...
The precompiler searches first in the current directory, then in the directory named by path1, then in the directory named by path2, and finally in the directory for standard INCLUDE files.
Remember, the precompiler looks for a file in the current directory first--even if you specify a directory path. So, if the file you want to INCLUDE resides in another directory, make sure no file with the same name resides in the current directory.
The syntax for specifying a directory path is system-specific. Follow the conventions of your operating system.
Purpose
Specifies the record length of the input file.
Syntax
IRECLEN=integer
Default
80
Usage Notes
Cannot be entered inline.
The value you specify for IRECLEN should not exceed the value of ORECLEN. The maximum value allowed is system-dependent.
Purpose
For Pro*COBOL only, the LITDELIM option specifies the delimiter for string constants and literals.
Syntax
LITDELIM={APOST|QUOTE}
Default
QUOTE
Usage Notes
When LITDELIM=APOST, the precompiler uses apostrophes when generating COBOL code. If you specify LITDELIM=QUOTE, quotation marks are used, as in
CALL "SQLROL" USING SQL-TMP0.
In SQL statements, you must use quotation marks to delimit identifiers containing special or lowercase characters, as in
EXEC SQL CREATE TABLE "Emp2" END-EXEC.
but you must use apostrophes to delimit string constants, as in
EXEC SQL SELECT ENAME FROM EMP WHERE JOB = 'CLERK' END-EXEC.
Regardless of which delimiter is used in the Pro*COBOL source file, the precompiler generates the delimiter specified by the LITDELIM value.
Purpose
Specifies a non-default name for the listing file.
Syntax
LNAME=filename
Default
input.LIS, where input is the base name of the input file.
Usage Notes
Cannot be entered inline.
By default, the listing file is written to the current directory.
Purpose
Specifies the record length of the listing file.
Syntax
LRECLEN=integer
Default
132
Usage Notes
Cannot be entered inline.
The value of LRECLEN can range from 80 through 255. If you specify a value below the range, 80 is used instead. If you specify a value above the range, 255 is used instead. LRECLEN should exceed IRECLEN by at least 8 to allow for the insertion of line numbers.
Purpose
Syntax
LTYPE={LONG|SHORT|NONE}
Default
LONG
Usage Notes
Cannot be entered inline.
When LTYPE=LONG, input lines appear in the listing file. When LTYPE=SHORT, input lines do not appear in the listing file. When LTYPE=NONE, no listing file is created.
Purpose
Specifies the maximum length of string literals generated by the precompiler so that compiler limits are not exceeded. For example, if your compiler cannot handle string literals longer than 132 characters, you can specify MAXLITERAL=132 on the command line.
Syntax
MAXLITERAL=integer
Default
The default is precompiler-specific as shown here:
Precompiler | Default |
Pro*COBOL | 256 |
Pro*FORTRAN | 1000 |
The maximum value of MAXLITERAL is compiler-dependent. The default value is language-dependent, but you might have to specify a lower value. For example, some COBOL compilers cannot handle string literals longer than 132 characters, so you would specify MAXLITERAL=132.
Strings that exceed the length specified by MAXLITERAL are divided during precompilation, then recombined (concatenated) at run time.
You can enter MAXLITERAL inline but your program can set its value just once, and the EXEC ORACLE statement must precede the first EXEC SQL statement. Otherwise, the precompiler issues a warning message, ignores the extra or misplaced EXEC ORACLE statement, and continues processing.
Purpose
Specifies the number of concurrently open cursors that the precompiler tries to keep cached.
Syntax
MAXOPENCURSORS=integer
Default
10
Usage Notes
You can use MAXOPENCURSORS to improve the performance of your program. For more information, see Appendix C.
When precompiling separately, use MAXOPENCURSORS as described in "Separate Precompilations" .
MAXOPENCURSORS specifies the initial size of the SQLLIB cursor cache. If a new cursor is needed, and there are no free cache entries, Oracle tries to reuse an entry. Its success depends on the values of HOLD_CURSOR and RELEASE_CURSOR, and, for explicit cursors, on the status of the cursor itself. Oracle allocates an additional cache entry if it cannot find one to reuse. If necessary, Oracle keeps allocating additional cache entries until it runs out of memory or reaches the limit set by OPEN_CURSORS. To avoid a "maximum open cursors exceeded" Oracle error, MAXOPENCURSORS must be lower than OPEN_CURSORS by at least 6.
As your program's need for concurrently open cursors grows, you might want to respecify MAXOPENCURSORS to match the need. A value of 45 to 50 is not uncommon, but remember that each cursor requires another private SQL area in the user process memory space. The default value of 10 is adequate for most programs.
Purpose
Specifies whether your program observes Oracle practices or complies with the current ANSI SQL standard.
Syntax
MODE={ANSI|ISO|ANSI14|ISO14|ANSI13|ISO13|ORACLE}
Default
ORACLE
Usage Notes
Cannot be entered inline.
The following pairs of MODE values are equivalent: ANSI and ISO, ANSI14 and ISO14, ANSI13 and ISO13.
When MODE=ORACLE (the default), your embedded SQL program observes Oracle practices.
When MODE={ANSI14|ANSI13}, your program complies closely with the current ANSI SQL standard.
When MODE=ANSI, your program complies fully with the ANSI standard and the following changes go into effect:
Table 6 - 4 shows how the MODE and DBMS settings interact. Other combinations are incompatible or are not recommended.
Purpose
For Pro*FORTRAN only, the MULTISUBPROG option specifies whether the Pro*FORTRAN precompiler generates COMMON statements and BLOCK DATA subprograms.
Note: This option allows Pro*FORTRAN release 1.3 applications to migrate to later releases. You can ignore the MUTISUBPROG option if you are not migrating Pro*FORTRAN release 1.3 source code.
Syntax
MULTISUBPROG={YES|NO}
Default
YES
Usage Notes
Cannot be entered inline.
When MULTISUBPROG=YES, the precompiler generates COMMON statements and BLOCK DATA subprograms. Your host program does not access the COMMON blocks directly, but it allows two or more program units in the same precompilation unit to contain SQL statements.
However, the precompiler can give COMMON blocks defined in different output files the same name. If you link the files into an executable program, you get a link-time or runtime error. To solve this problem, you can rename the input files or override the default COMMON block names by specifying the option COMMON_NAME. To avoid the problem, specify MULTISUBPROG=NO.
Specify MULTISUBPROG=NO if your Pro*FORTRAN source code has only a single subprogram per source file (this was the restriction in release 1.3). When MULTISUBPROG=NO, the the COMMON_BLOCK option is ignored and the precompiler generates no COMMON statements or BLOCK DATA subprograms. Every program unit that contains executable SQL statements must have a Declare Section. Otherwise, you get a precompilation error. For input files that contain more than one embedded SQL program unit, the precompiler generates the same declarations in each unit.
Purpose
For Pro*COBOL only, the NLS_LOCAL option determines whether NLS character conversions are performed by the precompiler runtime library or by the Oracle Server.
Syntax
NLS_LOCAL={YES|NO}
Default
NO
Usage Notes
Cannot be entered inline.
When NLS_LOCAL=YES, the runtime library (SQLLIB) locally performs blank-padding and blank-stripping for host variables that have multi-byte NLS datatypes.
When NLS_LOCAL=NO, blank-padding and blank-stripping operations are not performed locally for host variables that have multi-byte NLS datatypes.
Attention: Release 7.2 of the Oracle7 Server does not perform any blank-padding or blank-stripping of NLS variables. When NLS_LOCAL=NO, the Oracle Server returns an error upon executing a SQL statement that uses multi-byte NLS data.
Purpose
Specifies the name of the output file.
Syntax
ONAME=filename
Default
System-dependent
Usage Notes
Cannot be entered inline.
Use this option to specify the name of the output file, where the name differs from that of the input file. For example, if you issue
procob INAME=my_test
the default output filename is my_test.cob. If you want the output filename to be my_test_1.cob, issue the command
procob INAME=my_test ONAME=my_test_1.cob
Note that you should add the .cob extension to files specified using ONAME. There is no default extension with the ONAME option.
Attention: Oracle recommends that you not let the output filename default, but rather name it explicitly using ONAME.
Purpose
Specifies whether a program can use the Oracle Communications Area (ORACA).
Syntax
ORACA={YES|NO}
Default
NO
Usage Notes
When ORACA=YES, you must place the INCLUDE ORACA statement in your program.
Purpose
Specifies the record length of the output file.
Syntax
ORECLEN=integer
Default
80
Usage Notes
Cannot be entered inline.
The value you specify for ORECLEN should equal or exceed the value of IRECLEN. The maximum value allowed is system-dependent.
Purpose
Specifies the number of lines per physical page of the listing file.
Syntax
PAGELEN=integer
Default
66
Usage Notes
Cannot be entered inline.
The maximum value allowed is system-dependent.
Purpose
Specifies how the cursors for SQL statements and PL/SQL blocks are handled in the cursor cache.
Syntax
RELEASE_CURSOR={YES|NO}
Default
NO
Usage Notes
You can use RELEASE_CURSOR to improve the performance of your program. For more information, see Appendix C.
When a SQL data manipulation statement is executed, its associated cursor is linked to an entry in the cursor cache. The cursor cache entry is in turn linked to an Oracle private SQL area, which stores information needed to process the statement. RELEASE_CURSOR controls what happens to the link between the cursor cache and private SQL area.
When RELEASE_CURSOR=YES, after Oracle executes the SQL statement and the cursor is closed, the precompiler immediately removes the link. This frees memory allocated to the private SQL area and releases parse locks. To make sure that associated resources are freed when you CLOSE a cursor, you must specify RELEASE_CURSOR=YES.
When RELEASE_CURSOR=NO and HOLD_CURSOR=YES, the link is maintained. The precompiler does not reuse the link unless the number of open cursors exceeds the value of MAXOPENCURSORS. This is useful for SQL statements that are executed often because it speeds up subsequent executions. There is no need to reparse the statement or allocate memory for an Oracle private SQL area.
For inline use with implicit cursors, set RELEASE_CURSOR before executing the SQL statement. For inline use with explicit cursors, set RELEASE_CURSOR before opening the cursor.
Note that RELEASE_CURSOR=YES overrides HOLD_CURSOR=YES and that HOLD_CURSOR=NO overrides RELEASE_CURSOR=NO. For information showing how these two options interact, see Table C - 1 .
Purpose
Specifies whether your program generates an error when a single-row SELECT statement returns more than one row or more rows than a host array can accommodate.
Syntax
SELECT_ERROR={YES|NO}
Default
YES
Usage Notes
When SELECT_ERROR=YES, an error is generated if a single-row select returns too many rows or an array select returns more rows than the host array can accommodate.
When SELECT_ERROR=NO, no error is generated when a single-row select returns too many rows or when an array select returns more rows than the host array can accommodate.
Whether you specify YES or NO, a random row is selected from the table. To ensure a specific ordering of rows, use the ORDER BY clause in your SELECT statement. When SELECT_ERROR=NO and you use ORDER BY, Oracle returns the first row, or the first n rows if you are selecting into an array. When SELECT_ERROR=YES, whether or not you use ORDER BY, an error is generated if too many rows are returned.
Purpose
Specifies the type and extent of syntactic and semantic checking.
Syntax
SQLCHECK={SEMANTICS|FULL|SYNTAX|LIMITED|NONE}
Default
SYNTAX
Usage Notes
The values SEMANTICS and FULL are equivalent, as are the values SYNTAX and LIMITED.
The Oracle Precompilers can help you debug a program by checking the syntax and semantics of embedded SQL statements and PL/SQL blocks. Any errors found are reported at precompile time.
You control the level of checking by entering the SQLCHECK option inline and/or on the command line. However, the level of checking you specify inline cannot be higher than the level you specify (or accept by default) on the command line. For example, if you specify SQLCHECK=NONE on the command line, you cannot specify SQLCHECK=SYNTAX inline.
If SQLCHECK=SYNTAX|SEMANTICS, the precompiler generates an error when PL/SQL reserved words are used in SQL statements, even though the SQL statements are not themselves PL/SQL. If a PL/SQL reserved word must be used as an identifier, you can enclose it in double-quotes.
When SQLCHECK=SEMANTICS, the precompiler checks the syntax and semantics of
The precompiler gets the information for a semantic check from embedded DECLARE TABLE statements or, if you specify the option USERID, by connecting to Oracle and accessing the data dictionary. You need not connect to Oracle if every table referenced in a data manipulation statement or PL/SQL block is defined in a DECLARE TABLE statement.
If you connect to Oracle but some information cannot be found in the data dictionary, you must use DECLARE TABLE statements to supply the missing information. During precompilation, a DECLARE TABLE definition overrides a data dictionary definition if they conflict.
Specify SQLCHECK=SEMANTICS when precompiling new programs. If you embed PL/SQL blocks in a host program, you must specify SQLCHECK=SEMANTICS and the option USERID.
When SQLCHECK=SYNTAX, the precompiler checks the syntax of
When SQLCHECK=NONE, no syntactic or semantic checking is done. DECLARE TABLE statements are ignored and PL/SQL blocks are not allowed. Specify SQLCHECK=NONE if your program
SQLCHECK=SEMANTICS | SQLCHECK=SYNTAX | SQLCHECK=NONE | ||||
Syntax | Semantics | Syntax | Semantics | Syntax | Semantics | |
DML | _/ | _/ | _/ | |||
Remote DML | _/ | _/ | ||||
PL/SQL | _/ | _/ | ||||
Purpose
Specifying UNSAFE_NULL=YES prevents generation of ORA-01405 messages when fetching NULLs without using indicator variables.
Syntax
UNSAFE_NULL={YES|NO}
Default
NO
Usage Notes
Cannot be entered inline.
The UNSAFE_NULL=YES is allowed only when MODE=ORACLE and DBMS=V7.
The UNSAFE_NULL option has no effect on host variables in an embedded PL/SQL block. You must use indicator variables to avoid ORA-01405 errors.
Purpose
Specifies an Oracle username and password.
Syntax
USERID=username/password
Default
None
Usage Notes
Cannot be entered inline.
Do not specify this option when using the automatic logon feature, which accepts your Oracle username prefixed with the value of the Oracle initialization parameter OS_AUTHENT_PREFIX.
When SQLCHECK=SEMANTICS, if you want the precompiler to get needed information by connecting to Oracle and accessing the data dictionary, you must also specify USERID.
Purpose
For Pro*COBOL only, the VARCHAR option instructs the precompiler to treat the COBOL group item described in Chapter 1 of the Pro*COBOL Supplement to the Oracle Precompilers Guide as a VARCHAR datatype.
Syntax
VARCHAR={YES|NO}
Default
NO
Usage Notes
Cannot be entered inline.
When VARCHAR=YES, the implicit group item described in Chapter 1 of the Pro*COBOL Supplement to the Oracle Precompilers Guide is accepted as an Oracle7 VARCHAR external datatype with a length field and a string field.
When VARCHAR=NO, the Pro*COBOL Precompiler does not accept the implicit group items as VARCHAR external datatypes.
Purpose
Specifies whether a cross-reference section is included in the listing file.
Syntax
XREF={YES|NO}
Default
YES
Usage Notes
When XREF=YES, cross references are included for host variables, cursor names, and statement names. The cross references show where each object is defined and referenced in your program.
When XREF=NO, the cross-reference section is not included.
Conditional sections of code are marked by statements that define the environment and actions to take. You can code host-language statements as well as EXEC SQL statements in these sections. The following statements let you exercise conditional control over precompilation:
EXEC ORACLE DEFINE symbol; -- define a symbol
EXEC ORACLE IFDEF symbol; -- if symbol is defined
EXEC ORACLE IFNDEF symbol; -- if symbol is not defined
EXEC ORACLE ELSE; -- otherwise
EXEC ORACLE ENDIF; -- end this control block
All EXEC ORACLE statements must be terminated with the statement terminator for your host language. For example, in Pro*COBOL, a conditional statement must be terminated with "END-EXEC." and in Pro*FORTRAN it must be terminated by a return character.
EXEC ORACLE IFDEF site2;
EXEC SQL SELECT DNAME
INTO :dept_name
FROM DEPT
WHERE DEPTNO = :dept_number;
EXEC ORACLE ENDIF;
Blocks of conditions can be nested as shown in the following example:
EXEC ORACLE IFDEF outer;
EXEC ORACLE IFDEF inner;
...
EXEC ORACLE ENDIF;
EXEC ORACLE ENDIF;
You can "comment out" host-language or embedded SQL code by placing it between IFDEF and ENDIF and not defining the symbol.
EXEC ORACLE DEFINE symbol;
in your host program or define the symbol on the command line using the syntax
... INAME=filename ... DEFINE=symbol
where symbol is not case-sensitive.
Some port-specific symbols are predefined for you when the Oracle Precompilers are installed on your system. For example, predefined operating system symbols include CMS, MVS, MS-DOS, UNIX, and VMS.
Also, any program file that contains SQL statements must have a SQLCA that is in the scope of the local SQL statements.
The linker resolves symbolic references in the object modules. If these references conflict, the link fails. This can happen when you try to link third party software into a precompiled program. Not all third-party software is compatible with Oracle, so you might have problems. Check with Oracle Customer Support to see if the software is supported.
Compiling and linking are system-dependent. For instructions, see your system-specific Oracle manuals.
Prev Next |
Copyright © 1996 Oracle Corporation. All Rights Reserved. |
Library |
Product |
Contents |
Index |