Programmer's Guide to the Oracle Pro*COBOL Precompiler
Release 8.0






Prev Next

New Features

This appendix looks at the improvements and new features offered by the Oracle Pro*COBOL Precompiler, Release 8.0. Each is briefly described, and a reference to the more complete description in the chapters is provided.

These topics are presented:

DB2 Compatibility Features

These new features in Pro*COBOL 8.0 help you when migrating applications from DB2 to Oracle8, but all users of Pro*COBOL should review them.


Use of the BEGIN DECLARE SECTION and END DECLARE SECTION statements is now optional when DECLARE_SECTION=NO (the default). If used, the DECLARE statements must be properly paired within the same WORKING-STORAGE SECTION or other COBOL declaration unit.

The form of the precompiler option is:


which must be used on the command-line or in a configuration file. This option is a micro option with respect to the MODE option (a micro option controls only one behavior; a macro option controls several behaviors) and is subject to the general rule: macro options have precedence over micro options when, and only when, the macro level is at a higher level than the micro option. The levels are, in descending precedence:

This option allows the user to specify MODE=ORACLE together with DECLARE_SECTION=YES to get the same effect that previous releases provided when using MODE=ORACLE alone (only variables declared inside the DECLARE statements are allowed as host variables.) For further details, see "DECLARE_SECTION" on page 7-18. For further discussion of precedence of this option, and a table showing how macro option values set micro option values, see "Macro and Micro Options" on page 7-5.

Support of Additional Datatypes

The computational usage datatype COMP-4 (COMPUTATIONAL-4) is treated as a binary datatype. The IBM-implemented computational data type, COMP-4 (also represented as COMPUTATIONAL-4, will be treated as a binary datatype.

Display usage datatypes now supported are:

See "Host Variables" on page 3-12.

Support of Group Items as Host Variables

Pro*COBOL now allows the use of group items in embedded SQL statements. The host group items can be referenced in the INTO clause of a SELECT or a FETCH statement, and in the VALUES list of an INSERT statement. When a group item is used as a host variable, only the group name is used in the SQL statement. For more details see "Group Items as Host Variables" on page 3-18.

Implicit Form of VARCHAR Group Items

The declaration of COBOL groups that are recognized as VARCHAR are of the following format:

  nn   <identifier-1>
49 <identifier-2> PIC S9(4) <integer declaration>.
49 <identifier-3> PIC X(nc).

where the level, nn, is in the range 01 to 48, the length, nc, is in the range 1 to 65533, and PIC G or PIC N can be used instead of PIC X.

The VARCHAR=YES command line option must be specified for Pro*COBOL to recognize the extended form of the VARCHAR group items. Otherwise, any declarations in the above format will be interpreted as regular group items. For more details, see "Referencing VARCHAR Variables" on page 3-35.

Explicit Control Over the END_OF_FETCH SQLCODE Number

DB2 returns a SQLCODE value of 100 when an end-of-fetch condition occurs. To provide explicit control over the value returned by Oracle, the following option is available:

END_OF_FETCH={100 | 1403 (default)}

This option must be used on the command line or in a configuration file. For more details see "END_OF_FETCH" on page 7-19.

Support of the WITH HOLD Clause in the DECLARE CURSOR Statement

DB2 closes all cursors on commit, by default. This can be overridden on a cursor (which has been declared as for update) by using the WITH HOLD clause in the declaration of the cursor. Any cursor with the WITH HOLD clause will remain open after a commit or a rollback. The DB2 default occurs when MODE=ANSI, but then all host variables must be declared in a declare section. See "Declaring a Cursor" on page 5-11.

New Precompiler Option CLOSE_ON_COMMIT

A new precompiler option is provided:

CLOSE_ON_COMMIT={YES | NO (default)}

This option must be used on the command line or in a configuration file. It will only have an effect when a cursor is not coded using the WITH HOLD clause, since that will override both the new option and the existing behavior which is associated with MODE option. For more details, see "CLOSE_ON_COMMIT" on page 7-13

Support for DSNTIAR

DB2 provides a routine DSNTIAR to obtain a form of the SQLCA that can be displayed. Pro*COBOL now provides DSNTIAR. The interface is:


where SQLCA is a SQL communication area, MESSAGE is the output message area, in VARCHAR form of size greater than or equal to 240, and LRECL is a full-word containing the length of the output messages, between 72 and 240. For more details, see "DSNTIAR" on page 9-26.

Date String Format Precompiler Option

For compatibility with DB2, Pro*COBOL now provides the following precompiler option to specify date strings:

DATE_FORMAT={ISO | USA | EUR | JIS | LOCAL | 'fmt' (default LOCAL)}

The DATE_FORMAT option must be used on the command line or in a configuration file. The date strings are shown in the following table:

Table 1-1: Formats for Date Strings
Format Name   Abbreviation   Date Format  

International Standards Organization  



USA standard  



European standard  


Japanese Industrial Standard  





Any installation-defined form.  

`fmt' is a date format model, such as 'Month dd, yyyy'. See the Oracle8 Server SQL Reference for the list of date format model elements. For more details, see "DATE_FORMAT" on page 7-15.

Any Terminator Allowed after END-EXEC

A SQL statement now can be terminated by a comma, a period or another COBOL statement. For more details, see "Sentence Terminator" on page 3-8.

Other New Features

New Name for Configuration File

The configuration file is now called pcbcfg.cfg, instead of pccob.cfg. See "Configuration Files" on page 7-6.

Support of Other Additional Datatypes

The computational usage datatype PACKED-DECIMAL is treated as COMP-3 datatype for ANSI compatibility.

The datatype SCALED DISPLAY (PIC 9(n) and PIC S9(n)) is supported. Digits are held in ASCII or EBCDIC format in radix 10, with one digit per byte of computer storage. If present, the sign is held in a separate byte (designated by the phrase SIGN SEPARATE). The position is trailing, the default, or may be specified using the SIGN TRAILING clause.

Support of Nested Programs

Pro*COBOL now allows nested programs with embedded SQL within a single source file. Nested programs cannot be recursive. All level 01 items which are marked as global in a containing program and are valid host variables at the containing program level are usable as valid host variables in any programs directly or indirectly contained by the containing program. For more details, see "Nested Programs" on page 3-19.

Support for REDEFINES and FILLER

The REDEFINES clause can be used to redefine group items. For more details, see "REDEFINES Clause" on page 3-7

The word FILLER is now allowed in host variable declarations. For more details, see "FILLER is Allowed" on page 3-9

New Precompiler Option PICX

The default datatype for PIC X variables is changed from VARCHAR2 to CHARF. A new precompiler option provides backwards compatibility:


This option is allowed only on the command line or in a configuration file. The new default behavior is consistent with the normal COBOL move behavior.

For more details, see "PICX" on page 7-30.

Optional CONVBUFSZ Clause in VAR Statement

This clause specifies an optional buffer used for conversion between character sets.

For more details, see "CONVBUFSZ Clause in VAR Statement" on page 4-24.

Improved Error Reporting

Errors are now associated with the proper line in any list file or in any terminal output. "Invalid host variable" errors state why the given COBOL variable is invalid for use in embedded SQL.

Changing Password When Connecting

The executable embedded SQL statement, CONNECT, has a new optional, final clause which allows you to change the password:


See "Changing Passwords at Runtime" on page 3-52and the connect statement entry on page F-13.


Copyright © 1997 Oracle Corporation.

All Rights Reserved.